diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2016-01-19 23:12:39 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-01-19 23:30:36 +0100 |
commit | ff8c2c41030289b4a6ea6d547c91c90bc8484f26 (patch) | |
tree | 4b3bef6b175267e434ebf4e026f345973f9f0e52 /libswscale/yuv2rgb.c | |
parent | acd37069aec2058821c73b85ccac2d879949f0ff (diff) | |
download | ffmpeg-ff8c2c41030289b4a6ea6d547c91c90bc8484f26.tar.gz |
yuv2rgb: Document the color space coefficients
Based on the original documentation found in mpeg2dec (1995).
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libswscale/yuv2rgb.c')
-rw-r--r-- | libswscale/yuv2rgb.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index e81f3f6f31..3671fe342f 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -35,6 +35,17 @@ #include "swscale_internal.h" #include "libavutil/pixdesc.h" +/* Color space conversion coefficients for YCbCr -> RGB mapping. + * + * Entries are {crv, cbu, cgu, cgv} + * + * crv = (255 / 224) * 65536 * (1 - cr) / 0.5 + * cbu = (255 / 224) * 65536 * (1 - cb) / 0.5 + * cgu = (255 / 224) * 65536 * (cb / cg) * (1 - cb) / 0.5 + * cgv = (255 / 224) * 65536 * (cr / cg) * (1 - cr) / 0.5 + * + * where Y = cr * R + cg * G + cb * B and cr + cg + cb = 1. + */ const int32_t ff_yuv2rgb_coeffs[8][4] = { { 117504, 138453, 13954, 34903 }, /* no sequence_display_extension */ { 117504, 138453, 13954, 34903 }, /* ITU-R Rec. 709 (1990) */ |