static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){

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

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

    BlockNode backup= *block;

    int rd, index, value;



    assert(mb_x>=0 && mb_y>=0);

    assert(mb_x<b_stride);



    if(intra){

        block->color[0] = p[0];

        block->color[1] = p[1];

        block->color[2] = p[2];

        block->type |= BLOCK_INTRA;

    }else{

        index= (p[0] + 31*p[1]) & (ME_CACHE_SIZE-1);

        value= s->me_cache_generation + (p[0]>>10) + (p[1]<<6) + (block->ref<<12);

        if(s->me_cache[index] == value)

            return 0;

        s->me_cache[index]= value;



        block->mx= p[0];

        block->my= p[1];

        block->type &= ~BLOCK_INTRA;

    }



    rd= get_block_rd(s, mb_x, mb_y, 0, obmc_edged);



//FIXME chroma

    if(rd < *best_rd){

        *best_rd= rd;

        return 1;

    }else{

        *block= backup;

        return 0;

    }

}

static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){

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

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

    BlockNode backup= *block;

    int rd, index, value;



    assert(mb_x>=0 && mb_y>=0);

    assert(mb_x<b_stride);



    if(intra){

        block->color[0] = p[0];

        block->color[1] = p[1];

        block->color[2] = p[2];

        block->type |= BLOCK_INTRA;

    }else{

        index= (p[0] + 31*p[1]) & (ME_CACHE_SIZE-1);

        value= s->me_cache_generation + (p[0]>>10) + (p[1]<<6) + (block->ref<<12);

        if(s->me_cache[index] == value)

            return 0;

        s->me_cache[index]= value;



        block->mx= p[0];

        block->my= p[1];

        block->type &= ~BLOCK_INTRA;

    }



    rd= get_block_rd(s, mb_x, mb_y, 0, obmc_edged);





    if(rd < *best_rd){

        *best_rd= rd;

        return 1;

    }else{

        *block= backup;

        return 0;

    }

}

    int rd, index, value;     int rd, index, value;
static av_always_inline int FUNC_0(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){

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

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

    BlockNode backup= *block;

    int VAR_1, VAR_2, VAR_3;



    assert(mb_x>=0 && mb_y>=0);

    assert(mb_x<VAR_0);



    if(intra){

        block->color[0] = p[0];

        block->color[1] = p[1];

        block->color[2] = p[2];

        block->type |= BLOCK_INTRA;

    }else{

        VAR_2= (p[0] + 31*p[1]) & (ME_CACHE_SIZE-1);

        VAR_3= s->me_cache_generation + (p[0]>>10) + (p[1]<<6) + (block->ref<<12);

        if(s->me_cache[VAR_2] == VAR_3)

            return 0;

        s->me_cache[VAR_2]= VAR_3;



        block->mx= p[0];

        block->my= p[1];

        block->type &= ~BLOCK_INTRA;

    }



    VAR_1= get_block_rd(s, mb_x, mb_y, 0, obmc_edged);





    if(VAR_1 < *best_rd){

        *best_rd= VAR_1;

        return 1;

    }else{

        *block= backup;

        return 0;

    }

}

static av_always_inline int FUNC_0(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ const int VAR_0= s->b_width << s->block_max_depth; BlockNode *block= &s->block[mb_x + mb_y * VAR_0]; BlockNode backup= *block; int VAR_1, VAR_2, VAR_3; assert(mb_x>=0 && mb_y>=0); assert(mb_x<VAR_0); if(intra){ block->color[0] = p[0]; block->color[1] = p[1]; block->color[2] = p[2]; block->type |= BLOCK_INTRA; }else{ VAR_2= (p[0] + 31*p[1]) & (ME_CACHE_SIZE-1); VAR_3= s->me_cache_generation + (p[0]>>10) + (p[1]<<6) + (block->ref<<12); if(s->me_cache[VAR_2] == VAR_3)
return 0; s->me_cache[VAR_2]= VAR_3; block->mx= p[0]; block->my= p[1]; block->type &= ~BLOCK_INTRA; } VAR_1= get_block_rd(s, mb_x, mb_y, 0, obmc_edged); if(VAR_1 < *best_rd){ *best_rd= VAR_1; return 1; }else{ *block= backup; return 0; } }