(self, hdr: Tensor)
| 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) |
nothing calls this directly
no outgoing calls
no test coverage detected