Commit d9891656 authored by Loren Merritt's avatar Loren Merritt

cosmetics: use symbolic constants for frame padding radius


git-svn-id: svn://svn.videolan.org/x264/trunk@688 df754926-b1dd-0310-bc7b-ec298dee348c
parent 7b8c02d5
...@@ -23,9 +23,6 @@ ...@@ -23,9 +23,6 @@
#include "common.h" #include "common.h"
#define PADH 32
#define PADV 32
x264_frame_t *x264_frame_new( x264_t *h ) x264_frame_t *x264_frame_new( x264_t *h )
{ {
x264_frame_t *frame = x264_malloc( sizeof(x264_frame_t) ); x264_frame_t *frame = x264_malloc( sizeof(x264_frame_t) );
......
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
#ifndef _FRAME_H #ifndef _FRAME_H
#define _FRAME_H 1 #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 typedef struct
{ {
/* */ /* */
......
...@@ -420,22 +420,22 @@ void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b_end ) ...@@ -420,22 +420,22 @@ void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b_end )
{ {
if( start < 0 ) if( start < 0 )
{ {
memset( frame->integral - 32 * stride - 32, 0, stride * sizeof(uint16_t) ); memset( frame->integral - PADV * stride - PADH, 0, stride * sizeof(uint16_t) );
start = -32; start = -PADV;
} }
if( b_end ) if( b_end )
height += 24; height += PADV-8;
for( y = start; y < height; y++ ) for( y = start; y < height; y++ )
{ {
uint8_t *ref = frame->plane[0] + y * stride - 32; uint8_t *ref = frame->plane[0] + y * stride - PADH;
uint16_t *line = frame->integral + (y+1) * stride - 31; uint16_t *line = frame->integral + (y+1) * stride - PADH + 1;
uint16_t v = line[0] = 0; uint16_t v = line[0] = 0;
for( x = 0; x < stride-1; x++ ) for( x = 0; x < stride-1; x++ )
line[x] = v += ref[x] + line[x-stride] - line[x-stride-1]; line[x] = v += ref[x] + line[x-stride] - line[x-stride-1];
line -= 8*stride; 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++ ) for( x = 1; x < stride-8; x++, line++, sum4++ )
{ {
sum4[0] = line[4+4*stride] - line[4] - line[4*stride] + line[0]; sum4[0] = line[4+4*stride] - line[4] - line[4*stride] + line[0];
......
...@@ -471,7 +471,7 @@ me_hex2: ...@@ -471,7 +471,7 @@ me_hex2:
m->p_fenc[0]+delta*FENC_STRIDE, m->p_fenc[0]+delta+delta*FENC_STRIDE, m->p_fenc[0]+delta*FENC_STRIDE, m->p_fenc[0]+delta+delta*FENC_STRIDE,
FENC_STRIDE, enc_dc ); FENC_STRIDE, enc_dc );
if( delta == 4 ) 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 ) if( i_pixel == PIXEL_16x16 || i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 )
delta *= stride; delta *= stride;
if( i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 ) if( i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment