cosmetics: use symbolic constants for frame padding radius
authorLoren Merritt <pengvado@videolan.org>
Fri, 16 Nov 2007 10:27:14 +0000 (10:27 +0000)
committerLoren Merritt <pengvado@videolan.org>
Fri, 16 Nov 2007 10:27:14 +0000 (10:27 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@688 df754926-b1dd-0310-bc7b-ec298dee348c

common/frame.c
common/frame.h
common/mc.c
encoder/me.c

index 02d4da4..8f4577c 100644 (file)
@@ -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) );
index 5585674..1367884 100644 (file)
 #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
 {
     /* */
index e1f7fe9..a88e884 100644 (file)
@@ -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];
index f32ad8e..374cf81 100644 (file)
@@ -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 )