comparison rv10.c @ 5842:6eade0a54b19 libavcodec

Make RV10/20 decoder work with new frame format
author kostya
date Sun, 21 Oct 2007 17:22:37 +0000
parents d2ef80f5fd7e
children ad72b1e8934a
comparison
equal deleted inserted replaced
5841:8cdb7ff18b4e 5842:6eade0a54b19
709 ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END); 709 ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
710 710
711 return buf_size; 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 static int rv10_decode_frame(AVCodecContext *avctx, 720 static int rv10_decode_frame(AVCodecContext *avctx,
715 void *data, int *data_size, 721 void *data, int *data_size,
716 uint8_t *buf, int buf_size) 722 uint8_t *buf, int buf_size)
717 { 723 {
718 MpegEncContext *s = avctx->priv_data; 724 MpegEncContext *s = avctx->priv_data;
719 int i; 725 int i;
720 AVFrame *pict = data; 726 AVFrame *pict = data;
727 int slice_count;
728 uint8_t *slices_hdr = NULL;
721 729
722 #ifdef DEBUG 730 #ifdef DEBUG
723 av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size); 731 av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
724 #endif 732 #endif
725 733
726 /* no supplementary picture */ 734 /* no supplementary picture */
727 if (buf_size == 0) { 735 if (buf_size == 0) {
728 return 0; 736 return 0;
729 } 737 }
730 738
731 if(avctx->slice_count){ 739 if(!avctx->slice_count){
732 for(i=0; i<avctx->slice_count; i++){ 740 slice_count = (*buf++) + 1;
733 int offset= avctx->slice_offset[i]; 741 slices_hdr = buf + 4;
742 buf += 8 * slice_count;
743 }else
744 slice_count = avctx->slice_count;
745
746 for(i=0; i<slice_count; i++){
747 int offset= get_slice_offset(avctx, slices_hdr, i);
734 int size; 748 int size;
735 749
736 if(i+1 == avctx->slice_count) 750 if(i+1 == slice_count)
737 size= buf_size - offset; 751 size= buf_size - offset;
738 else 752 else
739 size= avctx->slice_offset[i+1] - offset; 753 size= get_slice_offset(avctx, slices_hdr, i+1) - offset;
740 754
741 rv10_decode_packet(avctx, buf+offset, size); 755 rv10_decode_packet(avctx, buf+offset, size);
742 } 756 }
743 }else{
744 rv10_decode_packet(avctx, buf, buf_size);
745 }
746 757
747 if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){ 758 if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){
748 ff_er_frame_end(s); 759 ff_er_frame_end(s);
749 MPV_frame_end(s); 760 MPV_frame_end(s);
750 761