Originally committed as revision 10825 to svn://svn.ffmpeg.org/ffmpeg/trunk
Kostya Shishkov authored on 2007/10/22 02:22:37... | ... |
@@ -711,6 +711,12 @@ static int rv10_decode_packet(AVCodecContext *avctx, |
711 | 711 |
return buf_size; |
712 | 712 |
} |
713 | 713 |
|
714 |
+static int get_slice_offset(AVCodecContext *avctx, uint8_t *buf, int n) |
|
715 |
+{ |
|
716 |
+ if(avctx->slice_count) return avctx->slice_offset[n]; |
|
717 |
+ else return AV_RL32(buf + n*8); |
|
718 |
+} |
|
719 |
+ |
|
714 | 720 |
static int rv10_decode_frame(AVCodecContext *avctx, |
715 | 721 |
void *data, int *data_size, |
716 | 722 |
uint8_t *buf, int buf_size) |
... | ... |
@@ -718,6 +724,8 @@ static int rv10_decode_frame(AVCodecContext *avctx, |
718 | 718 |
MpegEncContext *s = avctx->priv_data; |
719 | 719 |
int i; |
720 | 720 |
AVFrame *pict = data; |
721 |
+ int slice_count; |
|
722 |
+ uint8_t *slices_hdr = NULL; |
|
721 | 723 |
|
722 | 724 |
#ifdef DEBUG |
723 | 725 |
av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size); |
... | ... |
@@ -728,21 +736,24 @@ static int rv10_decode_frame(AVCodecContext *avctx, |
728 | 728 |
return 0; |
729 | 729 |
} |
730 | 730 |
|
731 |
- if(avctx->slice_count){ |
|
732 |
- for(i=0; i<avctx->slice_count; i++){ |
|
733 |
- int offset= avctx->slice_offset[i]; |
|
731 |
+ if(!avctx->slice_count){ |
|
732 |
+ slice_count = (*buf++) + 1; |
|
733 |
+ slices_hdr = buf + 4; |
|
734 |
+ buf += 8 * slice_count; |
|
735 |
+ }else |
|
736 |
+ slice_count = avctx->slice_count; |
|
737 |
+ |
|
738 |
+ for(i=0; i<slice_count; i++){ |
|
739 |
+ int offset= get_slice_offset(avctx, slices_hdr, i); |
|
734 | 740 |
int size; |
735 | 741 |
|
736 |
- if(i+1 == avctx->slice_count) |
|
742 |
+ if(i+1 == slice_count) |
|
737 | 743 |
size= buf_size - offset; |
738 | 744 |
else |
739 |
- size= avctx->slice_offset[i+1] - offset; |
|
745 |
+ size= get_slice_offset(avctx, slices_hdr, i+1) - offset; |
|
740 | 746 |
|
741 | 747 |
rv10_decode_packet(avctx, buf+offset, size); |
742 | 748 |
} |
743 |
- }else{ |
|
744 |
- rv10_decode_packet(avctx, buf, buf_size); |
|
745 |
- } |
|
746 | 749 |
|
747 | 750 |
if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){ |
748 | 751 |
ff_er_frame_end(s); |