Revision 4f90f33a libavcodec/snow.c

View differences:

libavcodec/snow.c
1656 1656
    int plane_index, level, orientation;
1657 1657

  
1658 1658
    for(plane_index=0; plane_index<3; plane_index++){
1659
        for(level=0; level<s->spatial_decomposition_count; level++){
1659
        for(level=0; level<MAX_DECOMPOSITIONS; level++){
1660 1660
            for(orientation=level ? 1:0; orientation<4; orientation++){
1661 1661
                memset(s->plane[plane_index].band[level][orientation].state, MID_STATE, sizeof(s->plane[plane_index].band[level][orientation].state));
1662 1662
            }
......
3697 3697
static int common_init(AVCodecContext *avctx){
3698 3698
    SnowContext *s = avctx->priv_data;
3699 3699
    int width, height;
3700
    int level, orientation, plane_index;
3701 3700
    int i, j;
3702 3701

  
3703 3702
    s->avctx= avctx;
......
3745 3744
    if(!qexp[0])
3746 3745
        init_qexp();
3747 3746

  
3748
    s->spatial_decomposition_count= 5;
3749
    s->spatial_decomposition_type= avctx->prediction_method; //FIXME add decorrelator type r transform_type
3750

  
3751
    s->chroma_h_shift= 1; //FIXME XXX
3752
    s->chroma_v_shift= 1;
3753

  
3754 3747
//    dec += FFMAX(s->chroma_h_shift, s->chroma_v_shift);
3755 3748

  
3756 3749
    width= s->avctx->width;
......
3759 3752
    s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM));
3760 3753
    s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this doesnt belong here
3761 3754

  
3762
    s->mv_scale= (s->avctx->flags & CODEC_FLAG_QPEL) ? 2 : 4;
3763
    s->block_max_depth= (s->avctx->flags & CODEC_FLAG_4MV) ? 1 : 0;
3755
    for(i=0; i<MAX_REF_FRAMES; i++)
3756
        for(j=0; j<MAX_REF_FRAMES; j++)
3757
            scale_mv_ref[i][j] = 256*(i+1)/(j+1);
3758

  
3759
    s->avctx->get_buffer(s->avctx, &s->mconly_picture);
3760

  
3761
    return 0;
3762
}
3763

  
3764
static int common_init_after_header(AVCodecContext *avctx){
3765
    SnowContext *s = avctx->priv_data;
3766
    int plane_index, level, orientation;
3764 3767

  
3765 3768
    for(plane_index=0; plane_index<3; plane_index++){
3766 3769
        int w= s->avctx->width;
......
3773 3776
        s->plane[plane_index].width = w;
3774 3777
        s->plane[plane_index].height= h;
3775 3778

  
3776
        s->plane[plane_index].diag_mc= 1;
3777
        s->plane[plane_index].htaps= 6;
3778
        s->plane[plane_index].hcoeff[0]=  40;
3779
        s->plane[plane_index].hcoeff[1]= -10;
3780
        s->plane[plane_index].hcoeff[2]=   2;
3781
        s->plane[plane_index].fast_mc= 1;
3782

  
3783 3779
//av_log(NULL, AV_LOG_DEBUG, "%d %d\n", w, h);
3784 3780
        for(level=s->spatial_decomposition_count-1; level>=0; level--){
3785 3781
            for(orientation=level ? 1 : 0; orientation<4; orientation++){
......
3807 3803

  
3808 3804
                if(level)
3809 3805
                    b->parent= &s->plane[plane_index].band[level-1][orientation];
3806
                //FIXME avoid this realloc
3807
                av_freep(&b->x_coeff);
3810 3808
                b->x_coeff=av_mallocz(((b->width+1) * b->height+1)*sizeof(x_and_coeff));
3811 3809
            }
3812 3810
            w= (w+1)>>1;
......
3814 3812
        }
3815 3813
    }
3816 3814

  
3817
    for(i=0; i<MAX_REF_FRAMES; i++)
3818
        for(j=0; j<MAX_REF_FRAMES; j++)
3819
            scale_mv_ref[i][j] = 256*(i+1)/(j+1);
3820

  
3821
/*
3822
    width= s->width= avctx->width;
3823
    height= s->height= avctx->height;
3824

  
3825
    assert(width && height);
3826
*/
3827
    s->avctx->get_buffer(s->avctx, &s->mconly_picture);
3828

  
3829 3815
    return 0;
3830 3816
}
3831 3817

  
......
3931 3917
        return -1;
3932 3918
    }
3933 3919

  
3920
    s->spatial_decomposition_count= 5;
3921
    s->spatial_decomposition_type= avctx->prediction_method; //FIXME add decorrelator type r transform_type
3922

  
3923
    s->chroma_h_shift= 1; //FIXME XXX
3924
    s->chroma_v_shift= 1;
3925

  
3926
    s->mv_scale       = (avctx->flags & CODEC_FLAG_QPEL) ? 2 : 4;
3927
    s->block_max_depth= (avctx->flags & CODEC_FLAG_4MV ) ? 1 : 0;
3928

  
3929
    for(plane_index=0; plane_index<3; plane_index++){
3930
        s->plane[plane_index].diag_mc= 1;
3931
        s->plane[plane_index].htaps= 6;
3932
        s->plane[plane_index].hcoeff[0]=  40;
3933
        s->plane[plane_index].hcoeff[1]= -10;
3934
        s->plane[plane_index].hcoeff[2]=   2;
3935
        s->plane[plane_index].fast_mc= 1;
3936
    }
3937

  
3934 3938
    common_init(avctx);
3939
    common_init_after_header(avctx);
3935 3940
    alloc_blocks(s);
3936 3941

  
3937 3942
    s->version=0;
......
4414 4419

  
4415 4420
    s->current_picture.pict_type= FF_I_TYPE; //FIXME I vs. P
4416 4421
    decode_header(s);
4422
    common_init_after_header(avctx);
4417 4423

  
4418 4424
    // realloc slice buffer for the case that spatial_decomposition_count changed
4419 4425
    slice_buffer_destroy(&s->sb);

Also available in: Unified diff