summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2016-01-19 17:10:59 -0500
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-01-20 11:18:31 -0500
commite9175634ec96e36873929637491189150cfce9ec (patch)
treeca299890eb991c6ceba42c78bb148233d493fd5b /libswscale
parent472d488ebcc53bea4cdb124edb94558e72d8f23f (diff)
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')
-rw-r--r--libswscale/yuv2rgb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index a4f7a1178e..fca324299d 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) */