[FFmpeg-devel] [PATCH] swscale: add bt2020 yuv2rgb coefficients.
Ronald S. Bultje
rsbultje at gmail.com
Thu Mar 31 21:37:10 CEST 2016
Hi,
On Thu, Mar 31, 2016 at 2:51 PM, Clément Bœsch <u at pkh.me> wrote:
> On Thu, Mar 31, 2016 at 02:29:12PM -0400, Ronald S. Bultje wrote:
> > Also fix the bt709 ones. They seem derived from incorrect values
> > cr=0.2125 (should be cr=0.2126) and cb=0.0721 (should be cb=0.0722).
>
> Can you split?
Sure
> ---
> > libswscale/swscale.h | 1 +
> > libswscale/yuv2rgb.c | 13 ++++++++-----
> > 2 files changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/libswscale/swscale.h b/libswscale/swscale.h
> > index da9dd2e..6b8b926 100644
> > --- a/libswscale/swscale.h
> > +++ b/libswscale/swscale.h
> > @@ -91,6 +91,7 @@ const char *swscale_license(void);
> > #define SWS_CS_SMPTE170M 5
> > #define SWS_CS_SMPTE240M 7
> > #define SWS_CS_DEFAULT 5
> > +#define SWS_CS_BT2020 9
> >
>
> probably requires micro or minor bump in version.h
Will do minor.
> /**
> > * Return a pointer to yuv<->rgb coefficients for the given colorspace
> > diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
> > index 62abb7d..1fe5abe 100644
> > --- a/libswscale/yuv2rgb.c
> > +++ b/libswscale/yuv2rgb.c
> > @@ -46,20 +46,23 @@
> > *
> > * 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) */
> > +const int32_t ff_yuv2rgb_coeffs[11][4] = {
> > + { 117489, 138438, 13975, 34925 }, /* no sequence_display_extension
> */
> > + { 117489, 138438, 13975, 34925 }, /* ITU-R Rec. 709 (1990) */
>
> no FATE change? oO
Didn't test :-D. I don't think this (colorspaces) is covered, but I'll run
make fate to be sure.
> { 104597, 132201, 25675, 53279 }, /* unspecified */
> > { 104597, 132201, 25675, 53279 }, /* reserved */
> > { 104448, 132798, 24759, 53109 }, /* FCC */
> > { 104597, 132201, 25675, 53279 }, /* ITU-R Rec. 624-4 System B, G */
> > { 104597, 132201, 25675, 53279 }, /* SMPTE 170M */
> > - { 117579, 136230, 16907, 35559 } /* SMPTE 240M (1987) */
> > + { 117579, 136230, 16907, 35559 }, /* SMPTE 240M (1987) */
>
> > + { 0 }, /* YCgCo */
>
> why the empty entry?
So the colorspaces indices (SWS_CS_*) match the respective entries in enum
AVColorSpace (lavu/pixfmt.h).
Ronald
More information about the ffmpeg-devel
mailing list