MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / get_block_rd

Function get_block_rd

libavcodec/snow.c:2763–2859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2761}
2762
2763static 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];
2765 const int block_size = MB_SIZE >> s->block_max_depth;
2766 const int block_w = plane_index ? block_size/2 : block_size;
2767 const int obmc_stride= plane_index ? block_size : 2*block_size;
2768 const int ref_stride= s->current_picture.linesize[plane_index];
2769 uint8_t *dst= s->current_picture.data[plane_index];
2770 uint8_t *src= s-> input_picture.data[plane_index];
2771 IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4;
2772 uint8_t *cur = s->scratchbuf;
2773 uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)];
2774 const int b_stride = s->b_width << s->block_max_depth;
2775 const int b_height = s->b_height<< s->block_max_depth;
2776 const int w= p->width;
2777 const int h= p->height;
2778 int distortion;
2779 int rate= 0;
2780 const int penalty_factor= get_penalty_factor(s->lambda, s->lambda2, s->avctx->me_cmp);
2781 int sx= block_w*mb_x - block_w/2;
2782 int sy= block_w*mb_y - block_w/2;
2783 int x0= FFMAX(0,-sx);
2784 int y0= FFMAX(0,-sy);
2785 int x1= FFMIN(block_w*2, w-sx);
2786 int y1= FFMIN(block_w*2, h-sy);
2787 int i,x,y;
2788
2789 pred_block(s, cur, tmp, ref_stride, sx, sy, block_w*2, block_w*2, &s->block[mb_x + mb_y*b_stride], plane_index, w, h);
2790
2791 for(y=y0; y<y1; y++){
2792 const uint8_t *obmc1= obmc_edged + y*obmc_stride;
2793 const IDWTELEM *pred1 = pred + y*obmc_stride;
2794 uint8_t *cur1 = cur + y*ref_stride;
2795 uint8_t *dst1 = dst + sx + (sy+y)*ref_stride;
2796 for(x=x0; x<x1; x++){
2797#if FRAC_BITS >= LOG2_OBMC_MAX
2798 int v = (cur1[x] * obmc1[x]) << (FRAC_BITS - LOG2_OBMC_MAX);
2799#else
2800 int v = (cur1[x] * obmc1[x] + (1<<(LOG2_OBMC_MAX - FRAC_BITS-1))) >> (LOG2_OBMC_MAX - FRAC_BITS);
2801#endif
2802 v = (v + pred1[x]) >> FRAC_BITS;
2803 if(v&(~255)) v= ~(v>>31);
2804 dst1[x] = v;
2805 }
2806 }
2807
2808 /* copy the regions where obmc[] = (uint8_t)256 */
2809 if(LOG2_OBMC_MAX == 8
2810 && (mb_x == 0 || mb_x == b_stride-1)
2811 && (mb_y == 0 || mb_y == b_height-1)){
2812 if(mb_x == 0)
2813 x1 = block_w;
2814 else
2815 x0 = block_w;
2816 if(mb_y == 0)
2817 y1 = block_w;
2818 else
2819 y0 = block_w;
2820 for(y=y0; y<y1; y++)

Callers 1

check_blockFunction · 0.85

Calls 5

get_penalty_factorFunction · 0.85
pred_blockFunction · 0.85
ff_w97_32_cFunction · 0.85
ff_w53_32_cFunction · 0.85
get_block_bitsFunction · 0.85

Tested by

no test coverage detected