| 2723 | } |
| 2724 | |
| 2725 | static inline int get_block_bits(SnowContext *s, int x, int y, int w){ |
| 2726 | const int b_stride = s->b_width << s->block_max_depth; |
| 2727 | const int b_height = s->b_height<< s->block_max_depth; |
| 2728 | int index= x + y*b_stride; |
| 2729 | const BlockNode *b = &s->block[index]; |
| 2730 | const BlockNode *left = x ? &s->block[index-1] : &null_block; |
| 2731 | const BlockNode *top = y ? &s->block[index-b_stride] : &null_block; |
| 2732 | const BlockNode *tl = y && x ? &s->block[index-b_stride-1] : left; |
| 2733 | const BlockNode *tr = y && x+w<b_stride ? &s->block[index-b_stride+w] : tl; |
| 2734 | int dmx, dmy; |
| 2735 | // int mx_context= av_log2(2*FFABS(left->mx - top->mx)); |
| 2736 | // int my_context= av_log2(2*FFABS(left->my - top->my)); |
| 2737 | |
| 2738 | if(x<0 || x>=b_stride || y>=b_height) |
| 2739 | return 0; |
| 2740 | /* |
| 2741 | 1 0 0 |
| 2742 | 01X 1-2 1 |
| 2743 | 001XX 3-6 2-3 |
| 2744 | 0001XXX 7-14 4-7 |
| 2745 | 00001XXXX 15-30 8-15 |
| 2746 | */ |
| 2747 | //FIXME try accurate rate |
| 2748 | //FIXME intra and inter predictors if surrounding blocks are not the same type |
| 2749 | if(b->type & BLOCK_INTRA){ |
| 2750 | return 3+2*( av_log2(2*FFABS(left->color[0] - b->color[0])) |
| 2751 | + av_log2(2*FFABS(left->color[1] - b->color[1])) |
| 2752 | + av_log2(2*FFABS(left->color[2] - b->color[2]))); |
| 2753 | }else{ |
| 2754 | pred_mv(s, &dmx, &dmy, b->ref, left, top, tr); |
| 2755 | dmx-= b->mx; |
| 2756 | dmy-= b->my; |
| 2757 | return 2*(1 + av_log2(2*FFABS(dmx)) //FIXME kill the 2* can be merged in lambda |
| 2758 | + av_log2(2*FFABS(dmy)) |
| 2759 | + av_log2(2*b->ref)); |
| 2760 | } |
| 2761 | } |
| 2762 | |
| 2763 | static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, const uint8_t *obmc_edged){ |
| 2764 | Plane *p= &s->plane[plane_index]; |
no test coverage detected