From: Loren Merritt Date: Thu, 21 Aug 2008 02:32:13 +0000 (-0600) Subject: cosmetics X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08d39756a08e00ae39196b125e2cecdb08136e17;p=libx264 cosmetics --- diff --git a/common/cabac.h b/common/cabac.h index f5efa248..53176558 100644 --- a/common/cabac.h +++ b/common/cabac.h @@ -40,7 +40,7 @@ typedef struct /* aligned for memcpy_aligned starting here */ DECLARE_ALIGNED_16( int f8_bits_encoded ); // only if using x264_cabac_size_decision() - + /* context */ uint8_t state[460]; } x264_cabac_t; diff --git a/common/common.c b/common/common.c index 22b1d5ce..a6054bbc 100644 --- a/common/common.c +++ b/common/common.c @@ -169,12 +169,12 @@ static int parse_cqm( const char *str, uint8_t *cqm, int length ) static int x264_atobool( const char *str, int *b_error ) { - if( !strcmp(str, "1") || - !strcmp(str, "true") || + if( !strcmp(str, "1") || + !strcmp(str, "true") || !strcmp(str, "yes") ) return 1; - if( !strcmp(str, "0") || - !strcmp(str, "false") || + if( !strcmp(str, "0") || + !strcmp(str, "false") || !strcmp(str, "no") ) return 0; *b_error = 1; diff --git a/common/common.h b/common/common.h index 61582954..ca555d1e 100644 --- a/common/common.h +++ b/common/common.h @@ -374,7 +374,7 @@ struct x264_t int i_mb_xy; int i_b8_xy; int i_b4_xy; - + /* Search parameters */ int i_me_method; int i_subpel_refine; @@ -399,15 +399,15 @@ struct x264_t unsigned int i_neighbour; unsigned int i_neighbour8[4]; /* neighbours of each 8x8 or 4x4 block that are available */ unsigned int i_neighbour4[16]; /* at the time the block is coded */ - int i_mb_type_top; - int i_mb_type_left; - int i_mb_type_topleft; - int i_mb_type_topright; + int i_mb_type_top; + int i_mb_type_left; + int i_mb_type_topleft; + int i_mb_type_topright; int i_mb_prev_xy; int i_mb_top_xy; /**** thread synchronization ends here ****/ - /* subsequence variables are either thread-local or constant, + /* subsequent variables are either thread-local or constant, * and won't be copied from one thread to another */ /* mb table */ @@ -456,7 +456,7 @@ struct x264_t DECLARE_ALIGNED_16( uint8_t fenc_buf[24*FENC_STRIDE] ); DECLARE_ALIGNED_16( uint8_t fdec_buf[27*FDEC_STRIDE] ); - /* i4x4 and i8x8 backup data, for skipping the encode stage when possible */ + /* i4x4 and i8x8 backup data, for skipping the encode stage when possible */ DECLARE_ALIGNED_16( uint8_t i4x4_fdec_buf[16*16] ); DECLARE_ALIGNED_16( uint8_t i8x8_fdec_buf[16*16] ); DECLARE_ALIGNED_16( int16_t i8x8_dct_buf[3][64] ); @@ -567,7 +567,7 @@ struct x264_t double f_slice_qp[5]; int i_consecutive_bframes[X264_BFRAME_MAX+1]; /* */ - int64_t i_sqe_global[5]; + int64_t i_ssd_global[5]; double f_psnr_average[5]; double f_psnr_mean_y[5]; double f_psnr_mean_u[5]; diff --git a/common/frame.c b/common/frame.c index c5e13d85..3a407802 100644 --- a/common/frame.c +++ b/common/frame.c @@ -233,7 +233,7 @@ void x264_frame_expand_border( x264_t *h, x264_frame_t *frame, int mb_y, int b_e void x264_frame_expand_border_filtered( x264_t *h, x264_frame_t *frame, int mb_y, int b_end ) { /* during filtering, 8 extra pixels were filtered on each edge, - * but up to 3 of the horizontal ones may be wrong. + * but up to 3 of the horizontal ones may be wrong. we want to expand border from the last filtered pixel */ int b_start = !mb_y; int stride = frame->i_stride[0]; @@ -425,7 +425,7 @@ static inline void deblock_luma_c( uint8_t *pix, int xstride, int ystride, int a } static void deblock_v_luma_c( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) { - deblock_luma_c( pix, stride, 1, alpha, beta, tc0 ); + deblock_luma_c( pix, stride, 1, alpha, beta, tc0 ); } static void deblock_h_luma_c( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) { @@ -524,7 +524,7 @@ static void deblock_h_luma_intra_c( uint8_t *pix, int stride, int alpha, int bet static inline void deblock_chroma_intra_c( uint8_t *pix, int xstride, int ystride, int alpha, int beta ) { - int d; + int d; for( d = 0; d < 8; d++ ) { const int p1 = pix[-2*xstride]; diff --git a/common/frame.h b/common/frame.h index 6a0c9282..523689fc 100644 --- a/common/frame.h +++ b/common/frame.h @@ -81,7 +81,7 @@ typedef struct /* threading */ int i_lines_completed; /* in pixels */ int i_reference_count; /* number of threads using this frame (not necessarily the number of pointers) */ - x264_pthread_mutex_t mutex; + x264_pthread_mutex_t mutex; x264_pthread_cond_t cv; } x264_frame_t; diff --git a/common/macroblock.c b/common/macroblock.c index 4dc3b738..9d839f27 100644 --- a/common/macroblock.c +++ b/common/macroblock.c @@ -223,9 +223,9 @@ static int x264_mb_predict_mv_direct16x16_temporal( x264_t *h ) int i8, i4; int b8x8; const int type_col = h->fref1[0]->mb_type[ h->mb.i_mb_xy ]; - + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, 0 ); - + if( IS_INTRA( type_col ) ) { x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, 0 ); @@ -338,7 +338,7 @@ static int x264_mb_predict_mv_direct16x16_spatial( x264_t *h ) if( ref[0] < 0 && ref[1] < 0 ) { - ref[0] = + ref[0] = ref[1] = 0; *(uint64_t*)mv[0] = 0; } diff --git a/common/mc.c b/common/mc.c index 671f3968..3b720aff 100644 --- a/common/mc.c +++ b/common/mc.c @@ -346,7 +346,7 @@ void x264_mc_init( int cpu, x264_mc_functions_t *pf ) pf->avg[PIXEL_4x2] = pixel_avg_4x2; pf->avg[PIXEL_2x4] = pixel_avg_2x4; pf->avg[PIXEL_2x2] = pixel_avg_2x2; - + pf->avg_weight[PIXEL_16x16]= pixel_avg_weight_16x16; pf->avg_weight[PIXEL_16x8] = pixel_avg_weight_16x8; pf->avg_weight[PIXEL_8x16] = pixel_avg_weight_8x16; diff --git a/common/mc.h b/common/mc.h index f682b855..af87f99c 100644 --- a/common/mc.h +++ b/common/mc.h @@ -62,7 +62,7 @@ typedef struct uint8_t *pix_uv, int stride_uv, int mb_x ); /* prefetch the next few macroblocks of a hpel reference frame */ void (*prefetch_ref)( uint8_t *pix, int stride, int parity ); - + void *(*memcpy_aligned)( void *dst, const void *src, size_t n ); void (*memzero_aligned)( void *dst, int n ); diff --git a/common/predict.c b/common/predict.c index 2c4e83b5..e6880994 100644 --- a/common/predict.c +++ b/common/predict.c @@ -646,7 +646,7 @@ static void predict_8x8_ddr( uint8_t *src, uint8_t edge[33] ) SRC(5,0)=SRC(6,1)=SRC(7,2)= F2(t3,t4,t5); SRC(6,0)=SRC(7,1)= F2(t4,t5,t6); SRC(7,0)= F2(t5,t6,t7); - + } static void predict_8x8_vr( uint8_t *src, uint8_t edge[33] ) { diff --git a/common/quant.c b/common/quant.c index deeaf6c4..74be5919 100644 --- a/common/quant.c +++ b/common/quant.c @@ -194,7 +194,7 @@ void x264_mb_dequant_4x4_dc( int16_t dct[4][4], int dequant_mf[6][4][4], int i_q } } -void x264_denoise_dct_core( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ) +void x264_denoise_dct( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ) { int i; for( i=1; idequant_4x4 = dequant_4x4; pf->dequant_8x8 = dequant_8x8; - pf->denoise_dct_core = x264_denoise_dct_core; + pf->denoise_dct = x264_denoise_dct; #ifdef HAVE_MMX if( cpu&X264_CPU_MMX ) @@ -233,7 +233,7 @@ void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf ) pf->dequant_4x4 = x264_dequant_4x4_flat16_mmx; pf->dequant_8x8 = x264_dequant_8x8_flat16_mmx; } - pf->denoise_dct_core = x264_denoise_dct_core_mmx; + pf->denoise_dct = x264_denoise_dct_mmx; #endif } @@ -257,7 +257,7 @@ void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf ) pf->dequant_4x4 = x264_dequant_4x4_flat16_sse2; pf->dequant_8x8 = x264_dequant_8x8_flat16_sse2; } - pf->denoise_dct_core = x264_denoise_dct_core_sse2; + pf->denoise_dct = x264_denoise_dct_sse2; } if( cpu&X264_CPU_SSSE3 ) @@ -266,7 +266,7 @@ void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf ) pf->quant_4x4_dc = x264_quant_4x4_dc_ssse3; pf->quant_4x4 = x264_quant_4x4_ssse3; pf->quant_8x8 = x264_quant_8x8_ssse3; - pf->denoise_dct_core = x264_denoise_dct_core_ssse3; + pf->denoise_dct = x264_denoise_dct_ssse3; } #endif // HAVE_MMX diff --git a/common/quant.h b/common/quant.h index 0d41927b..0a9741b0 100644 --- a/common/quant.h +++ b/common/quant.h @@ -33,7 +33,7 @@ typedef struct void (*dequant_4x4)( int16_t dct[4][4], int dequant_mf[6][4][4], int i_qp ); void (*dequant_8x8)( int16_t dct[8][8], int dequant_mf[6][8][8], int i_qp ); - void (*denoise_dct_core)( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ); + void (*denoise_dct)( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ); } x264_quant_function_t; void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf ); diff --git a/common/set.c b/common/set.c index df1c2de9..77713d41 100644 --- a/common/set.c +++ b/common/set.c @@ -75,7 +75,7 @@ int x264_cqm_init( x264_t *h ) int quant8_mf[2][6][8][8]; int q, i, j, i_list; int deadzone[4] = { 32 - h->param.analyse.i_luma_deadzone[1], - 32 - h->param.analyse.i_luma_deadzone[0], + 32 - h->param.analyse.i_luma_deadzone[0], 32 - 11, 32 - 21 }; int max_qp_err = -1; @@ -247,7 +247,7 @@ int x264_cqm_parse_file( x264_t *h, const char *filename ) int b_error = 0; h->param.i_cqm_preset = X264_CQM_CUSTOM; - + buf = x264_slurp_file( filename ); if( !buf ) { diff --git a/common/set.h b/common/set.h index 2d535119..c50aadf7 100644 --- a/common/set.h +++ b/common/set.h @@ -94,7 +94,7 @@ typedef struct int b_aspect_ratio_info_present; int i_sar_width; int i_sar_height; - + int b_overscan_info_present; int b_overscan_info; diff --git a/common/x86/dct-64.asm b/common/x86/dct-64.asm index 383a9001..07347fa2 100644 --- a/common/x86/dct-64.asm +++ b/common/x86/dct-64.asm @@ -151,7 +151,7 @@ cglobal x264_sub8x8_dct8_sse2 paddw m%9, m%2 paddw m%9, m%4 paddw m%9, m%6 ; %9=a7 - + movdqa m%10, m%6 psraw m%10, 1 paddw m%10, m%6 @@ -208,7 +208,7 @@ cglobal x264_add8x8_idct8_sse2 TRANSPOSE8x8W 0,1,2,3,4,5,6,7,8 paddw m0, [pw_32 GLOBAL] ; rounding for the >>6 at the end IDCT8_1D 0,1,2,3,4,5,6,7,8,9 - + pxor m9, m9 STORE_DIFF m0, m8, m9, [r0+0*FDEC_STRIDE] STORE_DIFF m1, m8, m9, [r0+1*FDEC_STRIDE] diff --git a/common/x86/mc-a.asm b/common/x86/mc-a.asm index f2ed0932..853d6762 100644 --- a/common/x86/mc-a.asm +++ b/common/x86/mc-a.asm @@ -569,7 +569,7 @@ AVG_WEIGHT sse2, 16 ; FIXME assumes 64 byte cachelines ;----------------------------------------------------------------------------- -; void x264_prefetch_fenc_mmxext( uint8_t *pix_y, int stride_y, +; void x264_prefetch_fenc_mmxext( uint8_t *pix_y, int stride_y, ; uint8_t *pix_uv, int stride_uv, int mb_x ) ;----------------------------------------------------------------------------- %ifdef ARCH_X86_64 diff --git a/common/x86/pixel-32.asm b/common/x86/pixel-32.asm index 720ec154..bf109a27 100644 --- a/common/x86/pixel-32.asm +++ b/common/x86/pixel-32.asm @@ -143,7 +143,7 @@ cglobal x264_pixel_sa8d_8x8_mmxext movq mm5, [trans+0x48] movq mm6, [trans+0x50] movq mm7, [trans+0x58] - + HADAMARD8_1D mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7 SUM4x8_MM @@ -282,7 +282,7 @@ cglobal x264_intra_sa8d_x3_8x8_core_mmxext movq mm5, [trans+0x48] movq mm6, [trans+0x50] movq mm7, [trans+0x58] - + HADAMARD8_1D mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7 movd [sum+0x10], mm0 diff --git a/common/x86/pixel-a.asm b/common/x86/pixel-a.asm index 7816e9ae..528c6051 100644 --- a/common/x86/pixel-a.asm +++ b/common/x86/pixel-a.asm @@ -1387,7 +1387,7 @@ cglobal x264_pixel_ssim_end4_sse2, 3,3 ; Successive Elimination ADS ;============================================================================= -%macro ADS_START 1 ; unroll_size +%macro ADS_START 1 ; unroll_size %ifdef ARCH_X86_64 %define t0 r6 mov r10, rsp @@ -1401,7 +1401,7 @@ cglobal x264_pixel_ssim_end4_sse2, 3,3 and rsp, ~15 mov t0, rsp shl r2d, 1 -%endmacro +%endmacro %macro ADS_END 1 add r1, 8*%1 diff --git a/common/x86/predict-a.asm b/common/x86/predict-a.asm index 0eb1e378..a792a070 100644 --- a/common/x86/predict-a.asm +++ b/common/x86/predict-a.asm @@ -72,7 +72,7 @@ pw_8: times 8 dw 8 pw_76543210: pw_3210: dw 0, 1, 2, 3, 4, 5, 6, 7 pb_00s_ff: times 8 db 0 -pb_0s_ff: times 7 db 0 +pb_0s_ff: times 7 db 0 db 0xff SECTION .text diff --git a/common/x86/predict-c.c b/common/x86/predict-c.c index abd43112..489bffba 100644 --- a/common/x86/predict-c.c +++ b/common/x86/predict-c.c @@ -151,15 +151,15 @@ static void predict_8x8c_h( uint8_t *src ) static void predict_16x16_dc_left( uint8_t *src ) { uint32_t s = 0; - uint64_t dc; + uint64_t dc; int y; - + for( y = 0; y < 16; y++ ) { s += src[-1 + y * FDEC_STRIDE]; - } + } dc = (( s + 8 ) >> 4) * 0x0101010101010101ULL; - + for( y = 0; y < 16; y++ ) { uint64_t *p = (uint64_t*)src; diff --git a/common/x86/quant-a.asm b/common/x86/quant-a.asm index 77c33e22..b840f8f8 100644 --- a/common/x86/quant-a.asm +++ b/common/x86/quant-a.asm @@ -331,10 +331,10 @@ DEQUANT sse2, 8, 6, 2 ;----------------------------------------------------------------------------- -; void x264_denoise_dct_core_mmx( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ) +; void x264_denoise_dct_mmx( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ) ;----------------------------------------------------------------------------- %macro DENOISE_DCT 1 -cglobal x264_denoise_dct_core_%1, 4,5 +cglobal x264_denoise_dct_%1, 4,5 movzx r4d, word [r0] ; backup DC coefficient pxor m7, m7 .loop: diff --git a/common/x86/quant.h b/common/x86/quant.h index 5b31febb..51da6cdf 100644 --- a/common/x86/quant.h +++ b/common/x86/quant.h @@ -43,8 +43,8 @@ void x264_dequant_4x4_flat16_mmx( int16_t dct[4][4], int dequant_mf[6][4][4], in void x264_dequant_8x8_flat16_mmx( int16_t dct[8][8], int dequant_mf[6][8][8], int i_qp ); void x264_dequant_4x4_flat16_sse2( int16_t dct[4][4], int dequant_mf[6][4][4], int i_qp ); void x264_dequant_8x8_flat16_sse2( int16_t dct[8][8], int dequant_mf[6][8][8], int i_qp ); -void x264_denoise_dct_core_mmx( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ); -void x264_denoise_dct_core_sse2( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ); -void x264_denoise_dct_core_ssse3( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ); +void x264_denoise_dct_mmx( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ); +void x264_denoise_dct_sse2( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ); +void x264_denoise_dct_ssse3( int16_t *dct, uint32_t *sum, uint16_t *offset, int size ); #endif diff --git a/common/x86/sad-a.asm b/common/x86/sad-a.asm index 42e48892..ab28dd25 100644 --- a/common/x86/sad-a.asm +++ b/common/x86/sad-a.asm @@ -80,7 +80,7 @@ cglobal x264_pixel_sad_%1x%2_mmxext, 4,4 pxor mm0, mm0 %rep %2/2 SAD_INC_2x%1P -%endrep +%endrep movd eax, mm0 RET %endmacro @@ -825,11 +825,11 @@ cglobal x264_pixel_sad_x3_%1x%2_cache%3_%5, 0,0 call x264_pixel_sad_%1x%2_cache%3_%5 mov [r11], eax pop r2 - mov r0, r10 + mov r0, r10 call x264_pixel_sad_%1x%2_cache%3_%5 mov [r11+4], eax pop r2 - mov r0, r10 + mov r0, r10 call x264_pixel_sad_%1x%2_cache%3_%5 mov [r11+8], eax %else @@ -875,15 +875,15 @@ cglobal x264_pixel_sad_x4_%1x%2_cache%3_%5, 0,0 call x264_pixel_sad_%1x%2_cache%3_%5 mov [r11], eax pop r2 - mov r0, r10 + mov r0, r10 call x264_pixel_sad_%1x%2_cache%3_%5 mov [r11+4], eax pop r2 - mov r0, r10 + mov r0, r10 call x264_pixel_sad_%1x%2_cache%3_%5 mov [r11+8], eax pop r2 - mov r0, r10 + mov r0, r10 call x264_pixel_sad_%1x%2_cache%3_%5 mov [r11+12], eax %else diff --git a/common/x86/x86util.asm b/common/x86/x86util.asm old mode 100755 new mode 100644 diff --git a/encoder/analyse.c b/encoder/analyse.c index 06fd28d0..cd7f745a 100644 --- a/encoder/analyse.c +++ b/encoder/analyse.c @@ -498,7 +498,7 @@ static void x264_mb_analyse_intra_chroma( x264_t *h, x264_mb_analysis_t *a ) h->pixf.mbcmp[PIXEL_8x8]( p_dstc[0], FDEC_STRIDE, p_srcc[0], FENC_STRIDE ); satdv[I_PRED_CHROMA_P] = h->pixf.mbcmp[PIXEL_8x8]( p_dstc[1], FDEC_STRIDE, p_srcc[1], FENC_STRIDE ); - + for( i=0; imc.memcpy_aligned( &a->l0.me16x16, &m, sizeof(x264_me_t) ); /* save mv for predicting neighbors */ - *(uint32_t*)a->l0.mvc[i_ref][0] = + *(uint32_t*)a->l0.mvc[i_ref][0] = *(uint32_t*)h->mb.mvr[0][i_ref][h->mb.i_mb_xy] = *(uint32_t*)m.mv; } @@ -1508,7 +1508,7 @@ static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a ) if ( (*(uint32_t*)a->l0.me16x16.mv & 0x10001) == 0 ) { /* l0 reference is halfpel, so get_ref on it will make it faster */ - src2 = + src2 = h->mc.get_ref( pix2, &stride2, h->mb.pic.p_fref[0][a->l0.i_ref], h->mb.pic.i_stride[0], a->l0.me16x16.mv[0], a->l0.me16x16.mv[1], @@ -1518,7 +1518,7 @@ static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a ) a->l1.me16x16.mv[0], a->l1.me16x16.mv[1], 16, 16 ); weight = 64 - weight; - } + } else { /* if l0 was qpel, we'll use get_ref on l1 instead */ @@ -2558,7 +2558,7 @@ void x264_macroblock_analyse( x264_t *h ) h->mb.i_type = i_type; h->mb.i_partition = i_partition; } - + x264_mb_analyse_intra( h, &analysis, i_satd_inter ); if( analysis.b_mbrd ) diff --git a/encoder/encoder.c b/encoder/encoder.c index ab45238b..ad7151c2 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -237,7 +237,7 @@ static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal { bs_write_ue( s, sh->ref_pic_list_order[0][i].idc ); bs_write_ue( s, sh->ref_pic_list_order[0][i].arg ); - + } bs_write_ue( s, 3 ); } @@ -429,7 +429,7 @@ static int x264_validate_parameters( x264_t *h ) // There's nothing special about 1080 in that the warning still applies to it, // but chances are the user can't help it if his content is already 1080p, // so there's no point in warning in that case. - x264_log( h, X264_LOG_WARNING, + x264_log( h, X264_LOG_WARNING, "width or height not divisible by 16 (%dx%d), compression will suffer.\n", h->param.i_width, h->param.i_height ); } @@ -672,7 +672,7 @@ x264_t *x264_encoder_open ( x264_param_t *param ) x264_free( h ); return NULL; } - + h->mb.i_mb_count = h->sps->i_mb_width * h->sps->i_mb_height; /* Init frames. */ @@ -1543,7 +1543,7 @@ do_encode: /* restore CPU state (before using float again) */ x264_emms(); - if( h->sh.i_type == SLICE_TYPE_P && !h->param.rc.b_stat_read + if( h->sh.i_type == SLICE_TYPE_P && !h->param.rc.b_stat_read && h->param.i_scenecut_threshold >= 0 && !h->param.b_pre_scenecut ) { @@ -1604,7 +1604,7 @@ do_encode: /* If using B-frames, force GOP to be closed. * Even if this frame is going to be I and not IDR, forcing a * P-frame before the scenecut will probably help compression. - * + * * We don't yet know exactly which frame is the scene cut, so * we can't assign an I-frame. Instead, change the previous * B-frame to P, and rearrange coding order. */ @@ -1735,22 +1735,22 @@ static void x264_encoder_frame_end( x264_t *h, x264_t *thread_current, psz_message[0] = '\0'; if( h->param.analyse.b_psnr ) { - int64_t sqe[3] = { + int64_t ssd[3] = { h->stat.frame.i_ssd[0], h->stat.frame.i_ssd[1], h->stat.frame.i_ssd[2], }; - h->stat.i_sqe_global[h->sh.i_type] += sqe[0] + sqe[1] + sqe[2]; - h->stat.f_psnr_average[h->sh.i_type] += x264_psnr( sqe[0] + sqe[1] + sqe[2], 3 * h->param.i_width * h->param.i_height / 2 ); - h->stat.f_psnr_mean_y[h->sh.i_type] += x264_psnr( sqe[0], h->param.i_width * h->param.i_height ); - h->stat.f_psnr_mean_u[h->sh.i_type] += x264_psnr( sqe[1], h->param.i_width * h->param.i_height / 4 ); - h->stat.f_psnr_mean_v[h->sh.i_type] += x264_psnr( sqe[2], h->param.i_width * h->param.i_height / 4 ); + h->stat.i_ssd_global[h->sh.i_type] += ssd[0] + ssd[1] + ssd[2]; + h->stat.f_psnr_average[h->sh.i_type] += x264_psnr( ssd[0] + ssd[1] + ssd[2], 3 * h->param.i_width * h->param.i_height / 2 ); + h->stat.f_psnr_mean_y[h->sh.i_type] += x264_psnr( ssd[0], h->param.i_width * h->param.i_height ); + h->stat.f_psnr_mean_u[h->sh.i_type] += x264_psnr( ssd[1], h->param.i_width * h->param.i_height / 4 ); + h->stat.f_psnr_mean_v[h->sh.i_type] += x264_psnr( ssd[2], h->param.i_width * h->param.i_height / 4 ); snprintf( psz_message, 80, " PSNR Y:%5.2f U:%5.2f V:%5.2f", - x264_psnr( sqe[0], h->param.i_width * h->param.i_height ), - x264_psnr( sqe[1], h->param.i_width * h->param.i_height / 4), - x264_psnr( sqe[2], h->param.i_width * h->param.i_height / 4) ); + x264_psnr( ssd[0], h->param.i_width * h->param.i_height ), + x264_psnr( ssd[1], h->param.i_width * h->param.i_height / 4), + x264_psnr( ssd[2], h->param.i_width * h->param.i_height / 4) ); } if( h->param.analyse.b_ssim ) @@ -1762,7 +1762,7 @@ static void x264_encoder_frame_end( x264_t *h, x264_t *thread_current, " SSIM Y:%.5f", ssim_y ); } psz_message[79] = '\0'; - + x264_log( h, X264_LOG_DEBUG, "frame=%4d QP=%.2f NAL=%d Slice:%c Poc:%-3d I:%-4d P:%-4d SKIP:%-4d size=%d bytes%s\n", h->i_frame, @@ -1858,7 +1858,7 @@ void x264_encoder_close ( x264_t *h ) (double)h->stat.i_slice_size[i_slice] / i_count, h->stat.f_psnr_mean_y[i_slice] / i_count, h->stat.f_psnr_mean_u[i_slice] / i_count, h->stat.f_psnr_mean_v[i_slice] / i_count, h->stat.f_psnr_average[i_slice] / i_count, - x264_psnr( h->stat.i_sqe_global[i_slice], i_count * i_yuv_size ) ); + x264_psnr( h->stat.i_ssd_global[i_slice], i_count * i_yuv_size ) ); } else { @@ -2014,7 +2014,7 @@ void x264_encoder_close ( x264_t *h ) SUM3( h->stat.f_psnr_mean_u ) / i_count, SUM3( h->stat.f_psnr_mean_v ) / i_count, SUM3( h->stat.f_psnr_average ) / i_count, - x264_psnr( SUM3( h->stat.i_sqe_global ), i_count * i_yuv_size ), + x264_psnr( SUM3( h->stat.i_ssd_global ), i_count * i_yuv_size ), f_bitrate ); } else diff --git a/encoder/macroblock.c b/encoder/macroblock.c index 8c14302f..c9b45448 100644 --- a/encoder/macroblock.c +++ b/encoder/macroblock.c @@ -122,7 +122,7 @@ void x264_mb_encode_i8x8( x264_t *h, int idx, int i_qscale ) if( h->mb.b_trellis ) x264_quant_8x8_trellis( h, dct8x8, CQM_8IY, i_qscale, 1 ); - else + else h->quantf.quant_8x8( dct8x8, h->quant8_mf[CQM_8IY][i_qscale], h->quant8_bias[CQM_8IY][i_qscale] ); h->zigzagf.scan_8x8( h->dct.luma8x8[idx], dct8x8 ); @@ -215,7 +215,7 @@ void x264_mb_encode_8x8_chroma( x264_t *h, int b_inter, int i_qscale ) } continue; } - + h->dctf.sub8x8_dct( dct4x4, p_src, p_dst ); /* calculate dct coeffs */ for( i = 0; i < 4; i++ ) @@ -445,7 +445,7 @@ void x264_macroblock_encode( x264_t *h ) for( idx = 0; idx < 4; idx++ ) { if( h->mb.b_noise_reduction ) - h->quantf.denoise_dct_core( *dct8x8[idx], h->nr_residual_sum[1], h->nr_offset[1], 64 ); + h->quantf.denoise_dct( *dct8x8[idx], h->nr_residual_sum[1], h->nr_offset[1], 64 ); if( h->mb.b_trellis ) x264_quant_8x8_trellis( h, dct8x8[idx], CQM_8PY, i_qp, 0 ); else @@ -493,7 +493,7 @@ void x264_macroblock_encode( x264_t *h ) idx = i8x8 * 4 + i4x4; if( h->mb.b_noise_reduction ) - h->quantf.denoise_dct_core( *dct4x4[idx], h->nr_residual_sum[0], h->nr_offset[0], 16 ); + h->quantf.denoise_dct( *dct4x4[idx], h->nr_residual_sum[0], h->nr_offset[0], 16 ); if( h->mb.b_trellis ) x264_quant_4x4_trellis( h, dct4x4[idx], CQM_4PY, i_qp, DCT_LUMA_4x4, 0 ); else @@ -594,7 +594,7 @@ void x264_macroblock_encode( x264_t *h ) if( !b_force_no_skip ) { if( h->mb.i_type == P_L0 && h->mb.i_partition == D_16x16 && - !(h->mb.i_cbp_luma | h->mb.i_cbp_chroma) && + !(h->mb.i_cbp_luma | h->mb.i_cbp_chroma) && *(uint32_t*)h->mb.cache.mv[0][x264_scan8[0]] == *(uint32_t*)h->mb.cache.pskip_mv && h->mb.cache.ref[0][x264_scan8[0]] == 0 ) { diff --git a/encoder/me.c b/encoder/me.c index f4f7e502..44f6f6db 100644 --- a/encoder/me.c +++ b/encoder/me.c @@ -31,7 +31,7 @@ * and refine_* are run only on the winner. * the subme=7 values are much higher because any amount of satd search makes * up its time by reducing the number of rd iterations. */ -static const int subpel_iterations[][4] = +static const int subpel_iterations[][4] = {{1,0,0,0}, {1,1,0,0}, {0,1,1,0}, @@ -162,7 +162,7 @@ void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int omx, omy, pmx, pmy; uint8_t *p_fref = m->p_fref[0]; DECLARE_ALIGNED_16( uint8_t pix[16*16] ); - + int i = 0, j; int dir; int costs[6]; diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 5d09e59a..1ffbd3c3 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -273,7 +273,7 @@ int x264_ratecontrol_new( x264_t *h ) rc->b_abr = h->param.rc.i_rc_method != X264_RC_CQP && !h->param.rc.b_stat_read; rc->b_2pass = h->param.rc.i_rc_method == X264_RC_ABR && h->param.rc.b_stat_read; - + /* FIXME: use integers */ if(h->param.i_fps_num > 0 && h->param.i_fps_den > 0) rc->fps = (float) h->param.i_fps_num / h->param.i_fps_den; @@ -689,7 +689,7 @@ void x264_ratecontrol_summary( x264_t *h ) if( rc->b_abr && h->param.rc.i_rc_method == X264_RC_ABR && rc->cbr_decay > .9999 ) { double base_cplx = h->mb.i_mb_count * (h->param.i_bframe ? 120 : 80); - x264_log( h, X264_LOG_INFO, "final ratefactor: %.2f\n", + x264_log( h, X264_LOG_INFO, "final ratefactor: %.2f\n", qscale2qp( pow( base_cplx, 1 - h->param.rc.f_qcompress ) * rc->cplxr_sum / rc->wanted_bits_window ) ); } @@ -865,7 +865,7 @@ double predict_row_size( x264_t *h, int y, int qp ) x264_ratecontrol_t *rc = h->rc; double pred_s = predict_size( rc->row_pred, qp2qscale(qp), h->fdec->i_row_satd[y] ); double pred_t = 0; - if( h->sh.i_type != SLICE_TYPE_I + if( h->sh.i_type != SLICE_TYPE_I && h->fref0[0]->i_type == h->fdec->i_type && h->fref0[0]->i_row_satd[y] > 0 ) { @@ -1071,7 +1071,7 @@ void x264_ratecontrol_end( x264_t *h, int bits ) int dir_frame = h->stat.frame.i_direct_score[1] - h->stat.frame.i_direct_score[0]; int dir_avg = h->stat.i_direct_score[1] - h->stat.i_direct_score[0]; char c_direct = h->mb.b_direct_auto_write ? - ( dir_frame>0 ? 's' : dir_frame<0 ? 't' : + ( dir_frame>0 ? 's' : dir_frame<0 ? 't' : dir_avg>0 ? 's' : dir_avg<0 ? 't' : '-' ) : '-'; fprintf( rc->p_stat_file_out, diff --git a/encoder/rdo.c b/encoder/rdo.c index 650b5ae5..4c3f855c 100644 --- a/encoder/rdo.c +++ b/encoder/rdo.c @@ -50,7 +50,7 @@ static uint16_t cabac_prefix_size[15][128]; #define COPY_CABAC h->mc.memcpy_aligned( &cabac_tmp.f8_bits_encoded, &h->cabac.f8_bits_encoded, \ sizeof(x264_cabac_t) - offsetof(x264_cabac_t,f8_bits_encoded) ) - + static int ssd_mb( x264_t *h ) { return h->pixf.ssd[PIXEL_16x16]( h->mb.pic.p_fenc[0], FENC_STRIDE, @@ -247,24 +247,24 @@ void x264_rdo_init( ) // I'm just matching the behaviour of deadzone quant. static const int lambda2_tab[2][52] = { // inter lambda = .85 * .85 * 2**(qp/3. + 10 - LAMBDA_BITS) - { 46, 58, 73, 92, 117, 147, - 185, 233, 294, 370, 466, 587, - 740, 932, 1174, 1480, 1864, 2349, - 2959, 3728, 4697, 5918, 7457, 9395, - 11837, 14914, 18790, 23674, 29828, 37581, - 47349, 59656, 75163, 94699, 119313, 150326, - 189399, 238627, 300652, 378798, 477255, 601304, - 757596, 954511, 1202608, 1515192, 1909022, 2405217, + { 46, 58, 73, 92, 117, 147, + 185, 233, 294, 370, 466, 587, + 740, 932, 1174, 1480, 1864, 2349, + 2959, 3728, 4697, 5918, 7457, 9395, + 11837, 14914, 18790, 23674, 29828, 37581, + 47349, 59656, 75163, 94699, 119313, 150326, + 189399, 238627, 300652, 378798, 477255, 601304, + 757596, 954511, 1202608, 1515192, 1909022, 2405217, 3030384, 3818045, 4810435, 6060769 }, // intra lambda = .65 * .65 * 2**(qp/3. + 10 - LAMBDA_BITS) - { 27, 34, 43, 54, 68, 86, - 108, 136, 172, 216, 273, 343, - 433, 545, 687, 865, 1090, 1374, - 1731, 2180, 2747, 3461, 4361, 5494, - 6922, 8721, 10988, 13844, 17442, 21976, - 27688, 34885, 43953, 55377, 69771, 87906, - 110755, 139543, 175813, 221511, 279087, 351627, - 443023, 558174, 703255, 886046, 1116348, 1406511, + { 27, 34, 43, 54, 68, 86, + 108, 136, 172, 216, 273, 343, + 433, 545, 687, 865, 1090, 1374, + 1731, 2180, 2747, 3461, 4361, 5494, + 6922, 8721, 10988, 13844, 17442, 21976, + 27688, 34885, 43953, 55377, 69771, 87906, + 110755, 139543, 175813, 221511, 279087, 351627, + 443023, 558174, 703255, 886046, 1116348, 1406511, 1772093, 2232697, 2813022, 3544186 } }; diff --git a/encoder/set.c b/encoder/set.c index 1008551a..86904b6f 100644 --- a/encoder/set.c +++ b/encoder/set.c @@ -150,11 +150,11 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param ) sps->vui.i_sar_width = param->vui.i_sar_width; sps->vui.i_sar_height= param->vui.i_sar_height; } - + sps->vui.b_overscan_info_present = ( param->vui.i_overscan ? 1 : 0 ); if( sps->vui.b_overscan_info_present ) sps->vui.b_overscan_info = ( param->vui.i_overscan == 2 ? 1 : 0 ); - + sps->vui.b_signal_type_present = 0; sps->vui.i_vidformat = ( param->vui.i_vidformat <= 5 ? param->vui.i_vidformat : 5 ); sps->vui.b_fullrange = ( param->vui.b_fullrange ? 1 : 0 ); @@ -176,7 +176,7 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param ) { sps->vui.b_signal_type_present = 1; } - + /* FIXME: not sufficient for interlaced video */ sps->vui.b_chroma_loc_info_present = ( param->vui.i_chroma_loc ? 1 : 0 ); if( sps->vui.b_chroma_loc_info_present ) diff --git a/extras/stdint.h b/extras/stdint.h index 92dfa884..849d9ab0 100644 --- a/extras/stdint.h +++ b/extras/stdint.h @@ -43,9 +43,9 @@ typedef unsigned uint_least32_t; typedef __int64 int_least64_t; typedef unsigned __int64 uint_least64_t; -/* 7.18.1.3 Fastest minimum-width integer types +/* 7.18.1.3 Fastest minimum-width integer types * Not actually guaranteed to be fastest for all purposes - * Here we use the exact-width types for 8 and 16-bit ints. + * Here we use the exact-width types for 8 and 16-bit ints. */ typedef char int_fast8_t; typedef unsigned char uint_fast8_t; @@ -68,7 +68,7 @@ typedef unsigned __int64 uintmax_t; #if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) /* 7.18.2.1 Limits of exact-width integer types */ -#define INT8_MIN (-128) +#define INT8_MIN (-128) #define INT16_MIN (-32768) #define INT32_MIN (-2147483647 - 1) #define INT64_MIN (-9223372036854775807LL - 1) @@ -116,7 +116,7 @@ typedef unsigned __int64 uintmax_t; #define UINT_FAST64_MAX UINT64_MAX /* 7.18.2.4 Limits of integer types capable of holding - object pointers */ + object pointers */ #define INTPTR_MIN INT32_MIN #define INTPTR_MAX INT32_MAX #define UINTPTR_MAX UINT32_MAX @@ -135,7 +135,7 @@ typedef unsigned __int64 uintmax_t; #define SIZE_MAX UINT32_MAX -#ifndef WCHAR_MIN /* also in wchar.h */ +#ifndef WCHAR_MIN /* also in wchar.h */ #define WCHAR_MIN 0 #define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ #endif diff --git a/gtk/x264_gtk.h b/gtk/x264_gtk.h index 233a5038..6589e0a3 100644 --- a/gtk/x264_gtk.h +++ b/gtk/x264_gtk.h @@ -76,7 +76,7 @@ struct X264_Gtk_ gint threads; guint trellis; gint noise_reduction; - + gint strength; gint threshold; diff --git a/gtk/x264_gtk_encode_private.h b/gtk/x264_gtk_encode_private.h index 553cc1c3..44dc4906 100644 --- a/gtk/x264_gtk_encode_private.h +++ b/gtk/x264_gtk_encode_private.h @@ -54,7 +54,7 @@ struct X264_Thread_Data_ GIOChannel *io_write; /* use it with write */ }; -struct X264_Pipe_Data_ +struct X264_Pipe_Data_ { int frame; int frame_total; diff --git a/muxers.c b/muxers.c index bb2643c0..a68bbfc0 100644 --- a/muxers.c +++ b/muxers.c @@ -285,7 +285,7 @@ int read_frame_y4m( x264_picture_t *p_pic, hnd_t handle, int i_frame ) /* Read frame header - without terminating '\n' */ if (fread(header, 1, slen, h->fh) != slen) return -1; - + header[slen] = 0; if (strncmp(header, Y4M_FRAME_MAGIC, slen)) { @@ -293,7 +293,7 @@ int read_frame_y4m( x264_picture_t *p_pic, hnd_t handle, int i_frame ) *((uint32_t*)header), header); return -1; } - + /* Skip most of it */ while (ifh) != '\n') i++; diff --git a/tools/avc2avi.c b/tools/avc2avi.c index 09a3e4ae..075866ae 100644 --- a/tools/avc2avi.c +++ b/tools/avc2avi.c @@ -499,7 +499,7 @@ void h264_parser_parse( h264_t *h, nal_t *nal, int *pb_nal_start ) /* skip i_offset_for_top_to_bottom_field */ bs_read_se( &s ); /* read i_num_ref_frames_in_poc_cycle */ - i_cycle = bs_read_ue( &s ); + i_cycle = bs_read_ue( &s ); if( i_cycle > 256 ) i_cycle = 256; while( i_cycle > 0 ) { diff --git a/tools/checkasm.c b/tools/checkasm.c index 1e991b30..2e895b9d 100644 --- a/tools/checkasm.c +++ b/tools/checkasm.c @@ -1069,7 +1069,7 @@ static int check_quant( int cpu_ref, int cpu_new ) report( "dequant :" ); - if( qf_a.denoise_dct_core != qf_ref.denoise_dct_core ) + if( qf_a.denoise_dct != qf_ref.denoise_dct ) { int size; for( size = 16; size <= 64; size += 48 ) @@ -1079,12 +1079,12 @@ static int check_quant( int cpu_ref, int cpu_new ) memcpy(dct1, buf1, size*2); memcpy(dct2, buf1, size*2); memcpy(buf3+256, buf3, 256); - call_c1( qf_c.denoise_dct_core, dct1, (uint32_t*)buf3, (uint16_t*)buf2, size ); - call_a1( qf_a.denoise_dct_core, dct2, (uint32_t*)(buf3+256), (uint16_t*)buf2, size ); + call_c1( qf_c.denoise_dct, dct1, (uint32_t*)buf3, (uint16_t*)buf2, size ); + call_a1( qf_a.denoise_dct, dct2, (uint32_t*)(buf3+256), (uint16_t*)buf2, size ); if( memcmp( dct1, dct2, size*2 ) || memcmp( buf3+4, buf3+256+4, (size-1)*sizeof(uint32_t) ) ) ok = 0; - call_c2( qf_c.denoise_dct_core, dct1, (uint32_t*)buf3, (uint16_t*)buf2, size ); - call_a2( qf_a.denoise_dct_core, dct2, (uint32_t*)(buf3+256), (uint16_t*)buf2, size ); + call_c2( qf_c.denoise_dct, dct1, (uint32_t*)buf3, (uint16_t*)buf2, size ); + call_a2( qf_a.denoise_dct, dct2, (uint32_t*)(buf3+256), (uint16_t*)buf2, size ); } } report( "denoise dct :" ); diff --git a/x264.c b/x264.c index b4b832ec..591e2105 100644 --- a/x264.c +++ b/x264.c @@ -632,7 +632,7 @@ static int Parse( int argc, char **argv, sscanf( argv[optind++], "%ux%u", ¶m->i_width, ¶m->i_height ); } } - + if( !(b_avis || b_y4m) && ( !param->i_width || !param->i_height ) ) { fprintf( stderr, "x264 [error]: Rawyuv input requires a resolution.\n" ); @@ -824,7 +824,7 @@ static int Encode( x264_param_t *param, cli_opt_t *opt ) i_frame++; /* update status line (up to 1000 times per input file) */ - if( opt->b_progress && param->i_log_level < X264_LOG_DEBUG && + if( opt->b_progress && param->i_log_level < X264_LOG_DEBUG && ( i_frame_total ? i_frame * 1000 / i_frame_total > i_progress : i_frame % 10 == 0 ) ) { diff --git a/x264.h b/x264.h index 3b678dc7..8b8ef86d 100644 --- a/x264.h +++ b/x264.h @@ -155,7 +155,7 @@ typedef struct x264_param_t int i_width; int i_height; int i_csp; /* CSP of encoded bitstream, only i420 supported */ - int i_level_idc; + int i_level_idc; int i_frame_total; /* number of frames to encode if known, else 0 */ struct @@ -165,7 +165,7 @@ typedef struct x264_param_t int i_sar_width; int i_overscan; /* 0=undef, 1=no overscan, 2=overscan */ - + /* see h264 annex E for the values of the following */ int i_vidformat; int b_fullrange;