]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pgssubdec.c
Merge commit 'ea6ab02a174bcc11f3eaa1b840c9a4c895968690'
[ffmpeg] / libavcodec / pgssubdec.c
index 07a2a7862928248cab42a33e020e98fd5ab4ff72..133d08bfa72ce0bab9b3acb327f0b4c9d9116954 100644 (file)
@@ -354,8 +354,14 @@ static int parse_palette_segment(AVCodecContext *avctx,
         cb        = bytestream_get_byte(&buf);
         alpha     = bytestream_get_byte(&buf);
 
-        YUV_TO_RGB1(cb, cr);
-        YUV_TO_RGB2(r, g, b, y);
+        /* Default to BT.709 colorimetry. In case of <= 576 height use BT.601 */
+        if (avctx->height <= 0 || avctx->height > 576) {
+            YUV_TO_RGB1_CCIR_BT709(cb, cr);
+        } else {
+            YUV_TO_RGB1_CCIR(cb, cr);
+        }
+
+        YUV_TO_RGB2_CCIR(r, g, b, y);
 
         ff_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);