aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-23 18:20:05 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2014-02-24 09:45:48 +0100
commitc7c724056ef4998a7ecc881457c2b90074490bbd (patch)
tree944a97f3473c2cf3177f6f72b2920610331f7c7c /libavcodec
parentd3139c9733f1994fb86825e0d1fd2a5abf3be7b5 (diff)
downloadffmpeg-c7c724056ef4998a7ecc881457c2b90074490bbd.tar.gz
avcodec/h264: clear chroma planes when flags gray is used
Fixes Ticket3397 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 72e691314027b08955679319394dd0d8477973b7)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 2ee9e43a70..6c2efba222 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -452,6 +452,18 @@ static int alloc_picture(H264Context *h, Picture *pic)
pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
}
}
+ if (!h->avctx->hwaccel && CONFIG_GRAY && h->flags & CODEC_FLAG_GRAY && pic->f.data[2]) {
+ int h_chroma_shift, v_chroma_shift;
+ av_pix_fmt_get_chroma_sub_sample(pic->f.format,
+ &h_chroma_shift, &v_chroma_shift);
+
+ for(i=0; i<FF_CEIL_RSHIFT(h->avctx->height, v_chroma_shift); i++) {
+ memset(pic->f.data[1] + pic->f.linesize[1]*i,
+ 0x80, FF_CEIL_RSHIFT(h->avctx->width, h_chroma_shift));
+ memset(pic->f.data[2] + pic->f.linesize[2]*i,
+ 0x80, FF_CEIL_RSHIFT(h->avctx->width, h_chroma_shift));
+ }
+ }
if (!h->qscale_table_pool) {
ret = init_table_pools(h);