for(y=block_w*mb_y; y<block_w*(mb_y+1); y++)
for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++)
static always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, DWTELEM * 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/2 : block_size;    const uint8_t *obmc  = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];    int obmc_stride= plane_index ? block_size : 2*block_size;    int ref_stride= s->current_picture.linesize[plane_index];    uint8_t *ref  = s->last_picture.data[plane_index];    uint8_t *dst8= s->current_picture.data[plane_index];    int w= p->width;    int h= p->height;    START_TIMER        if(s->keyframe || (s->avctx->debug&512)){        if(mb_y==mb_h)            return;        if(add){            for(y=block_w*mb_y; y<block_w*(mb_y+1); y++)            {//                DWTELEM * line = slice_buffer_get_line(sb, y);                DWTELEM * 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_w*mb_y; y<block_w*(mb_y+1); y++)            {//                DWTELEM * line = slice_buffer_get_line(sb, y);                DWTELEM * 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++){            START_TIMER            add_yblock_buffered(s, sb, old_buffer, dst8, ref, obmc,                        block_w*mb_x - block_w/2,                       block_w*mb_y - block_w/2,                       block_w, block_w,                       w, h,                       w, ref_stride, obmc_stride,                       mb_x - 1, mb_y - 1,                       add, plane_index);                        STOP_TIMER("add_yblock")        }        STOP_TIMER("predict_slice")}