[FFmpeg-cvslog] yuv2rgb: Document the color space coefficients

Vittorio Giovara git at videolan.org
Wed Jan 27 20:42:03 CET 2016


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Tue Jan 19 17:10:59 2016 -0500| [e9175634ec96e36873929637491189150cfce9ec] | committer: Vittorio Giovara

yuv2rgb: Document the color space coefficients

Based on the original documentation found in mpeg2dec (1995).

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9175634ec96e36873929637491189150cfce9ec
---

 libswscale/yuv2rgb.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index a4f7a11..fca3242 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -35,6 +35,17 @@
 #include "swscale.h"
 #include "swscale_internal.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) */



More information about the ffmpeg-cvslog mailing list