MCPcopy Create free account
hub / github.com/Lightricks/ComfyUI-LTXVideo / compress

Method compress

hdr.py:40–46  ·  view source on GitHub ↗
(self, hdr: Tensor)

Source from the content-addressed store, hash-verified

38 CUT = 0.010591
39
40 def compress(self, hdr: Tensor) -> Tensor:
41 x = torch.clamp(hdr, min=0.0)
42 log_part = self.C * torch.log10(self.A * x + self.B) + self.D
43 lin_part = self.E * x + self.F
44 logc = torch.where(x >= self.CUT, log_part, lin_part)
45 logc = torch.clamp(logc, 0.0, 1.0)
46 return logc * 2.0 - 1.0
47
48 def decompress(self, z: Tensor) -> Tensor:
49 logc = torch.clamp((z + 1.0) / 2.0, 0.0, 1.0)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected