Commit 6751a00a authored by Kostya Shishkov's avatar Kostya Shishkov

RV30 decoder passes possible frame sizes in extradata and selects

an appropriate frame size from them in slice, make my decoder do
that as well.

This fixes issue 779

Originally committed as revision 16529 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent fd7f5963
...@@ -38,6 +38,7 @@ static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn ...@@ -38,6 +38,7 @@ static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn
int mb_bits; int mb_bits;
int w = r->s.width, h = r->s.height; int w = r->s.width, h = r->s.height;
int mb_size; int mb_size;
int rpr;
memset(si, 0, sizeof(SliceInfo)); memset(si, 0, sizeof(SliceInfo));
if(get_bits(gb, 3)) if(get_bits(gb, 3))
...@@ -49,9 +50,14 @@ static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn ...@@ -49,9 +50,14 @@ static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn
si->quant = get_bits(gb, 5); si->quant = get_bits(gb, 5);
skip_bits1(gb); skip_bits1(gb);
si->pts = get_bits(gb, 13); si->pts = get_bits(gb, 13);
skip_bits(gb, r->rpr); rpr = get_bits(gb, r->rpr);
si->width = w; if(!rpr){
si->height = h; si->width = w;
si->height = h;
}else{
si->width = r->s.avctx->extradata[6 + rpr*2] << 2;
si->height = r->s.avctx->extradata[7 + rpr*2] << 2;
}
mb_size = ((w + 15) >> 4) * ((h + 15) >> 4); mb_size = ((w + 15) >> 4) * ((h + 15) >> 4);
mb_bits = ff_rv34_get_start_offset(gb, mb_size); mb_bits = ff_rv34_get_start_offset(gb, mb_size);
si->start = get_bits(gb, mb_bits); si->start = get_bits(gb, mb_bits);
...@@ -248,6 +254,10 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx) ...@@ -248,6 +254,10 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx)
} }
r->rpr = (avctx->extradata[1] & 7) >> 1; r->rpr = (avctx->extradata[1] & 7) >> 1;
r->rpr = FFMIN(r->rpr + 1, 3); r->rpr = FFMIN(r->rpr + 1, 3);
if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){
av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n",
6 + r->rpr * 2, avctx->extradata_size);
}
r->parse_slice_header = rv30_parse_slice_header; r->parse_slice_header = rv30_parse_slice_header;
r->decode_intra_types = rv30_decode_intra_types; r->decode_intra_types = rv30_decode_intra_types;
r->decode_mb_info = rv30_decode_mb_info; r->decode_mb_info = rv30_decode_mb_info;
......
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