[FFmpeg-cvslog] r25474 - trunk/libavcodec/ffv1.c

Anton Khirnov anton
Sat Oct 16 13:39:31 CEST 2010


On Fri, Oct 15, 2010 at 12:03:33AM +0200, michael wrote:
> @@ -689,6 +703,65 @@ static int write_extra_header(FFV1Contex
>      return 0;
>  }
>  
> +static int init_slice_state(FFV1Context *f){
> +    int i, j;
> +
> +    for(i=0; i<f->slice_count; i++){
> +        FFV1Context *fs= f->slice_context[i];
> +        for(j=0; j<f->plane_count; j++){
> +            PlaneContext * const p= &fs->plane[j];
> +
> +            if(fs->ac){
> +                if(!p->    state) p->    state= av_malloc(CONTEXT_SIZE*p->context_count*sizeof(uint8_t));
> +                if(!p->    state)
> +                    return AVERROR(ENOMEM);
> +            }else{
> +                if(!p->vlc_state) p->vlc_state= av_malloc(p->context_count*sizeof(VlcState));
> +                if(!p->vlc_state)
> +                    return AVERROR(ENOMEM);
> +            }
> +        }
> +
> +        if (fs->ac>1){
> +            //FIXME only redo if state_transition changed
> +            for(j=1; j<256; j++){
> +                fs->c.one_state [    j]= fs->state_transition[j];
> +                fs->c.zero_state[256-j]= 256-fs->c.one_state [j];
> +            }
> +        }
> +    }
> +
> +    return 0;
> +}
> +
> +static av_cold int init_slice_contexts(FFV1Context *f){
> +    int i;
> +
> +    f->slice_count= f->num_h_slices * f->num_v_slices;
> +
> +    for(i=0; i<f->slice_count; i++){
> +        FFV1Context *fs= av_mallocz(sizeof(*fs));
> +        int sx= i % f->num_h_slices;
> +        int sy= i / f->num_h_slices;
> +        int sxs= f->avctx->width * sx    / f->num_h_slices;
> +        int sxe= f->avctx->width *(sx+1) / f->num_h_slices;
> +        int sys= f->avctx->height* sy    / f->num_v_slices;
> +        int sye= f->avctx->height*(sy+1) / f->num_v_slices;
> +        f->slice_context[i]= fs;
> +        memcpy(fs, f, sizeof(*fs));
> +
> +        fs->slice_width = sxe - sxs;
> +        fs->slice_height= sye - sys;
> +        fs->slice_x     = sxs;
> +        fs->slice_y     = sys;
> +
> +        fs->sample_buffer = av_malloc(6 * (fs->slice_width+6) * sizeof(*fs->sample_buffer));
> +        if (!fs->sample_buffer)
> +            return AVERROR(ENOMEM);
> +    }
> +    return 0;
> +}
> +
>  static av_cold int encode_init(AVCodecContext *avctx)
>  {
>      FFV1Context *s = avctx->priv_data;
those are under CONFIG_FFV1_ENCODER, but are called from decode_init
=> fails to compile with encoder disabled.

-- 
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20101016/f1522e8a/attachment-0001.pgp>



More information about the ffmpeg-cvslog mailing list