diff options
| author | Michael Niedermayer <[email protected]> | 2012-03-16 07:47:27 +0100 | 
|---|---|---|
| committer | Michael Niedermayer <[email protected]> | 2012-03-16 09:01:08 +0100 | 
| commit | 568e9062bd29e13e0bfa42f2ac8411d01608634d (patch) | |
| tree | a78351d75b3dee8257909ccffde46880099c91bb /libavcodec/rv10.c | |
| parent | 5dbc75870f486fb9c0237870eafa834a8a2066c8 (diff) | |
| parent | 5effcfa76792470677a1f6bc9aa73347a87ef720 (diff) | |
Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: (154 commits)
  Update Changelog for the 0.8.1 Release
  dca: include libavutil/mathematics.h for possibly missing M_SQRT1_2
  dca: don't use av_clip_uintp2().
  snow: check reference frame indices.
  snow: reject unsupported chroma shifts.
  xa_adpcm: limit filter to prevent xa_adpcm_table[] array bounds overruns.
  h264: increase reference poc list from 16 to 32.
  h264: stricter reference limit enforcement.
  h264: improve parsing of broken AVC SPS
  Replace computations of remaining bits with calls to get_bits_left().
  png: convert to bytestream2 API.
  roqvideo: convert to bytestream2 API.
  smc: port to bytestream2 API.
  tgq: convert to bytestream2 API.
  algmm: convert to bytestream2 API.
  jvdec: unbreak video decoding
  h264: Fix invalid interlaced/progressive MB combinations for direct mode prediction.
  libx264: add 'stats' private option for setting 2pass stats filename.
  libx264: fix help text for slice-max-size option.
  avconv: reindent
  ...
Conflicts:
	Changelog
	RELEASE
	avconv.c
	doc/APIchanges
	ffplay.c
	libavcodec/Makefile
	libavcodec/aacdec.c
	libavcodec/alsdec.c
	libavcodec/atrac3.c
	libavcodec/avcodec.h
	libavcodec/dvdata.c
	libavcodec/fraps.c
	libavcodec/golomb.h
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_direct.c
	libavcodec/h264_parser.c
	libavcodec/h264_ps.c
	libavcodec/h264idct_template.c
	libavcodec/indeo3.c
	libavcodec/kgv1dec.c
	libavcodec/kmvc.c
	libavcodec/mjpegbdec.c
	libavcodec/mmvideo.c
	libavcodec/mpegaudiodec.c
	libavcodec/mpegvideo.h
	libavcodec/options.c
	libavcodec/pngdec.c
	libavcodec/roqvideodec.c
	libavcodec/shorten.c
	libavcodec/svq3.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/wmadec.c
	libavcodec/xxan.c
	libavformat/Makefile
	libavformat/asfdec.c
	libavformat/dv.c
	libavformat/mov.c
	libavformat/nsvdec.c
	libavformat/utils.c
	libavformat/version.h
	libavutil/avutil.h
	libavutil/error.c
	libavutil/error.h
	libswscale/swscale.c
	libswscale/utils.c
	libswscale/x86/swscale_template.c
	tests/ref/acodec/g722
Merged-by: Michael Niedermayer <[email protected]>
Diffstat (limited to 'libavcodec/rv10.c')
| -rw-r--r-- | libavcodec/rv10.c | 34 | 
1 files changed, 26 insertions, 8 deletions
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index d97ed12272..58f10802a4 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -515,9 +515,10 @@ static int rv10_decode_packet(AVCodecContext *avctx,                               const uint8_t *buf, int buf_size, int buf_size2)  {      MpegEncContext *s = avctx->priv_data; -    int mb_count, mb_pos, left, start_mb_x; +    int mb_count, mb_pos, left, start_mb_x, active_bits_size; -    init_get_bits(&s->gb, buf, buf_size*8); +    active_bits_size = buf_size * 8; +    init_get_bits(&s->gb, buf, FFMAX(buf_size, buf_size2) * 8);      if(s->codec_id ==CODEC_ID_RV10)          mb_count = rv10_decode_picture_header(s);      else @@ -601,13 +602,26 @@ static int rv10_decode_packet(AVCodecContext *avctx,          s->mv_type = MV_TYPE_16X16;          ret=ff_h263_decode_mb(s, s->block); -        if (ret != SLICE_ERROR && s->gb.size_in_bits < get_bits_count(&s->gb) && 8*buf_size2 >= get_bits_count(&s->gb)){ -            av_log(avctx, AV_LOG_DEBUG, "update size from %d to %d\n", s->gb.size_in_bits, 8*buf_size2); -            s->gb.size_in_bits= 8*buf_size2; +        // Repeat the slice end check from ff_h263_decode_mb with our active +        // bitstream size +        if (ret != SLICE_ERROR) { +            int v = show_bits(&s->gb, 16); + +            if (get_bits_count(&s->gb) + 16 > active_bits_size) +                v >>= get_bits_count(&s->gb) + 16 - active_bits_size; + +            if (!v) +                ret = SLICE_END; +        } +        if (ret != SLICE_ERROR && active_bits_size < get_bits_count(&s->gb) && +            8 * buf_size2 >= get_bits_count(&s->gb)) { +            active_bits_size = buf_size2 * 8; +            av_log(avctx, AV_LOG_DEBUG, "update size from %d to %d\n", +                   8 * buf_size, active_bits_size);              ret= SLICE_OK;          } -        if (ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb)) { +        if (ret == SLICE_ERROR || active_bits_size < get_bits_count(&s->gb)) {              av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);              return -1;          } @@ -629,7 +643,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,      ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END); -    return s->gb.size_in_bits; +    return active_bits_size;  }  static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n) @@ -661,8 +675,12 @@ static int rv10_decode_frame(AVCodecContext *avctx,      if(!avctx->slice_count){          slice_count = (*buf++) + 1; +        buf_size--;          slices_hdr = buf + 4;          buf += 8 * slice_count; +        buf_size -= 8 * slice_count; +        if (buf_size <= 0) +            return AVERROR_INVALIDDATA;      }else          slice_count = avctx->slice_count; @@ -708,7 +726,7 @@ static int rv10_decode_frame(AVCodecContext *avctx,          s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...)      } -    return buf_size; +    return avpkt->size;  }  AVCodec ff_rv10_decoder = {  | 
