]> git.sesse.net Git - ffmpeg/commitdiff
hevc: always clip luma_log2_weight_denom
authorVittorio Giovara <vittorio.giovara@gmail.com>
Wed, 10 Dec 2014 01:41:44 +0000 (01:41 +0000)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 15 Dec 2014 14:46:34 +0000 (15:46 +0100)
Its value shall be between 0 and 7 according to the specifications.

CC: libav-stable@libav.org
Bug-Id: CID 1257502

libavcodec/hevc.c

index 08bed862252599eb86989dbaba589db2e6b1cdb3..897a28efd4b004ae67c720e06021a776c8a72858 100644 (file)
@@ -251,7 +251,7 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
     uint8_t luma_weight_l1_flag[16];
     uint8_t chroma_weight_l1_flag[16];
 
-    s->sh.luma_log2_weight_denom = get_ue_golomb_long(gb);
+    s->sh.luma_log2_weight_denom = av_clip_c(get_ue_golomb_long(gb), 0, 7);
     if (s->sps->chroma_format_idc != 0) {
         int delta = get_se_golomb(gb);
         s->sh.chroma_log2_weight_denom = av_clip_c(s->sh.luma_log2_weight_denom + delta, 0, 7);