diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-09-23 19:14:42 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-09-23 19:14:42 +0200 |
| commit | 2b646382a5745b65d32e6bc66b9cf41149673c8c (patch) | |
| tree | 72f2eabe8614bb4ac7ae487ef0ddebff11809aff /src/blind-to-video.c | |
| parent | blind-to-video manpage: transparent videos (diff) | |
| download | blind-2b646382a5745b65d32e6bc66b9cf41149673c8c.tar.gz blind-2b646382a5745b65d32e6bc66b9cf41149673c8c.tar.bz2 blind-2b646382a5745b65d32e6bc66b9cf41149673c8c.tar.xz | |
Fix conversion of Y value
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/blind-to-video.c')
| -rw-r--r-- | src/blind-to-video.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/blind-to-video.c b/src/blind-to-video.c index 5cdffe6..d57920d 100644 --- a/src/blind-to-video.c +++ b/src/blind-to-video.c @@ -99,9 +99,9 @@ PROCESS(struct stream *stream, size_t n) for (ptr = 0; ptr < n; ptr += 4 * sizeof(TYPE)) { pixel = (TYPE *)(buf + ptr); ciexyz_to_scaled_yuv(pixel[0], pixel[1], pixel[2], &r, &g, &b); - y = (long int)r + 16L * 256L; - u = (long int)g + 128L * 256L; - v = (long int)b + 128L * 256L; + y = (long int)r + 0x1001L; + u = (long int)g + 0x8000L; + v = (long int)b + 0x8000L; *pixels++ = 0xFFFFU; *pixels++ = htole((uint16_t)CLIP(0, y, 0xFFFFL)); *pixels++ = htole((uint16_t)CLIP(0, u, 0xFFFFL)); @@ -118,9 +118,9 @@ PROCESS(struct stream *stream, size_t n) g = srgb_encode(g); b = srgb_encode(b); srgb_to_yuv(r, g, b, pixel + 0, pixel + 1, pixel + 2); - y = (long int)(pixel[0] * 0xFFFFL) + 16L * 256L; - u = (long int)(pixel[1] * 0xFFFFL) + 128L * 256L; - v = (long int)(pixel[2] * 0xFFFFL) + 128L * 256L; + y = (long int)(pixel[0] * 0xDAF4L) + 0x1001L; + u = (long int)(pixel[1] * 0xFFFFL) + 0x8000L; + v = (long int)(pixel[2] * 0xFFFFL) + 0x8000L; *pixels++ = htole((uint16_t)CLIP(0, a, 0xFFFFL)); *pixels++ = htole((uint16_t)CLIP(0, y, 0xFFFFL)); *pixels++ = htole((uint16_t)CLIP(0, u, 0xFFFFL)); |
