Commit 33f9e147 authored by Anton Mitrofanov's avatar Anton Mitrofanov

Fix warning: comparison of integers of different signs [-Wsign-compare]

parent 296494a4
......@@ -272,7 +272,7 @@ PLANE_INTERLEAVE(neon)
PROPAGATE_LIST(neon)
#endif // !HIGH_BIT_DEPTH
void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf )
void x264_mc_init_aarch64( uint32_t cpu, x264_mc_functions_t *pf )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
......
......@@ -27,6 +27,6 @@
#define X264_AARCH64_MC_H
#define x264_mc_init_aarch64 x264_template(mc_init_aarch64)
void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf );
void x264_mc_init_aarch64( uint32_t cpu, x264_mc_functions_t *pf );
#endif
......@@ -28,7 +28,7 @@
#include "predict.h"
#include "pixel.h"
void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] )
void x264_predict_4x4_init_aarch64( uint32_t cpu, x264_predict_t pf[12] )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
......@@ -47,7 +47,7 @@ void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] )
void x264_predict_8x8c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
#if !HIGH_BIT_DEPTH
if( cpu&X264_CPU_ARMV8 )
......@@ -67,7 +67,7 @@ void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] )
}
void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] )
void x264_predict_8x16c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -82,7 +82,7 @@ void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
void x264_predict_8x8_init_aarch64( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -100,7 +100,7 @@ void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_pred
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] )
void x264_predict_16x16_init_aarch64( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......
......@@ -106,14 +106,14 @@ void x264_predict_16x16_h_neon( uint8_t *src );
void x264_predict_16x16_dc_neon( uint8_t *src );
#define x264_predict_4x4_init_aarch64 x264_template(predict_4x4_init_aarch64)
void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] );
void x264_predict_4x4_init_aarch64( uint32_t cpu, x264_predict_t pf[12] );
#define x264_predict_8x8_init_aarch64 x264_template(predict_8x8_init_aarch64)
void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
void x264_predict_8x8_init_aarch64( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
#define x264_predict_8x8c_init_aarch64 x264_template(predict_8x8c_init_aarch64)
void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] );
void x264_predict_8x8c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x16c_init_aarch64 x264_template(predict_8x16c_init_aarch64)
void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] );
void x264_predict_8x16c_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_16x16_init_aarch64 x264_template(predict_16x16_init_aarch64)
void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] );
void x264_predict_16x16_init_aarch64( uint32_t cpu, x264_predict_t pf[7] );
#endif /* X264_AARCH64_PREDICT_H */
......@@ -296,7 +296,7 @@ PLANE_INTERLEAVE(neon)
PROPAGATE_LIST(neon)
#endif // !HIGH_BIT_DEPTH
void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf )
void x264_mc_init_arm( uint32_t cpu, x264_mc_functions_t *pf )
{
if( !(cpu&X264_CPU_ARMV6) )
return;
......
......@@ -27,6 +27,6 @@
#define X264_ARM_MC_H
#define x264_mc_init_arm x264_template(mc_init_arm)
void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf );
void x264_mc_init_arm( uint32_t cpu, x264_mc_functions_t *pf );
#endif
......@@ -27,7 +27,7 @@
#include "predict.h"
#include "pixel.h"
void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] )
void x264_predict_4x4_init_arm( uint32_t cpu, x264_predict_t pf[12] )
{
if( !(cpu&X264_CPU_ARMV6) )
return;
......@@ -46,7 +46,7 @@ void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] )
void x264_predict_8x8c_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -61,7 +61,7 @@ void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] )
void x264_predict_8x16c_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -74,7 +74,7 @@ void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] )
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
void x264_predict_8x8_init_arm( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter )
{
if( !(cpu&X264_CPU_NEON) )
return;
......@@ -92,7 +92,7 @@ void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_
#endif // !HIGH_BIT_DEPTH
}
void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] )
void x264_predict_16x16_init_arm( uint32_t cpu, x264_predict_t pf[7] )
{
if( !(cpu&X264_CPU_NEON) )
return;
......
......@@ -92,14 +92,14 @@ void x264_predict_16x16_v_neon( uint8_t *src );
void x264_predict_16x16_p_neon( uint8_t *src );
#define x264_predict_4x4_init_arm x264_template(predict_4x4_init_arm)
void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] );
void x264_predict_4x4_init_arm( uint32_t cpu, x264_predict_t pf[12] );
#define x264_predict_8x8_init_arm x264_template(predict_8x8_init_arm)
void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
void x264_predict_8x8_init_arm( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
#define x264_predict_8x8c_init_arm x264_template(predict_8x8c_init_arm)
void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] );
void x264_predict_8x8c_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x16c_init_arm x264_template(predict_8x16c_init_arm)
void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] );
void x264_predict_8x16c_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_16x16_init_arm x264_template(predict_16x16_init_arm)
void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] );
void x264_predict_16x16_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#endif
......@@ -103,7 +103,7 @@ void *x264_malloc( int64_t i_size )
{
#define HUGE_PAGE_SIZE 2*1024*1024
#define HUGE_PAGE_THRESHOLD HUGE_PAGE_SIZE*7/8 /* FIXME: Is this optimal? */
if( i_size < 0 || i_size > (SIZE_MAX - HUGE_PAGE_SIZE) /*|| i_size > (SIZE_MAX - NATIVE_ALIGN - sizeof(void **))*/ )
if( i_size < 0 || (uint64_t)i_size > (SIZE_MAX - HUGE_PAGE_SIZE) /*|| (uint64_t)i_size > (SIZE_MAX - NATIVE_ALIGN - sizeof(void **))*/ )
{
x264_log_internal( X264_LOG_ERROR, "invalid size of malloc: %"PRId64"\n", i_size );
return NULL;
......@@ -180,7 +180,7 @@ char *x264_slurp_file( const char *filename )
if( !buf )
goto error;
b_error |= fread( buf, 1, i_size, fh ) != i_size;
b_error |= fread( buf, 1, i_size, fh ) != (uint64_t)i_size;
fclose( fh );
if( b_error )
{
......@@ -428,7 +428,7 @@ static int param_apply_preset( x264_param_t *param, const char *preset )
{
char *end;
int i = strtol( preset, &end, 10 );
if( *end == 0 && i >= 0 && i < sizeof(x264_preset_names)/sizeof(*x264_preset_names)-1 )
if( *end == 0 && i >= 0 && i < ARRAY_ELEMS(x264_preset_names)-1 )
preset = x264_preset_names[i];
if( !strcasecmp( preset, "ultrafast" ) )
......@@ -1259,7 +1259,7 @@ REALIGN_STACK int x264_param_parse( x264_param_t *p, const char *name, const cha
OPT("zones")
p->rc.psz_zones = strdup(value);
OPT("crop-rect")
b_error |= sscanf( value, "%u,%u,%u,%u", &p->crop_rect.i_left, &p->crop_rect.i_top,
b_error |= sscanf( value, "%d,%d,%d,%d", &p->crop_rect.i_left, &p->crop_rect.i_top,
&p->crop_rect.i_right, &p->crop_rect.i_bottom ) != 4;
OPT("psnr")
p->analyse.b_psnr = atobool(value);
......@@ -1425,7 +1425,7 @@ char *x264_param2string( x264_param_t *p, int b_res )
if( p->rc.i_vbv_buffer_size )
s += sprintf( s, " nal_hrd=%s filler=%d", x264_nal_hrd_names[p->i_nal_hrd], p->rc.b_filler );
if( p->crop_rect.i_left | p->crop_rect.i_top | p->crop_rect.i_right | p->crop_rect.i_bottom )
s += sprintf( s, " crop_rect=%u,%u,%u,%u", p->crop_rect.i_left, p->crop_rect.i_top,
s += sprintf( s, " crop_rect=%d,%d,%d,%d", p->crop_rect.i_left, p->crop_rect.i_top,
p->crop_rect.i_right, p->crop_rect.i_bottom );
if( p->i_frame_packing >= 0 )
s += sprintf( s, " frame-packing=%d", p->i_frame_packing );
......
......@@ -53,7 +53,7 @@
****************************************************************************/
#define XCHG(type,a,b) do { type t = a; a = b; b = t; } while( 0 )
#define FIX8(f) ((int)(f*(1<<8)+.5))
#define ARRAY_ELEMS(a) ((sizeof(a))/(sizeof(a[0])))
#define ARRAY_ELEMS(a) ((int)((sizeof(a))/(sizeof(a[0]))))
#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
#define IS_DISPOSABLE(type) ( type == X264_TYPE_B )
......@@ -303,7 +303,7 @@ do {\
do {\
var = (void*)(intptr_t)prealloc_size;\
preallocs[prealloc_idx++] = (uint8_t**)&var;\
prealloc_size += ALIGN(size, NATIVE_ALIGN);\
prealloc_size += ALIGN((int64_t)(size), NATIVE_ALIGN);\
} while( 0 )
#define PREALLOC_END( ptr )\
......
......@@ -103,7 +103,7 @@ void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal )
x264_emms();
}
void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf )
void x264_bitstream_init( uint32_t cpu, x264_bitstream_function_t *pf )
{
memset( pf, 0, sizeof(*pf) );
......
......@@ -66,7 +66,7 @@ typedef struct
} x264_bitstream_function_t;
#define x264_bitstream_init x264_template(bitstream_init)
void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf );
void x264_bitstream_init( uint32_t cpu, x264_bitstream_function_t *pf );
/* A larger level table size theoretically could help a bit at extremely
* high bitrates, but the cost in cache is usually too high for it to be
......
......@@ -108,6 +108,8 @@
# define MPIXEL_X4(src) M32(src)
#endif
#define SIZEOF_PIXEL ((int)sizeof(pixel))
#define CPPIXEL_X4(dst,src) MPIXEL_X4(dst) = MPIXEL_X4(src)
/****************************************************************************
......@@ -528,7 +530,7 @@ struct x264_t
int16_t (*mvr[2][X264_REF_MAX*2])[2];/* 16x16 mv for each possible ref */
int8_t *skipbp; /* block pattern for SKIP or DIRECT (sub)mbs. B-frames + cabac only */
int8_t *mb_transform_size; /* transform_size_8x8_flag of each mb */
uint32_t *slice_table; /* sh->first_mb of the slice that the indexed mb is part of */
int32_t *slice_table; /* sh->first_mb of the slice that the indexed mb is part of */
uint8_t *field;
/* buffer for weighted versions of the reference frames */
......
......@@ -362,7 +362,7 @@ int x264_cpu_fast_neon_mrc_test( void );
uint32_t x264_cpu_detect( void )
{
int flags = 0;
uint32_t flags = 0;
flags |= X264_CPU_ARMV6;
// don't do this hack if compiled with -mfpu=neon
......@@ -449,7 +449,7 @@ int x264_cpu_num_processors( void )
return CPU_COUNT(&p_aff);
#else
int np = 0;
for( unsigned int bit = 0; bit < 8 * sizeof(p_aff); bit++ )
for( size_t bit = 0; bit < 8 * sizeof(p_aff); bit++ )
np += (((uint8_t *)&p_aff)[bit / 8] >> (bit % 8)) & 1;
return np;
#endif
......
......@@ -472,7 +472,7 @@ static void add16x16_idct_dc( pixel *p_dst, dctcoef dct[16] )
/****************************************************************************
* x264_dct_init:
****************************************************************************/
void x264_dct_init( int cpu, x264_dct_function_t *dctf )
void x264_dct_init( uint32_t cpu, x264_dct_function_t *dctf )
{
dctf->sub4x4_dct = sub4x4_dct;
dctf->add4x4_idct = add4x4_idct;
......@@ -901,7 +901,7 @@ static void zigzag_interleave_8x8_cavlc( dctcoef *dst, dctcoef *src, uint8_t *nn
}
}
void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced )
void x264_zigzag_init( uint32_t cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced )
{
pf_interlaced->scan_8x8 = zigzag_scan_8x8_field;
pf_progressive->scan_8x8 = zigzag_scan_8x8_frame;
......
......@@ -70,8 +70,8 @@ typedef struct
} x264_zigzag_function_t;
#define x264_dct_init x264_template(dct_init)
void x264_dct_init( int cpu, x264_dct_function_t *dctf );
void x264_dct_init( uint32_t cpu, x264_dct_function_t *dctf );
#define x264_zigzag_init x264_template(zigzag_init)
void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced );
void x264_zigzag_init( uint32_t cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced );
#endif
......@@ -681,7 +681,7 @@ void x264_macroblock_deblock( x264_t *h )
#include "mips/deblock.h"
#endif
void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff )
void x264_deblock_init( uint32_t cpu, x264_deblock_function_t *pf, int b_mbaff )
{
pf->deblock_luma[1] = deblock_v_luma_c;
pf->deblock_luma[0] = deblock_h_luma_c;
......
......@@ -77,7 +77,7 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
#endif
/* ensure frame alignment after PADH is added */
int padh_align = X264_MAX( align - PADH * (int)sizeof(pixel), 0 ) / sizeof(pixel);
int padh_align = X264_MAX( align - PADH * SIZEOF_PIXEL, 0 ) / SIZEOF_PIXEL;
CHECKED_MALLOCZERO( frame, sizeof(x264_frame_t) );
PREALLOC_INIT
......@@ -152,9 +152,9 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
{
int chroma_padv = i_padv >> (i_csp == X264_CSP_NV12);
int chroma_plane_size = (frame->i_stride[1] * (frame->i_lines[1] + 2*chroma_padv));
PREALLOC( frame->buffer[1], (chroma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer[1], (chroma_plane_size + padh_align) * SIZEOF_PIXEL );
if( PARAM_INTERLACED )
PREALLOC( frame->buffer_fld[1], (chroma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer_fld[1], (chroma_plane_size + padh_align) * SIZEOF_PIXEL );
}
/* all 4 luma planes allocated together, since the cacheline split code
......@@ -167,9 +167,9 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
luma_plane_size *= 4;
/* FIXME: Don't allocate both buffers in non-adaptive MBAFF. */
PREALLOC( frame->buffer[p], (luma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer[p], (luma_plane_size + padh_align) * SIZEOF_PIXEL );
if( PARAM_INTERLACED )
PREALLOC( frame->buffer_fld[p], (luma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer_fld[p], (luma_plane_size + padh_align) * SIZEOF_PIXEL );
}
frame->b_duplicate = 0;
......@@ -207,7 +207,7 @@ static x264_frame_t *frame_new( x264_t *h, int b_fdec )
{
int64_t luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign );
PREALLOC( frame->buffer_lowres, (4 * luma_plane_size + padh_align) * sizeof(pixel) );
PREALLOC( frame->buffer_lowres, (4 * luma_plane_size + padh_align) * SIZEOF_PIXEL );
for( int j = 0; j <= !!h->param.i_bframe; j++ )
for( int i = 0; i <= h->param.i_bframe; i++ )
......@@ -419,7 +419,7 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
h->mc.plane_copy_deinterleave_v210( dst->plane[0], dst->i_stride[0],
dst->plane[1], dst->i_stride[1],
(uint32_t *)pix[0], stride[0]/sizeof(uint32_t), h->param.i_width, h->param.i_height );
(uint32_t *)pix[0], stride[0]/(int)sizeof(uint32_t), h->param.i_width, h->param.i_height );
}
else if( i_csp >= X264_CSP_BGR )
{
......@@ -434,25 +434,25 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
h->mc.plane_copy_deinterleave_rgb( dst->plane[1+b], dst->i_stride[1+b],
dst->plane[0], dst->i_stride[0],
dst->plane[2-b], dst->i_stride[2-b],
(pixel*)pix[0], stride[0]/sizeof(pixel), i_csp==X264_CSP_BGRA ? 4 : 3, h->param.i_width, h->param.i_height );
(pixel*)pix[0], stride[0]/SIZEOF_PIXEL, i_csp==X264_CSP_BGRA ? 4 : 3, h->param.i_width, h->param.i_height );
}
else
{
int v_shift = CHROMA_V_SHIFT;
get_plane_ptr( h, src, &pix[0], &stride[0], 0, 0, 0 );
h->mc.plane_copy( dst->plane[0], dst->i_stride[0], (pixel*)pix[0],
stride[0]/sizeof(pixel), h->param.i_width, h->param.i_height );
stride[0]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
if( i_csp == X264_CSP_NV12 || i_csp == X264_CSP_NV16 )
{
get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift );
h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height>>v_shift );
stride[1]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height>>v_shift );
}
else if( i_csp == X264_CSP_NV21 )
{
get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift );
h->mc.plane_copy_swap( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
stride[1]/sizeof(pixel), h->param.i_width>>1, h->param.i_height>>v_shift );
stride[1]/SIZEOF_PIXEL, h->param.i_width>>1, h->param.i_height>>v_shift );
}
else if( i_csp == X264_CSP_I420 || i_csp == X264_CSP_I422 || i_csp == X264_CSP_YV12 || i_csp == X264_CSP_YV16 )
{
......@@ -460,8 +460,8 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
get_plane_ptr( h, src, &pix[1], &stride[1], uv_swap ? 2 : 1, 1, v_shift );
get_plane_ptr( h, src, &pix[2], &stride[2], uv_swap ? 1 : 2, 1, v_shift );
h->mc.plane_copy_interleave( dst->plane[1], dst->i_stride[1],
(pixel*)pix[1], stride[1]/sizeof(pixel),
(pixel*)pix[2], stride[2]/sizeof(pixel),
(pixel*)pix[1], stride[1]/SIZEOF_PIXEL,
(pixel*)pix[2], stride[2]/SIZEOF_PIXEL,
h->param.i_width>>1, h->param.i_height>>v_shift );
}
else if( i_csp == X264_CSP_I444 || i_csp == X264_CSP_YV24 )
......@@ -469,9 +469,9 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )
get_plane_ptr( h, src, &pix[1], &stride[1], i_csp==X264_CSP_I444 ? 1 : 2, 0, 0 );
get_plane_ptr( h, src, &pix[2], &stride[2], i_csp==X264_CSP_I444 ? 2 : 1, 0, 0 );
h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],
stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height );
stride[1]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
h->mc.plane_copy( dst->plane[2], dst->i_stride[2], (pixel*)pix[2],
stride[2]/sizeof(pixel), h->param.i_width, h->param.i_height );
stride[2]/SIZEOF_PIXEL, h->param.i_width, h->param.i_height );
}
}
return 0;
......@@ -535,18 +535,18 @@ static ALWAYS_INLINE void plane_expand_border( pixel *pix, int i_stride, int i_w
for( int y = 0; y < i_height; y++ )
{
/* left band */
pixel_memset( PPIXEL(-i_padh, y), PPIXEL(0, y), i_padh>>b_chroma, sizeof(pixel)<<b_chroma );
pixel_memset( PPIXEL(-i_padh, y), PPIXEL(0, y), i_padh>>b_chroma, SIZEOF_PIXEL<<b_chroma );
/* right band */
pixel_memset( PPIXEL(i_width, y), PPIXEL(i_width-1-b_chroma, y), i_padh>>b_chroma, sizeof(pixel)<<b_chroma );
pixel_memset( PPIXEL(i_width, y), PPIXEL(i_width-1-b_chroma, y), i_padh>>b_chroma, SIZEOF_PIXEL<<b_chroma );
}
/* upper band */
if( b_pad_top )
for( int y = 0; y < i_padv; y++ )
memcpy( PPIXEL(-i_padh, -y-1), PPIXEL(-i_padh, 0), (i_width+2*i_padh) * sizeof(pixel) );
memcpy( PPIXEL(-i_padh, -y-1), PPIXEL(-i_padh, 0), (i_width+2*i_padh) * SIZEOF_PIXEL );
/* lower band */
if( b_pad_bottom )
for( int y = 0; y < i_padv; y++ )
memcpy( PPIXEL(-i_padh, i_height+y), PPIXEL(-i_padh, i_height-1), (i_width+2*i_padh) * sizeof(pixel) );
memcpy( PPIXEL(-i_padh, i_height+y), PPIXEL(-i_padh, i_height-1), (i_width+2*i_padh) * SIZEOF_PIXEL );
#undef PPIXEL
}
......@@ -650,14 +650,14 @@ void x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame )
for( int y = 0; y < i_height; y++ )
pixel_memset( &frame->plane[i][y*frame->i_stride[i] + i_width],
&frame->plane[i][y*frame->i_stride[i] + i_width - 1-h_shift],
i_padx>>h_shift, sizeof(pixel)<<h_shift );
i_padx>>h_shift, SIZEOF_PIXEL<<h_shift );
}
if( i_pady )
{
for( int y = i_height; y < i_height + i_pady; y++ )
memcpy( &frame->plane[i][y*frame->i_stride[i]],
&frame->plane[i][(i_height-(~y&PARAM_INTERLACED)-1)*frame->i_stride[i]],
(i_width + i_padx) * sizeof(pixel) );
(i_width + i_padx) * SIZEOF_PIXEL );
}
}
}
......@@ -672,7 +672,7 @@ void x264_expand_border_mbpair( x264_t *h, int mb_x, int mb_y )
int pady = (h->mb.i_mb_height * 16 - h->param.i_height) >> v_shift;
pixel *fenc = h->fenc->plane[i] + 16*mb_x;
for( int y = height; y < height + pady; y++ )
memcpy( fenc + y*stride, fenc + (height-1)*stride, 16*sizeof(pixel) );
memcpy( fenc + y*stride, fenc + (height-1)*stride, 16*SIZEOF_PIXEL );
}
}
......
......@@ -246,7 +246,7 @@ void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b
void x264_frame_init_lowres( x264_t *h, x264_frame_t *frame );
#define x264_deblock_init x264_template(deblock_init)
void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff );
void x264_deblock_init( uint32_t cpu, x264_deblock_function_t *pf, int b_mbaff );
#define x264_frame_cond_broadcast x264_template(frame_cond_broadcast)
void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed );
......
......@@ -260,7 +260,7 @@ int x264_macroblock_cache_allocate( x264_t *h )
PREALLOC( h->mb.qp, i_mb_count * sizeof(int8_t) );
PREALLOC( h->mb.cbp, i_mb_count * sizeof(int16_t) );
PREALLOC( h->mb.mb_transform_size, i_mb_count * sizeof(int8_t) );
PREALLOC( h->mb.slice_table, i_mb_count * sizeof(uint32_t) );
PREALLOC( h->mb.slice_table, i_mb_count * sizeof(int32_t) );
/* 0 -> 3 top(4), 4 -> 6 : left(3) */
PREALLOC( h->mb.intra4x4_pred_mode, i_mb_count * 8 * sizeof(int8_t) );
......@@ -321,12 +321,12 @@ int x264_macroblock_cache_allocate( x264_t *h )
}
for( int i = 0; i < numweightbuf; i++ )
PREALLOC( h->mb.p_weight_buf[i], luma_plane_size * sizeof(pixel) );
PREALLOC( h->mb.p_weight_buf[i], luma_plane_size * SIZEOF_PIXEL );
}
PREALLOC_END( h->mb.base );
memset( h->mb.slice_table, -1, i_mb_count * sizeof(uint32_t) );
memset( h->mb.slice_table, -1, i_mb_count * sizeof(int32_t) );
for( int i = 0; i < 2; i++ )
{
......@@ -357,7 +357,7 @@ int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead )
for( int i = 0; i < (PARAM_INTERLACED ? 5 : 2); i++ )
for( int j = 0; j < (CHROMA444 ? 3 : 2); j++ )
{
CHECKED_MALLOC( h->intra_border_backup[i][j], (h->sps->i_mb_width*16+32) * sizeof(pixel) );
CHECKED_MALLOC( h->intra_border_backup[i][j], (h->sps->i_mb_width*16+32) * SIZEOF_PIXEL );
h->intra_border_backup[i][j] += 16;
}
for( int i = 0; i <= PARAM_INTERLACED; i++ )
......@@ -586,15 +586,15 @@ static ALWAYS_INLINE void macroblock_load_pic_pointers( x264_t *h, int mb_x, int
if( b_chroma )
{
h->mc.load_deinterleave_chroma_fenc( h->mb.pic.p_fenc[1], h->mb.pic.p_fenc_plane[1], i_stride2, height );
memcpy( h->mb.pic.p_fdec[1]-FDEC_STRIDE, intra_fdec, 8*sizeof(pixel) );
memcpy( h->mb.pic.p_fdec[2]-FDEC_STRIDE, intra_fdec+8, 8*sizeof(pixel) );
memcpy( h->mb.pic.p_fdec[1]-FDEC_STRIDE, intra_fdec, 8*SIZEOF_PIXEL );
memcpy( h->mb.pic.p_fdec[2]-FDEC_STRIDE, intra_fdec+8, 8*SIZEOF_PIXEL );
h->mb.pic.p_fdec[1][-FDEC_STRIDE-1] = intra_fdec[-1-8];
h->mb.pic.p_fdec[2][-FDEC_STRIDE-1] = intra_fdec[-1];
}
else
{
h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fenc[i], FENC_STRIDE, h->mb.pic.p_fenc_plane[i], i_stride2, 16 );
memcpy( h->mb.pic.p_fdec[i]-FDEC_STRIDE, intra_fdec, 24*sizeof(pixel) );
memcpy( h->mb.pic.p_fdec[i]-FDEC_STRIDE, intra_fdec, 24*SIZEOF_PIXEL );
h->mb.pic.p_fdec[i][-FDEC_STRIDE-1] = intra_fdec[-1];
}
if( b_mbaff || h->mb.b_reencode_mb )
......@@ -1642,17 +1642,17 @@ static ALWAYS_INLINE void macroblock_backup_intra( x264_t *h, int mb_x, int mb_y
* bottom row of each field. We also store samples needed for the next
* mbpair in intra_border_backup[2]. */
int backup_dst = !b_mbaff ? (mb_y&1) : (mb_y&1) ? 1 : MB_INTERLACED ? 0 : 2;
memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+FDEC_STRIDE*15, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
if( CHROMA444 )
{
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+FDEC_STRIDE*15, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+FDEC_STRIDE*15, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+FDEC_STRIDE*15, 16*SIZEOF_PIXEL );
}
else if( CHROMA_FORMAT )
{
int backup_src = (15>>CHROMA_V_SHIFT) * FDEC_STRIDE;
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*SIZEOF_PIXEL );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*SIZEOF_PIXEL );
}
if( b_mbaff )
{
......@@ -1660,18 +1660,18 @@ static ALWAYS_INLINE void macroblock_backup_intra( x264_t *h, int mb_x, int mb_y
{
int backup_src = (MB_INTERLACED ? 7 : 14) * FDEC_STRIDE;
backup_dst = MB_INTERLACED ? 2 : 0;
memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+backup_src, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+backup_src, 16*SIZEOF_PIXEL );
if( CHROMA444 )
{
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+backup_src, 16*sizeof(pixel) );
memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 16*SIZEOF_PIXEL );
memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+backup_src, 16*SIZEOF_PIXEL );
}
else if( CHROMA_FORMAT )