{START_TIMER const int mb_h= s->b_height << s->block_max_depth; const int block_size = MB_SIZE >> s->block_max_depth; const int block_w    = plane_index ? block_size/2 : block_size; int mb_y; dwt_compose_t cs[MAX_DECOMPOSITIONS]; int yd=0, yq=0;  ff_spatial_idwt_init(cs, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count); for(mb_y=0; mb_y<=mb_h; mb_y++){ const int slice_h = block_w*(mb_y+1); for(; yd<slice_h; yd+=4) ff_spatial_idwt_slice(cs, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);  if(s->qlog == LOSSLESS_QLOG){ for(; yq<slice_h && yq<h; yq++){ for(x=0; x<w; x++){ s->spatial_dwt_buffer[yq*w + x]<<=FRAC_BITS; } } }  predict_slice(s, s->spatial_dwt_buffer, plane_index, 1, mb_y);
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size){    SnowContext *s = avctx->priv_data;    RangeCoder * const c= &s->c;    int bytes_read;    AVFrame *picture = data;    int level, orientation, plane_index;    ff_init_range_decoder(c, buf, buf_size);    ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);    s->current_picture.pict_type= FF_I_TYPE; //FIXME I vs. P    decode_header(s);    if(!s->block) alloc_blocks(s);    frame_start(s);    //keyframe flag dupliaction mess FIXME    if(avctx->debug&FF_DEBUG_PICT_INFO)        av_log(avctx, AV_LOG_ERROR, "keyframe:%d qlog:%d\n", s->keyframe, s->qlog);        decode_blocks(s);    for(plane_index=0; plane_index<3; plane_index++){        Plane *p= &s->plane[plane_index];        int w= p->width;        int h= p->height;        int x, y;        if(s->avctx->debug&2048){        memset(s->spatial_dwt_buffer, 0, sizeof(DWTELEM)*w*h);        predict_plane(s, s->spatial_dwt_buffer, plane_index, 1);        for(y=0; y<h; y++){            for(x=0; x<w; x++){                int v= s->current_picture.data[plane_index][y*s->current_picture.linesize[plane_index] + x];                s->mconly_picture.data[plane_index][y*s->mconly_picture.linesize[plane_index] + x]= v;            }        }}        for(level=0; level<s->spatial_decomposition_count; level++){            for(orientation=level ? 1 : 0; orientation<4; orientation++){                SubBand *b= &p->band[level][orientation];                decode_subband(s, b, b->buf, b->parent ? b->parent->buf : NULL, b->stride, orientation);                if(orientation==0){                    correlate(s, b, b->buf, b->stride, 1, 0);                    dequantize(s, b, b->buf, b->stride);                    assert(b->buf == s->spatial_dwt_buffer);                }            }        }{START_TIMER    const int mb_h= s->b_height << s->block_max_depth;    const int block_size = MB_SIZE >> s->block_max_depth;    const int block_w    = plane_index ? block_size/2 : block_size;    int mb_y;    dwt_compose_t cs[MAX_DECOMPOSITIONS];    int yd=0, yq=0;    ff_spatial_idwt_init(cs, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);    for(mb_y=0; mb_y<=mb_h; mb_y++){        const int slice_h = block_w*(mb_y+1);        for(; yd<slice_h; yd+=4)            ff_spatial_idwt_slice(cs, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);        if(s->qlog == LOSSLESS_QLOG){            for(; yq<slice_h && yq<h; yq++){                for(x=0; x<w; x++){                    s->spatial_dwt_buffer[yq*w + x]<<=FRAC_BITS;                }            }        }        predict_slice(s, s->spatial_dwt_buffer, plane_index, 1, mb_y);    }STOP_TIMER("idwt + predict_slices")}    }                emms_c();    if(s->last_picture.data[0])        avctx->release_buffer(avctx, &s->last_picture);if(!(s->avctx->debug&2048))            *picture= s->current_picture;else    *picture= s->mconly_picture;        *data_size = sizeof(AVFrame);        bytes_read= c->bytestream - c->bytestream_start;    if(bytes_read ==0) av_log(s->avctx, AV_LOG_ERROR, "error at end of frame\n"); //FIXME    return bytes_read;}