Commit 54e784fd authored by Anton Mitrofanov's avatar Anton Mitrofanov Committed by Fiona Glaser

More cosmetics

parent e9970289
......@@ -87,8 +87,8 @@ static void sigill_handler( int sig )
#endif
#ifdef HAVE_MMX
extern int x264_cpu_cpuid_test( void );
extern uint32_t x264_cpu_cpuid( uint32_t op, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx );
int x264_cpu_cpuid_test( void );
uint32_t x264_cpu_cpuid( uint32_t op, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx );
uint32_t x264_cpu_detect( void )
{
......
......@@ -295,7 +295,8 @@ int x264_macroblock_cache_allocate( x264_t *h )
}
return 0;
fail: return -1;
fail:
return -1;
}
void x264_macroblock_cache_free( x264_t *h )
{
......@@ -348,7 +349,8 @@ int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead )
CHECKED_MALLOC( h->scratch_buffer, scratch_size );
return 0;
fail: return -1;
fail:
return -1;
}
void x264_macroblock_thread_free( x264_t *h, int b_lookahead )
......
......@@ -97,9 +97,9 @@ static void name( uint8_t *pix1, int i_stride_pix1, \
uint8_t *pix2, int i_stride_pix2, \
uint8_t *pix3, int i_stride_pix3, int weight ) \
{ \
if( weight == 32 )\
if( weight == 32 ) \
pixel_avg_wxh( pix1, i_stride_pix1, pix2, i_stride_pix2, pix3, i_stride_pix3, width, height ); \
else\
else \
pixel_avg_weight_wxh( pix1, i_stride_pix1, pix2, i_stride_pix2, pix3, i_stride_pix3, width, height, weight ); \
}
PIXEL_AVG_C( pixel_avg_16x16, 16, 16 )
......
......@@ -394,7 +394,7 @@ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[
int16_t (*mvr)[2] = h->mb.mvr[i_list][i_ref];
int i = 0;
#define SET_MVP(mvp)\
#define SET_MVP(mvp) \
{ \
CP32( mvc[i], mvp ); \
i++; \
......@@ -445,13 +445,13 @@ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[
if( h->sh.b_mbaff && field^(i_ref&1) )
refpoc += h->sh.i_delta_poc_bottom;
#define SET_TMVP( dx, dy )\
#define SET_TMVP( dx, dy ) \
{ \
int mb_index = h->mb.i_mb_xy + dx + dy*h->mb.i_mb_stride; \
int scale = (curpoc - refpoc) * l0->inv_ref_poc[h->mb.b_interlaced&field];\
mvc[i][0] = (l0->mv16x16[mb_index][0]*scale + 128) >> 8;\
mvc[i][1] = (l0->mv16x16[mb_index][1]*scale + 128) >> 8;\
i++;\
int scale = (curpoc - refpoc) * l0->inv_ref_poc[h->mb.b_interlaced&field]; \
mvc[i][0] = (l0->mv16x16[mb_index][0]*scale + 128) >> 8; \
mvc[i][1] = (l0->mv16x16[mb_index][1]*scale + 128) >> 8; \
i++; \
}
SET_TMVP(0,0);
......
......@@ -41,7 +41,7 @@
* 16x16 prediction for intra luma block
****************************************************************************/
#define PREDICT_16x16_DC(v) \
#define PREDICT_16x16_DC(v)\
for( int i = 0; i < 16; i++ )\
{\
M32( src+ 0 ) = v;\
......
......@@ -103,7 +103,7 @@ void x264_integral_init8v_sse2( uint16_t *sum8, int stride );
void x264_integral_init4v_ssse3( uint16_t *sum8, uint16_t *sum4, int stride );
void x264_mbtree_propagate_cost_sse2( int *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, int len );
#define LOWRES(cpu) \
#define LOWRES(cpu)\
void x264_frame_init_lowres_core_##cpu( uint8_t *src0, uint8_t *dst0, uint8_t *dsth, uint8_t *dstv, uint8_t *dstc,\
int src_stride, int dst_stride, int width, int height );
LOWRES(mmxext)
......
......@@ -326,7 +326,7 @@ static void x264_predict_8x8_vr_mmxext( uint8_t *src, uint8_t edge[33] )
t=e; e+=f; f-=t;\
t=g; g+=h; h-=t;
#define INTRA_SA8D_X3(cpu) \
#define INTRA_SA8D_X3(cpu)\
void x264_intra_sa8d_x3_8x8_##cpu( uint8_t *fenc, uint8_t edge[33], int res[3] )\
{\
PREDICT_8x8_LOAD_TOP\
......
......@@ -736,13 +736,13 @@ static void block_residual_write_cabac( x264_t *h, x264_cabac_t *cb, int i_ctxBl
}
#endif
#define block_residual_write_cabac_cbf( h, cb, i_ctxBlockCat, i_idx, l, b_intra ) \
{ \
int ctxidxinc = x264_cabac_mb_cbf_ctxidxinc( h, i_ctxBlockCat, i_idx, b_intra ); \
#define block_residual_write_cabac_cbf( h, cb, i_ctxBlockCat, i_idx, l, b_intra )\
{\
int ctxidxinc = x264_cabac_mb_cbf_ctxidxinc( h, i_ctxBlockCat, i_idx, b_intra );\
if( h->mb.cache.non_zero_count[x264_scan8[i_idx]] )\
{\
x264_cabac_encode_decision( cb, ctxidxinc, 1 );\
block_residual_write_cabac( h, cb, i_ctxBlockCat, l ); \
block_residual_write_cabac( h, cb, i_ctxBlockCat, l );\
}\
else\
x264_cabac_encode_decision( cb, ctxidxinc, 0 );\
......
......@@ -914,14 +914,14 @@ static void refine_subpel( x264_t *h, x264_me_t *m, int hpel_iters, int qpel_ite
m->cost_mv = p_cost_mvx[bmx] + p_cost_mvy[bmy];
}
#define BIME_CACHE( dx, dy, list ) \
{ \
#define BIME_CACHE( dx, dy, list )\
{\
x264_me_t *m = m##list;\
int i = 4 + 3*dx + dy; \
int i = 4 + 3*dx + dy;\
int mvx = bm##list##x+dx;\
int mvy = bm##list##y+dy;\
stride[list][i] = bw;\
src[list][i] = h->mc.get_ref( pixy_buf[list][i], &stride[list][i], m->p_fref, m->i_stride[0], mvx, mvy, bw, bh, weight_none ); \
src[list][i] = h->mc.get_ref( pixy_buf[list][i], &stride[list][i], m->p_fref, m->i_stride[0], mvx, mvy, bw, bh, weight_none );\
if( rd )\
{\
h->mc.mc_chroma( pixu_buf[list][i], 8, m->p_fref[4], m->i_stride[1], mvx, mvy + mv##list##y_offset, bw>>1, bh>>1 );\
......@@ -1107,11 +1107,11 @@ void x264_me_refine_bidir_rd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_wei
{ \
uint64_t cost; \
M32( cache_mv ) = pack16to32_mask(mx,my); \
if( m->i_pixel <= PIXEL_8x8 )\
{\
h->mc.mc_chroma( pixu, FDEC_STRIDE, m->p_fref[4], m->i_stride[1], mx, my + mvy_offset, bw>>1, bh>>1 );\
h->mc.mc_chroma( pixv, FDEC_STRIDE, m->p_fref[5], m->i_stride[1], mx, my + mvy_offset, bw>>1, bh>>1 );\
}\
if( m->i_pixel <= PIXEL_8x8 ) \
{ \
h->mc.mc_chroma( pixu, FDEC_STRIDE, m->p_fref[4], m->i_stride[1], mx, my + mvy_offset, bw>>1, bh>>1 ); \
h->mc.mc_chroma( pixv, FDEC_STRIDE, m->p_fref[5], m->i_stride[1], mx, my + mvy_offset, bw>>1, bh>>1 ); \
} \
cost = x264_rd_cost_part( h, i_lambda2, i4, m->i_pixel ); \
COPY4_IF_LT( bcost, cost, bmx, mx, bmy, my, dir, do_dir?mdir:dir ); \
} \
......
......@@ -45,7 +45,7 @@
/* maximum size of the sequence of filters to try on non script files */
#define AVS_MAX_SEQUENCE 5
#define LOAD_AVS_FUNC(name, continue_on_fail) \
#define LOAD_AVS_FUNC(name, continue_on_fail)\
{\
h->func.name = (void*)GetProcAddress( h->library, #name );\
if( !continue_on_fail && !h->func.name )\
......
......@@ -265,7 +265,7 @@ static int check_pixel( int cpu_ref, int cpu_new )
buf3[i] = ~(buf4[i] = -(buf1[i&~0x88]&1));
#define TEST_PIXEL( name, align ) \
ok = 1, used_asm = 0;\
ok = 1, used_asm = 0; \
for( int i = 0; i < 7; i++ ) \
{ \
int res_c, res_asm; \
......@@ -305,7 +305,7 @@ static int check_pixel( int cpu_ref, int cpu_new )
TEST_PIXEL( sa8d, 1 );
#define TEST_PIXEL_X( N ) \
ok = 1; used_asm = 0;\
ok = 1; used_asm = 0; \
for( int i = 0; i < 7; i++ ) \
{ \
int res_c[4]={0}, res_asm[4]={0}; \
......@@ -350,7 +350,7 @@ static int check_pixel( int cpu_ref, int cpu_new )
{ \
set_func_name( "%s_%s", "var", pixel_names[i] ); \
used_asm = 1; \
/* abi-check wrapper can't return uint64_t, so separate it from return value check */\
/* abi-check wrapper can't return uint64_t, so separate it from return value check */ \
call_c1( pixel_c.var[i], buf1, 16 ); \
call_a1( pixel_asm.var[i], buf1, 16 ); \
uint64_t res_c = pixel_c.var[i]( buf1, 16 ); \
......@@ -415,7 +415,7 @@ static int check_pixel( int cpu_ref, int cpu_new )
if( pixel_asm.name && pixel_asm.name != pixel_ref.name ) \
{ \
int res_c[3], res_asm[3]; \
set_func_name( #name );\
set_func_name( #name ); \
used_asm = 1; \
memcpy( buf3, buf2, 1024 ); \
for( int i = 0; i < 3; i++ ) \
......@@ -538,7 +538,7 @@ static int check_dct( int cpu_ref, int cpu_new )
#define TEST_DCT( name, t1, t2, size ) \
if( dct_asm.name != dct_ref.name ) \
{ \
set_func_name( #name );\
set_func_name( #name ); \
used_asm = 1; \
call_c( dct_c.name, t1, buf1, buf2 ); \
call_a( dct_asm.name, t2, buf1, buf2 ); \
......@@ -579,7 +579,7 @@ static int check_dct( int cpu_ref, int cpu_new )
#define TEST_IDCT( name, src ) \
if( dct_asm.name != dct_ref.name ) \
{ \
set_func_name( #name );\
set_func_name( #name ); \
used_asm = 1; \
memcpy( buf3, buf1, 32*32 ); \
memcpy( buf4, buf1, 32*32 ); \
......@@ -647,9 +647,9 @@ static int check_dct( int cpu_ref, int cpu_new )
#define TEST_ZIGZAG_SCAN( name, t1, t2, dct, size ) \
if( zigzag_asm.name != zigzag_ref.name ) \
{ \
set_func_name( "zigzag_"#name"_%s", interlace?"field":"frame" );\
set_func_name( "zigzag_"#name"_%s", interlace?"field":"frame" ); \
used_asm = 1; \
memcpy(dct, buf1, size*sizeof(int16_t));\
memcpy(dct, buf1, size*sizeof(int16_t)); \
call_c( zigzag_c.name, t1, dct ); \
call_a( zigzag_asm.name, t2, dct ); \
if( memcmp( t1, t2, size*sizeof(int16_t) ) ) \
......@@ -663,7 +663,7 @@ static int check_dct( int cpu_ref, int cpu_new )
if( zigzag_asm.name != zigzag_ref.name ) \
{ \
int nz_a, nz_c; \
set_func_name( "zigzag_"#name"_%s", interlace?"field":"frame" );\
set_func_name( "zigzag_"#name"_%s", interlace?"field":"frame" ); \
used_asm = 1; \
memcpy( buf3, buf1, 16*FDEC_STRIDE ); \
memcpy( buf4, buf1, 16*FDEC_STRIDE ); \
......@@ -683,7 +683,7 @@ static int check_dct( int cpu_ref, int cpu_new )
{ \
int nz_a, nz_c; \
int16_t dc_a, dc_c; \
set_func_name( "zigzag_"#name"_%s", interlace?"field":"frame" );\
set_func_name( "zigzag_"#name"_%s", interlace?"field":"frame" ); \
used_asm = 1; \
for( int i = 0; i < 2; i++ ) \
{ \
......@@ -712,9 +712,9 @@ static int check_dct( int cpu_ref, int cpu_new )
{ \
for( int j = 0; j < 100; j++ ) \
{ \
set_func_name( "zigzag_"#name"_%s", interlace?"field":"frame" );\
set_func_name( "zigzag_"#name"_%s", interlace?"field":"frame" ); \
used_asm = 1; \
memcpy(dct, buf1, size*sizeof(int16_t));\
memcpy(dct, buf1, size*sizeof(int16_t)); \
for( int i = 0; i < size; i++ ) \
dct[i] = rand()&0x1F ? 0 : dct[i]; \
memcpy(buf3, buf4, 10*sizeof(uint8_t)); \
......@@ -784,7 +784,7 @@ static int check_mc( int cpu_ref, int cpu_new )
if( mc_a.mc_luma != mc_ref.mc_luma && !(w&(w-1)) && h<=16 ) \
{ \
const x264_weight_t *weight = weight_none; \
set_func_name( "mc_luma_%dx%d", w, h );\
set_func_name( "mc_luma_%dx%d", w, h ); \
used_asm = 1; \
memset( buf3, 0xCD, 1024 ); \
memset( buf4, 0xCD, 1024 ); \
......@@ -801,7 +801,7 @@ static int check_mc( int cpu_ref, int cpu_new )
uint8_t *ref = dst2; \
int ref_stride = 32; \
const x264_weight_t *weight = weight_none; \
set_func_name( "get_ref_%dx%d", w, h );\
set_func_name( "get_ref_%dx%d", w, h ); \
used_asm = 1; \
memset( buf3, 0xCD, 1024 ); \
memset( buf4, 0xCD, 1024 ); \
......@@ -819,13 +819,13 @@ static int check_mc( int cpu_ref, int cpu_new )
#define MC_TEST_CHROMA( w, h ) \
if( mc_a.mc_chroma != mc_ref.mc_chroma ) \
{ \
set_func_name( "mc_chroma_%dx%d", w, h );\
set_func_name( "mc_chroma_%dx%d", w, h ); \
used_asm = 1; \
memset( buf3, 0xCD, 1024 ); \
memset( buf4, 0xCD, 1024 ); \
call_c( mc_c.mc_chroma, dst1, 16, src, 64, dx, dy, w, h ); \
call_a( mc_a.mc_chroma, dst2, 16, src, 64, dx, dy, w, h ); \
/* mc_chroma width=2 may write garbage to the right of dst. ignore that. */\
/* mc_chroma width=2 may write garbage to the right of dst. ignore that. */ \
for( int j = 0; j < h; j++ ) \
for( int i = w; i < 4; i++ ) \
dst2[i+j*16] = dst1[i+j*16]; \
......@@ -878,7 +878,7 @@ static int check_mc( int cpu_ref, int cpu_new )
memcpy( buf4, buf1+320, 320 ); \
if( mc_a.name[i] != mc_ref.name[i] ) \
{ \
set_func_name( "%s_%s", #name, pixel_names[i] );\
set_func_name( "%s_%s", #name, pixel_names[i] ); \
used_asm = 1; \
call_c1( mc_c.name[i], buf3, 16, buf2+1, 16, buf1+18, 16, weight ); \
call_a1( mc_a.name[i], buf4, 16, buf2+1, 16, buf1+18, 16, weight ); \
......@@ -899,7 +899,7 @@ static int check_mc( int cpu_ref, int cpu_new )
#define MC_TEST_WEIGHT( name, weight, aligned ) \
int align_off = (aligned ? 0 : rand()%16); \
ok = 1, used_asm = 0;\
ok = 1, used_asm = 0; \
for( int i = 1; i <= 5; i++ ) \
{ \
ALIGNED_16( uint8_t buffC[640] ); \
......@@ -1115,14 +1115,14 @@ static int check_deblock( int cpu_ref, int cpu_new )
#define TEST_DEBLOCK( name, align, ... ) \
for( int i = 0; i < 36; i++ ) \
{ \
int off = 8*32 + (i&15)*4*!align; /* benchmark various alignments of h filter */\
int off = 8*32 + (i&15)*4*!align; /* benchmark various alignments of h filter */ \
for( int j = 0; j < 1024; j++ ) \
/* two distributions of random to excersize different failure modes */\
/* two distributions of random to excersize different failure modes */ \
buf3[j] = rand() & (i&1 ? 0xf : 0xff ); \
memcpy( buf4, buf3, 1024 ); \
if( db_a.name != db_ref.name ) \
{ \
set_func_name( #name );\
set_func_name( #name ); \
used_asm = 1; \
call_c1( db_c.name, buf3+off, 32, alphas[i], betas[i], ##__VA_ARGS__ ); \
call_a1( db_a.name, buf4+off, 32, alphas[i], betas[i], ##__VA_ARGS__ ); \
......@@ -1491,11 +1491,11 @@ static int check_intra( int cpu_ref, int cpu_new )
ip_c.predict_8x8_filter( buf1+48, edge, ALL_NEIGHBORS, ALL_NEIGHBORS );
#define INTRA_TEST( name, dir, w, ... ) \
#define INTRA_TEST( name, dir, w, ... )\
if( ip_a.name[dir] != ip_ref.name[dir] )\
{ \
{\
set_func_name( "intra_%s_%s", #name, intra_##name##_names[dir] );\
used_asm = 1; \
used_asm = 1;\
memcpy( buf3, buf1, 32*20 );\
memcpy( buf4, buf1, 32*20 );\
call_c( ip_c.name[dir], buf3+48, ##__VA_ARGS__ );\
......
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