Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Mar 2012 00:21:16 +0000 (01:21 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Mar 2012 00:27:10 +0000 (01:27 +0100)
* qatar/master:
  h264: stricter reference limit enforcement.
  h264: increase reference poc list from 16 to 32.
  xa_adpcm: limit filter to prevent xa_adpcm_table[] array bounds overruns.
  snow: check reference frame indices.
  snow: reject unsupported chroma shifts.
  Add ffvhuff encoding and decoding regression test
  anm: convert to bytestream2 API
  bytestream: add more unchecked variants for bytestream2 API
  jvdec: unbreak video decoding
  jv demux: set video stream duration
  fate: add pam image regression test

Conflicts:
libavcodec/adpcm.c
libavcodec/anm.c
libavcodec/h264.c
libavcodec/mpegvideo.h
libavcodec/snowdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/adpcm.c
libavcodec/anm.c
libavcodec/bytestream.h
libavcodec/h264.c
libavcodec/jvdec.c
libavcodec/snowdec.c
libavformat/jvdec.c
tests/codec-regression.sh
tests/lavf-regression.sh
tests/ref/vsynth1/ffvhuff
tests/ref/vsynth2/ffvhuff

@@@ -277,9 -278,11 +278,9 @@@ static int xa_decode(AVCodecContext *av
  
          shift  = 12 - (in[4+i*2] & 15);
          filter = in[4+i*2] >> 4;
 -        if (filter > 4) {
 -            av_log(avctx, AV_LOG_ERROR,
 -                   "Invalid XA-ADPCM filter %d (max. allowed is 4)\n",
 -                   filter);
 -            return AVERROR_INVALIDDATA;
 +        if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) {
-             av_log_ask_for_sample(NULL, "unknown filter %d\n", filter);
++            av_log_ask_for_sample(avctx, "unknown XA-ADPCM filter %d\n", filter);
 +            filter=0;
          }
          f0 = xa_adpcm_table[filter][0];
          f1 = xa_adpcm_table[filter][1];
  
          shift  = 12 - (in[5+i*2] & 15);
          filter = in[5+i*2] >> 4;
 -        if (filter > 4) {
 -            av_log(avctx, AV_LOG_ERROR,
 -                   "Invalid XA-ADPCM filter %d (max. allowed is 4)\n",
 -                   filter);
 -            return AVERROR_INVALIDDATA;
 +        if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) {
-             av_log_ask_for_sample(NULL, "unknown filter %d\n", filter);
++            av_log_ask_for_sample(avctx, "unknown XA-ADPCM filter %d\n", filter);
 +            filter=0;
          }
 +
          f0 = xa_adpcm_table[filter][0];
          f1 = xa_adpcm_table[filter][1];
  
@@@ -41,15 -41,14 +41,15 @@@ static av_cold int decode_init(AVCodecC
  
      avctx->pix_fmt = PIX_FMT_PAL8;
  
-     if (avctx->extradata_size != 16*8 + 4*256)
-         return -1;
 -    s->frame.reference = 1;
 +    avcodec_get_frame_defaults(&s->frame);
 +    s->frame.reference = 3;
+     bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size);
+     if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256)
+         return -1;
  
-     buf = avctx->extradata + 16*8;
+     bytestream2_skipu(&s->gb, 16 * 8);
      for (i = 0; i < 256; i++)
-         s->palette[i] = bytestream_get_le32(&buf);
+         s->palette[i] = bytestream2_get_le32u(&s->gb);
  
      return 0;
  }
Simple merge
@@@ -3034,7 -3021,8 +3034,8 @@@ static int decode_slice_header(H264Cont
      h->ref_count[1]= h->pps.ref_count[1];
  
      if(h->slice_type_nos != AV_PICTURE_TYPE_I){
-         unsigned max= (16<<(s->picture_structure != PICT_FRAME))-1;
 -        int max_refs = s->picture_structure == PICT_FRAME ? 16 : 32;
++        unsigned max= s->picture_structure == PICT_FRAME ? 15 : 31;
          if(h->slice_type_nos == AV_PICTURE_TYPE_B){
              h->direct_spatial_mv_pred= get_bits1(&s->gb);
          }
              h->ref_count[0]= get_ue_golomb(&s->gb) + 1;
              if(h->slice_type_nos==AV_PICTURE_TYPE_B)
                  h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
          }
-         if(h->ref_count[0]-1 > max || h->ref_count[1]-1 > max){
 -        if (h->ref_count[0] > max_refs || h->ref_count[1] > max_refs) {
++        if (h->ref_count[0]-1 > max || h->ref_count[1]-1 > max){
              av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n");
-             h->ref_count[0]= h->ref_count[1]= 1;
-             return -1;
+             h->ref_count[0] = h->ref_count[1] = 1;
+             return AVERROR_INVALIDDATA;
          }
          if(h->slice_type_nos == AV_PICTURE_TYPE_B)
              h->list_count= 2;
          else
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 0000000,4a1ebdb..c6d7627
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,4 +1,4 @@@
 -da0c0bd12ac141c976ffa6a71832ab4b *./tests/data/vsynth1/ffvhuff.avi
++0632ffae6f1e06dd299bf41a845b9099 *./tests/data/vsynth1/ffvhuff.avi
+  5987208 ./tests/data/vsynth1/ffvhuff.avi
+ c5ccac874dbf808e9088bc3107860042 *./tests/data/ffvhuff.vsynth1.out.yuv
+ stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  7603200/  7603200
index 0000000,47fc659..6d77e2a
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,4 +1,4 @@@
 -d31aab445b24f738df45fdd7479d6dd7 *./tests/data/vsynth2/ffvhuff.avi
++63926d8835dd5779dca0a4bc081ca8ae *./tests/data/vsynth2/ffvhuff.avi
+  4988056 ./tests/data/vsynth2/ffvhuff.avi
+ dde5895817ad9d219f79a52d0bdfb001 *./tests/data/ffvhuff.vsynth2.out.yuv
+ stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  7603200/  7603200