diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-17 15:00:16 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-17 15:09:05 +0200 |
commit | 3b6bde3b3de4f392bfd4ac800778e9e62eefa78e (patch) | |
tree | e6fe2fb76ff630760b1523094ec597e426a4ae77 /libavcodec/h264_mb.c | |
parent | 4f187f0af13bf4ff4d4b9c8081ce0ef73ad91345 (diff) | |
download | ffmpeg-3b6bde3b3de4f392bfd4ac800778e9e62eefa78e.tar.gz |
avcodec/h264_mb: fix grayscale only decoding with weighted prediction
Fixes Ticket3412
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 94f60b65446b37132d7bd644ab2c4627d9488295)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_mb.c')
-rw-r--r-- | libavcodec/h264_mb.c | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c index 191c01aa74..7feae5761c 100644 --- a/libavcodec/h264_mb.c +++ b/libavcodec/h264_mb.c @@ -420,10 +420,12 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square, int weight1 = 64 - weight0; luma_weight_avg(dest_y, tmp_y, h->mb_linesize, height, 5, weight0, weight1, 0); - chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, - chroma_height, 5, weight0, weight1, 0); - chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, - chroma_height, 5, weight0, weight1, 0); + if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { + chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, + chroma_height, 5, weight0, weight1, 0); + chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, + chroma_height, 5, weight0, weight1, 0); + } } else { luma_weight_avg(dest_y, tmp_y, h->mb_linesize, height, h->luma_log2_weight_denom, @@ -431,18 +433,20 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square, h->luma_weight[refn1][1][0], h->luma_weight[refn0][0][1] + h->luma_weight[refn1][1][1]); - chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height, - h->chroma_log2_weight_denom, - h->chroma_weight[refn0][0][0][0], - h->chroma_weight[refn1][1][0][0], - h->chroma_weight[refn0][0][0][1] + - h->chroma_weight[refn1][1][0][1]); - chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height, - h->chroma_log2_weight_denom, - h->chroma_weight[refn0][0][1][0], - h->chroma_weight[refn1][1][1][0], - h->chroma_weight[refn0][0][1][1] + - h->chroma_weight[refn1][1][1][1]); + if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { + chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height, + h->chroma_log2_weight_denom, + h->chroma_weight[refn0][0][0][0], + h->chroma_weight[refn1][1][0][0], + h->chroma_weight[refn0][0][0][1] + + h->chroma_weight[refn1][1][0][1]); + chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height, + h->chroma_log2_weight_denom, + h->chroma_weight[refn0][0][1][0], + h->chroma_weight[refn1][1][1][0], + h->chroma_weight[refn0][0][1][1] + + h->chroma_weight[refn1][1][1][1]); + } } } else { int list = list1 ? 1 : 0; @@ -456,15 +460,17 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square, h->luma_log2_weight_denom, h->luma_weight[refn][list][0], h->luma_weight[refn][list][1]); - if (h->use_weight_chroma) { - chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height, - h->chroma_log2_weight_denom, - h->chroma_weight[refn][list][0][0], - h->chroma_weight[refn][list][0][1]); - chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height, - h->chroma_log2_weight_denom, - h->chroma_weight[refn][list][1][0], - h->chroma_weight[refn][list][1][1]); + if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { + if (h->use_weight_chroma) { + chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height, + h->chroma_log2_weight_denom, + h->chroma_weight[refn][list][0][0], + h->chroma_weight[refn][list][0][1]); + chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height, + h->chroma_log2_weight_denom, + h->chroma_weight[refn][list][1][0], + h->chroma_weight[refn][list][1][1]); + } } } } |