[FFmpeg-devel] [PATCH]lavc/pgssubdec: Fix palette colourspace

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Apr 17 21:24:29 CEST 2016


On Sun, Apr 17, 2016 at 09:08:45PM +0200, Carl Eugen Hoyos wrote:
> -        YUV_TO_RGB1(cb, cr);
> -        YUV_TO_RGB2(r, g, b, y);
> +        if (ctx->hdtv > 0) {
> +            YUV_TO_RGB1_CCIR(cb, cr);
> +            YUV_TO_RGB2_CCIR(r, g, b, y);
> +        } else {
> +            YUV_TO_RGB1(cb, cr);
> +            YUV_TO_RGB2(r, g, b, y);
> +        }

That is actually more wrong :)
YUV_TO_RGB1_CCIR is Rec.609, so what should be used for SD.
For HD, it still should use the *255.0/224.0, but the other
coefficients need to be tweaked.
MPlayer seems to be a bit off, plus we already have fixed-point
coefficients in libswscale we might want to match, but something
like:
    r_add = FIX(1.5701*255.0/224.0) * cr + ONE_HALF;\
    g_add = - FIX(0.1870*255.0/224.0) * cb - FIX(0.4664*255.0/224.0) * cr + \
            ONE_HALF;\
    b_add = FIX(1.8556*255.0/224.0) * cb + ONE_HALF;\


More information about the ffmpeg-devel mailing list