From: Loren Merritt <pengvado@videolan.org> Date: Fri, 16 Nov 2007 10:27:14 +0000 (+0000) Subject: cosmetics: use symbolic constants for frame padding radius X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9891656c3c376eb84fec3f85ebdee385d4de1f2;p=libx264 cosmetics: use symbolic constants for frame padding radius git-svn-id: svn://svn.videolan.org/x264/trunk@688 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/common/frame.c b/common/frame.c index 02d4da48..8f4577cc 100644 --- a/common/frame.c +++ b/common/frame.c @@ -23,9 +23,6 @@ #include "common.h" -#define PADH 32 -#define PADV 32 - x264_frame_t *x264_frame_new( x264_t *h ) { x264_frame_t *frame = x264_malloc( sizeof(x264_frame_t) ); diff --git a/common/frame.h b/common/frame.h index 55856744..13678848 100644 --- a/common/frame.h +++ b/common/frame.h @@ -24,6 +24,10 @@ #ifndef _FRAME_H #define _FRAME_H 1 +/* number of pixels past the edge of the frame, for motion estimation/compensation */ +#define PADH 32 +#define PADV 32 + typedef struct { /* */ diff --git a/common/mc.c b/common/mc.c index e1f7fe95..a88e8845 100644 --- a/common/mc.c +++ b/common/mc.c @@ -420,22 +420,22 @@ void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b_end ) { if( start < 0 ) { - memset( frame->integral - 32 * stride - 32, 0, stride * sizeof(uint16_t) ); - start = -32; + memset( frame->integral - PADV * stride - PADH, 0, stride * sizeof(uint16_t) ); + start = -PADV; } if( b_end ) - height += 24; + height += PADV-8; for( y = start; y < height; y++ ) { - uint8_t *ref = frame->plane[0] + y * stride - 32; - uint16_t *line = frame->integral + (y+1) * stride - 31; + uint8_t *ref = frame->plane[0] + y * stride - PADH; + uint16_t *line = frame->integral + (y+1) * stride - PADH + 1; uint16_t v = line[0] = 0; for( x = 0; x < stride-1; x++ ) line[x] = v += ref[x] + line[x-stride] - line[x-stride-1]; line -= 8*stride; - if( y >= 8-31 ) + if( y >= 9-PADV ) { - uint16_t *sum4 = line + frame->i_stride[0] * (frame->i_lines[0] + 64); + uint16_t *sum4 = line + stride * (frame->i_lines[0] + PADV*2); for( x = 1; x < stride-8; x++, line++, sum4++ ) { sum4[0] = line[4+4*stride] - line[4] - line[4*stride] + line[0]; diff --git a/encoder/me.c b/encoder/me.c index f32ad8e2..374cf812 100644 --- a/encoder/me.c +++ b/encoder/me.c @@ -471,7 +471,7 @@ me_hex2: m->p_fenc[0]+delta*FENC_STRIDE, m->p_fenc[0]+delta+delta*FENC_STRIDE, FENC_STRIDE, enc_dc ); if( delta == 4 ) - sums_base += stride * (h->fenc->i_lines[0] + 64); + sums_base += stride * (h->fenc->i_lines[0] + PADV*2); if( i_pixel == PIXEL_16x16 || i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 ) delta *= stride; if( i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 )