[FFmpeg-devel] [RFC] Feed whole frames to RV* decoders

Michael Niedermayer michaelni
Tue Oct 2 22:29:23 CEST 2007


Hi

On Tue, Oct 02, 2007 at 08:02:59AM +0300, Kostya wrote:
> Here is an updated working version of gathering complete frames
> for Real Video decoders. Both RM and Matroska demuxers are passing
> whole frames to RealVideo decoder (RV10/20 is patched to accept
> this format).
> 
> Please comment. 

> Index: libavcodec/rv10.c
> ===================================================================
> --- libavcodec/rv10.c	(revision 10505)
> +++ libavcodec/rv10.c	(working copy)
> @@ -718,6 +718,7 @@
>      MpegEncContext *s = avctx->priv_data;
>      int i;
>      AVFrame *pict = data;
> +    int slice_count, *slice_offset;
>  
>  #ifdef DEBUG
>      av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
> @@ -729,20 +730,29 @@
>      }
>  
>      if(avctx->slice_count){
> -        for(i=0; i<avctx->slice_count; i++){
> -            int offset= avctx->slice_offset[i];
> +        slice_count = avctx->slice_count;
> +        slice_offset = avctx->slice_offset;
> +    }else{
> +        slice_count = (*buf++) + 1;
> +        slice_offset = av_malloc(sizeof(int)*slice_count);
> +        for(i = 0; i < slice_count; i++){
> +            buf += 4;
> +            slice_offset[i] = AV_RL32(buf);
> +            buf += 4;
> +        }
> +    }
> +
> +        for(i=0; i<slice_count; i++){
> +            int offset= slice_offset[i];
>              int size;
>  
> -            if(i+1 == avctx->slice_count)
> +            if(i+1 == slice_count)
>                  size= buf_size - offset;
>              else
> -                size= avctx->slice_offset[i+1] - offset;
> +                size= slice_offset[i+1] - offset;
>  
>              rv10_decode_packet(avctx, buf+offset, size);
>          }
> -    }else{
> -        rv10_decode_packet(avctx, buf, buf_size);
> -    }
>  
>      if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){
>          ff_er_frame_end(s);

this is ugly
the only thing needed is a

static int get_slice_offset(avctx, buf, int i){
    if(avctx->slice_count)  return avctx->slice_offset[i];
    else                    return AV_RL32(buf+8*i);
}


> Index: libavformat/matroskadec.c

iam not matroska demuxer maintainer


[...]

> Index: libavformat/rmdec.c

iam not rm demuxer maintainer

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071002/cc10b563/attachment.pgp>



More information about the ffmpeg-devel mailing list