diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-09-23 21:57:45 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-09-23 21:57:45 +0200 |
| commit | 4154609e5de76bc8858d3f86e0af09ba2700c488 (patch) | |
| tree | 853583f99e97895a51db57d0e66672672d20c2f9 /src/blind-to-video.c | |
| parent | Fix conversion of Y value (diff) | |
| download | blind-4154609e5de76bc8858d3f86e0af09ba2700c488.tar.gz blind-4154609e5de76bc8858d3f86e0af09ba2700c488.tar.bz2 blind-4154609e5de76bc8858d3f86e0af09ba2700c488.tar.xz | |
Fix colour distortion
This matrices are not convert to or from the proper YUV colour space both
rather the ones used in videos. srgb_to_yuv was created by converting the
image [sRGB(100%, 0, 0); sRGB(0, 100%, 0); sRGB(0, 0, 100%)] to YUV with
FFmpeg and transposing the matrix. yuv_to_srgb is the inversion of that
matrix, the values in the first column should all be 1 but are not due to
rounding/truncation error.
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 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/blind-to-video.c b/src/blind-to-video.c index d57920d..a902c35 100644 --- a/src/blind-to-video.c +++ b/src/blind-to-video.c @@ -119,8 +119,8 @@ PROCESS(struct stream *stream, size_t n) b = srgb_encode(b); srgb_to_yuv(r, g, b, pixel + 0, pixel + 1, pixel + 2); y = (long int)(pixel[0] * 0xDAF4L) + 0x1001L; - u = (long int)(pixel[1] * 0xFFFFL) + 0x8000L; - v = (long int)(pixel[2] * 0xFFFFL) + 0x8000L; + u = (long int)(pixel[1] * 0xFF00L) + 0x8000L; + v = (long int)(pixel[2] * 0xFF00L) + 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)); |
