Commit 72e69131 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h264: clear chroma planes when flags gray is used

Fixes Ticket3397
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 42361bdf
......@@ -454,6 +454,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment