static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){

    Plane *p= &s->plane[plane_index];

    const int mb_w= s->b_width  << s->block_max_depth;

    const int mb_h= s->b_height << s->block_max_depth;

    int x, y, mb_x;

    int block_size = MB_SIZE >> s->block_max_depth;

    int block_w    = plane_index ? block_size>>s->chroma_h_shift : block_size;

    int block_h    = plane_index ? block_size>>s->chroma_v_shift : block_size;

    const uint8_t *obmc  = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth];

    int obmc_stride= plane_index ? (2*block_size)>>s->chroma_h_shift : 2*block_size;

    int ref_stride= s->current_picture->linesize[plane_index];

    uint8_t *dst8= s->current_picture->data[plane_index];

    int w= p->width;

    int h= p->height;



    if(s->keyframe || (s->avctx->debug&512)){

        if(mb_y==mb_h)

            return;



        if(add){

            for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){

//                DWTELEM * line = slice_buffer_get_line(sb, y);

                IDWTELEM * line = sb->line[y];

                for(x=0; x<w; x++){

//                    int v= buf[x + y*w] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));

                    int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));

                    v >>= FRAC_BITS;

                    if(v&(~255)) v= ~(v>>31);

                    dst8[x + y*ref_stride]= v;

                }

            }

        }else{

            for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){

//                DWTELEM * line = slice_buffer_get_line(sb, y);

                IDWTELEM * line = sb->line[y];

                for(x=0; x<w; x++){

                    line[x] -= 128 << FRAC_BITS;

//                    buf[x + y*w]-= 128<<FRAC_BITS;

                }

            }

        }



        return;

    }



    for(mb_x=0; mb_x<=mb_w; mb_x++){

        add_yblock(s, 1, sb, old_buffer, dst8, obmc,

                   block_w*mb_x - block_w/2,

                   block_h*mb_y - block_h/2,

                   block_w, block_h,

                   w, h,

                   w, ref_stride, obmc_stride,

                   mb_x - 1, mb_y - 1,

                   add, 0, plane_index);

    }



    if(s->avmv && mb_y < mb_h && plane_index == 0)

        for(mb_x=0; mb_x<mb_w; mb_x++){

            AVMotionVector *avmv = s->avmv + (s->avmv_index++);

            const int b_width = s->b_width  << s->block_max_depth;

            const int b_stride= b_width;

            BlockNode *bn= &s->block[mb_x + mb_y*b_stride];



            if (bn->type)

                continue;



            avmv->w = block_w;

            avmv->h = block_h;

            avmv->dst_x = block_w*mb_x - block_w/2;

            avmv->dst_y = block_h*mb_y - block_h/2;

            avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8;

            avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8;

            avmv->source= -1 - bn->ref;

            avmv->flags = 0;

        }

}

static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){

    Plane *p= &s->plane[plane_index];

    const int mb_w= s->b_width  << s->block_max_depth;

    const int mb_h= s->b_height << s->block_max_depth;

    int x, y, mb_x;

    int block_size = MB_SIZE >> s->block_max_depth;

    int block_w    = plane_index ? block_size>>s->chroma_h_shift : block_size;

    int block_h    = plane_index ? block_size>>s->chroma_v_shift : block_size;

    const uint8_t *obmc  = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth];

    int obmc_stride= plane_index ? (2*block_size)>>s->chroma_h_shift : 2*block_size;

    int ref_stride= s->current_picture->linesize[plane_index];

    uint8_t *dst8= s->current_picture->data[plane_index];

    int w= p->width;

    int h= p->height;



    if(s->keyframe || (s->avctx->debug&512)){

        if(mb_y==mb_h)

            return;



        if(add){

            for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){



                IDWTELEM * line = sb->line[y];

                for(x=0; x<w; x++){



                    int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));

                    v >>= FRAC_BITS;

                    if(v&(~255)) v= ~(v>>31);

                    dst8[x + y*ref_stride]= v;

                }

            }

        }else{

            for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){



                IDWTELEM * line = sb->line[y];

                for(x=0; x<w; x++){

                    line[x] -= 128 << FRAC_BITS;



                }

            }

        }



        return;

    }



    for(mb_x=0; mb_x<=mb_w; mb_x++){

        add_yblock(s, 1, sb, old_buffer, dst8, obmc,

                   block_w*mb_x - block_w/2,

                   block_h*mb_y - block_h/2,

                   block_w, block_h,

                   w, h,

                   w, ref_stride, obmc_stride,

                   mb_x - 1, mb_y - 1,

                   add, 0, plane_index);

    }



    if(s->avmv && mb_y < mb_h && plane_index == 0)

        for(mb_x=0; mb_x<mb_w; mb_x++){

            AVMotionVector *avmv = s->avmv + (s->avmv_index++);

            const int b_width = s->b_width  << s->block_max_depth;

            const int b_stride= b_width;

            BlockNode *bn= &s->block[mb_x + mb_y*b_stride];



            if (bn->type)

                continue;



            avmv->w = block_w;

            avmv->h = block_h;

            avmv->dst_x = block_w*mb_x - block_w/2;

            avmv->dst_y = block_h*mb_y - block_h/2;

            avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8;

            avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8;

            avmv->source= -1 - bn->ref;

            avmv->flags = 0;

        }

}

            AVMotionVector *avmv = s->avmv + (s->avmv_index++);
static av_always_inline void FUNC_0(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){

    Plane *p= &s->plane[plane_index];

    const int VAR_0= s->VAR_14  << s->block_max_depth;

    const int VAR_1= s->b_height << s->block_max_depth;

    int VAR_2, VAR_3, VAR_4;

    int VAR_5 = MB_SIZE >> s->block_max_depth;

    int VAR_6    = plane_index ? VAR_5>>s->chroma_h_shift : VAR_5;

    int VAR_7    = plane_index ? VAR_5>>s->chroma_v_shift : VAR_5;

    const uint8_t *VAR_8  = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth];

    int VAR_9= plane_index ? (2*VAR_5)>>s->chroma_h_shift : 2*VAR_5;

    int VAR_10= s->current_picture->linesize[plane_index];

    uint8_t *dst8= s->current_picture->data[plane_index];

    int VAR_11= p->width;

    int VAR_12= p->height;



    if(s->keyframe || (s->avctx->debug&512)){

        if(mb_y==VAR_1)

            return;



        if(add){

            for(VAR_3=VAR_7*mb_y; VAR_3<FFMIN(VAR_12,VAR_7*(mb_y+1)); VAR_3++){



                IDWTELEM * line = sb->line[VAR_3];

                for(VAR_2=0; VAR_2<VAR_11; VAR_2++){



                    int VAR_13= line[VAR_2] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));

                    VAR_13 >>= FRAC_BITS;

                    if(VAR_13&(~255)) VAR_13= ~(VAR_13>>31);

                    dst8[VAR_2 + VAR_3*VAR_10]= VAR_13;

                }

            }

        }else{

            for(VAR_3=VAR_7*mb_y; VAR_3<FFMIN(VAR_12,VAR_7*(mb_y+1)); VAR_3++){



                IDWTELEM * line = sb->line[VAR_3];

                for(VAR_2=0; VAR_2<VAR_11; VAR_2++){

                    line[VAR_2] -= 128 << FRAC_BITS;



                }

            }

        }



        return;

    }



    for(VAR_4=0; VAR_4<=VAR_0; VAR_4++){

        add_yblock(s, 1, sb, old_buffer, dst8, VAR_8,

                   VAR_6*VAR_4 - VAR_6/2,

                   VAR_7*mb_y - VAR_7/2,

                   VAR_6, VAR_7,

                   VAR_11, VAR_12,

                   VAR_11, VAR_10, VAR_9,

                   VAR_4 - 1, mb_y - 1,

                   add, 0, plane_index);

    }



    if(s->avmv && mb_y < VAR_1 && plane_index == 0)

        for(VAR_4=0; VAR_4<VAR_0; VAR_4++){

            AVMotionVector *avmv = s->avmv + (s->avmv_index++);

            const int VAR_14 = s->VAR_14  << s->block_max_depth;

            const int VAR_15= VAR_14;

            BlockNode *bn= &s->block[VAR_4 + mb_y*VAR_15];



            if (bn->type)

                continue;



            avmv->VAR_11 = VAR_6;

            avmv->VAR_12 = VAR_7;

            avmv->dst_x = VAR_6*VAR_4 - VAR_6/2;

            avmv->dst_y = VAR_7*mb_y - VAR_7/2;

            avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8;

            avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8;

            avmv->source= -1 - bn->ref;

            avmv->flags = 0;

        }

}

static av_always_inline void FUNC_0(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){ Plane *p= &s->plane[plane_index]; const int VAR_0= s->VAR_14  << s->block_max_depth; const int VAR_1= s->b_height << s->block_max_depth; int VAR_2, VAR_3, VAR_4; int VAR_5 = MB_SIZE >> s->block_max_depth; int VAR_6    = plane_index ? VAR_5>>s->chroma_h_shift : VAR_5; int VAR_7    = plane_index ? VAR_5>>s->chroma_v_shift : VAR_5; const uint8_t *VAR_8  = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth]; int VAR_9= plane_index ? (2*VAR_5)>>s->chroma_h_shift : 2*VAR_5; int VAR_10= s->current_picture->linesize[plane_index]; uint8_t *dst8= s->current_picture->data[plane_index]; int VAR_11= p->width; int VAR_12= p->height; if(s->keyframe || (s->avctx->debug&512)){ if(mb_y==VAR_1)
return; if(add){ for(VAR_3=VAR_7*mb_y; VAR_3<FFMIN(VAR_12,VAR_7*(mb_y+1)); VAR_3++){ IDWTELEM * line = sb->line[VAR_3]; for(VAR_2=0; VAR_2<VAR_11; VAR_2++){ int VAR_13= line[VAR_2] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); VAR_13 >>= FRAC_BITS; if(VAR_13&(~255)) VAR_13= ~(VAR_13>>31); dst8[VAR_2 + VAR_3*VAR_10]= VAR_13; } } }else{ for(VAR_3=VAR_7*mb_y; VAR_3<FFMIN(VAR_12,VAR_7*(mb_y+1)); VAR_3++){ IDWTELEM * line = sb->line[VAR_3]; for(VAR_2=0; VAR_2<VAR_11; VAR_2++){ line[VAR_2] -= 128 << FRAC_BITS; } } } return; } for(VAR_4=0; VAR_4<=VAR_0; VAR_4++){ add_yblock(s, 1, sb, old_buffer, dst8, VAR_8,
VAR_6*VAR_4 - VAR_6/2,
VAR_7*mb_y - VAR_7/2,
VAR_6, VAR_7,
VAR_11, VAR_12,
VAR_11, VAR_10, VAR_9,
VAR_4 - 1, mb_y - 1,
add, 0, plane_index); } if(s->avmv && mb_y < VAR_1 && plane_index == 0)
for(VAR_4=0; VAR_4<VAR_0; VAR_4++){ AVMotionVector *avmv = s->avmv + (s->avmv_index++); const int VAR_14 = s->VAR_14  << s->block_max_depth; const int VAR_15= VAR_14; BlockNode *bn= &s->block[VAR_4 + mb_y*VAR_15]; if (bn->type)
continue; avmv->VAR_11 = VAR_6; avmv->VAR_12 = VAR_7; avmv->dst_x = VAR_6*VAR_4 - VAR_6/2; avmv->dst_y = VAR_7*mb_y - VAR_7/2; avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8; avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8; avmv->source= -1 - bn->ref; avmv->flags = 0; } }