summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2016-04-24 20:33:45 +0200
committerLuca Barbato <lu_zero@gentoo.org>2016-05-10 11:30:25 +0200
commit885a9d6087315a85d98f7e89656ef01dc7104c4c (patch)
tree9dd320c2e66eb2b6b395d9afb73ea2dcc467fd17 /libavcodec
parent1f77e634bb838f71ff21923b5e9fe3104c831c52 (diff)
pgssub: Fix subpicture colorspace and range
Widen the values from limited to full range and use BT.709 where it should be used according to the video resolution: SD is BT.601, HD is BT.709 Default to BT.709 due to most observed HDMV content being HD.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pgssubdec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 7bcb1ed792..a4cb66b0ae 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -351,8 +351,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 colorspace. 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);