From 71dce72beecdadc056ae357718e59e44e1de094c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 5 Sep 2007 00:49:09 +0000 Subject: Replace constants by HTAPS (half pel interpolation filter taps) where appropriate. Originally committed as revision 10390 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/snow.c | 55 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 23 deletions(-) (limited to 'libavcodec/snow.c') diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 0bfbc6d3ac..cbedbaeb94 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -394,6 +394,7 @@ static const BlockNode null_block= { //FIXME add border maybe #define LOG2_MB_SIZE 4 #define MB_SIZE (1<>3; @@ -2213,9 +2222,9 @@ STOP_TIMER("mc_block") #define mca(dx,dy,b_w)\ static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src, int stride, int h){\ - uint8_t tmp[stride*(b_w+5)];\ + uint8_t tmp[stride*(b_w+HTAPS-1)];\ assert(h==b_w);\ - mc_block(dst, src-2-2*stride, tmp, stride, b_w, b_w, dx, dy);\ + mc_block(dst, src-(HTAPS/2-1)-(HTAPS/2-1)*stride, tmp, stride, b_w, b_w, dx, dy);\ } mca( 0, 0,16) @@ -2274,19 +2283,19 @@ static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, i const int dx= mx&15; const int dy= my&15; const int tab_index= 3 - (b_w>>2) + (b_w>>4); - sx += (mx>>4) - 2; - sy += (my>>4) - 2; + sx += (mx>>4) - (HTAPS/2-1); + sy += (my>>4) - (HTAPS/2-1); src += sx + sy*stride; - if( (unsigned)sx >= w - b_w - 4 - || (unsigned)sy >= h - b_h - 4){ - ff_emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+5, b_h+5, sx, sy, w, h); + if( (unsigned)sx >= w - b_w - (HTAPS-2) + || (unsigned)sy >= h - b_h - (HTAPS-2)){ + ff_emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS-1, b_h+HTAPS-1, sx, sy, w, h); src= tmp + MB_SIZE; } // assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h); // assert(!(b_w&(b_w-1))); assert(b_w>1 && b_h>1); assert(tab_index>=0 && tab_index<4 || b_w==32); - if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h) || (b_w&(b_w-1))) + if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h) || (b_w&(b_w-1)) || HTAPS != 6) mc_block(dst, src, tmp, stride, b_w, b_h, dx, dy); else if(b_w==32){ int y; @@ -2733,7 +2742,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, con uint8_t *src= s-> input_picture.data[plane_index]; IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4; uint8_t cur[ref_stride*2*MB_SIZE]; //FIXME alignment - uint8_t tmp[ref_stride*(2*MB_SIZE+5)]; + uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS-1)]; const int b_stride = s->b_width << s->block_max_depth; const int b_height = s->b_height<< s->block_max_depth; const int w= p->width; -- cgit v1.2.3