From: Loren Merritt Date: Fri, 25 Apr 2008 06:33:12 +0000 (-0600) Subject: s/x264_cpu_restore/x264_emms/ X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27ae7576cf0a978317fc9c1be3fc3b562338a7c4;p=libx264 s/x264_cpu_restore/x264_emms/ no point in giving it a generic name when it's not generic --- diff --git a/common/cpu.c b/common/cpu.c index 0f713358..f79f0031 100644 --- a/common/cpu.c +++ b/common/cpu.c @@ -57,7 +57,6 @@ const struct { #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 ); -extern void x264_emms( void ); uint32_t x264_cpu_detect( void ) { @@ -146,14 +145,6 @@ uint32_t x264_cpu_detect( void ) return cpu; } -void x264_cpu_restore( uint32_t cpu ) -{ - if( cpu&(X264_CPU_MMX|X264_CPU_MMXEXT|X264_CPU_3DNOW|X264_CPU_3DNOWEXT) ) - { - x264_emms(); - } -} - #elif defined( ARCH_PPC ) #ifdef SYS_MACOSX @@ -217,10 +208,6 @@ uint32_t x264_cpu_detect( void ) } #endif -void x264_cpu_restore( uint32_t cpu ) -{ -} - #else uint32_t x264_cpu_detect( void ) @@ -228,10 +215,12 @@ uint32_t x264_cpu_detect( void ) return 0; } -void x264_cpu_restore( uint32_t cpu ) +#endif + +#ifndef HAVE_MMX +void x264_emms( void ) { } - #endif diff --git a/common/cpu.h b/common/cpu.h index e78148ad..6a669735 100644 --- a/common/cpu.h +++ b/common/cpu.h @@ -26,9 +26,7 @@ uint32_t x264_cpu_detect( void ); int x264_cpu_num_processors( void ); - -/* probably MMX(EXT) centric but .... */ -void x264_cpu_restore( uint32_t cpu ); +void x264_emms( void ); /* kluge: * gcc can't give variables any greater alignment than the stack frame has. diff --git a/encoder/encoder.c b/encoder/encoder.c index 137cfd4c..a328fdfc 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1488,7 +1488,7 @@ do_encode: x264_slices_write( h ); /* restore CPU state (before using float again) */ - x264_cpu_restore( h->param.cpu ); + x264_emms(); if( h->sh.i_type == SLICE_TYPE_P && !h->param.rc.b_stat_read && h->param.i_scenecut_threshold >= 0 @@ -1635,11 +1635,11 @@ static void x264_encoder_frame_end( x264_t *h, x264_t *thread_current, /* ---------------------- Update encoder state ------------------------- */ /* update rc */ - x264_cpu_restore( h->param.cpu ); + x264_emms(); x264_ratecontrol_end( h, h->out.i_frame_size * 8 ); /* restore CPU state (before using float again) */ - x264_cpu_restore( h->param.cpu ); + x264_emms(); x264_noise_reduction_update( h ); @@ -1692,7 +1692,7 @@ static void x264_encoder_frame_end( x264_t *h, x264_t *thread_current, h->fenc->plane[i], h->fenc->i_stride[i], h->param.i_width >> !!i, h->param.i_height >> !!i ); } - x264_cpu_restore( h->param.cpu ); + x264_emms(); 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 ); diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 11790ea2..a0e08591 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -204,7 +204,7 @@ static NOINLINE int ac_energy_mb( x264_t *h, int mb_x, int mb_y, int *satd ) var = X264_MAX(var,1); } else var = h->rc->ac_energy[h->mb.i_mb_xy]; - x264_cpu_restore(h->param.cpu); + x264_emms(); return var; } @@ -229,7 +229,7 @@ void x264_autosense_aq( x264_t *h ) total += logf(energy) * satd; n += satd; } - x264_cpu_restore(h->param.cpu); + x264_emms(); /* Calculate and store the threshold. */ h->rc->aq_threshold = n ? total/n : 15; } @@ -262,7 +262,7 @@ int x264_ratecontrol_new( x264_t *h ) x264_ratecontrol_t *rc; int i; - x264_cpu_restore( h->param.cpu ); + x264_emms(); rc = h->rc = x264_malloc( h->param.i_threads * sizeof(x264_ratecontrol_t) ); memset( rc, 0, h->param.i_threads * sizeof(x264_ratecontrol_t) ); @@ -738,7 +738,7 @@ void x264_ratecontrol_start( x264_t *h, int i_force_qp ) x264_zone_t *zone = get_zone( h, h->fenc->i_frame ); float q; - x264_cpu_restore( h->param.cpu ); + x264_emms(); if( zone && (!rc->prev_zone || zone->param != rc->prev_zone->param) ) x264_encoder_reconfig( h, zone->param ); @@ -867,7 +867,7 @@ void x264_ratecontrol_mb( x264_t *h, int bits ) x264_ratecontrol_t *rc = h->rc; const int y = h->mb.i_mb_y; - x264_cpu_restore( h->param.cpu ); + x264_emms(); h->fdec->i_row_bits[y] += bits; rc->qpa_rc += rc->qpm; @@ -988,7 +988,7 @@ void x264_ratecontrol_end( x264_t *h, int bits ) const int *mbs = h->stat.frame.i_mb_count; int i; - x264_cpu_restore( h->param.cpu ); + x264_emms(); h->stat.frame.i_mb_count_skip = mbs[P_SKIP] + mbs[B_SKIP]; h->stat.frame.i_mb_count_i = mbs[I_16x16] + mbs[I_8x8] + mbs[I_4x4]; diff --git a/encoder/slicetype.c b/encoder/slicetype.c index 722aa223..8cee4f90 100644 --- a/encoder/slicetype.c +++ b/encoder/slicetype.c @@ -310,7 +310,7 @@ int x264_slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a, frames[b]->i_cost_est[b-p0][p1-b] = i_score; // fprintf( stderr, "frm %d %c(%d,%d): %6d %6d imb:%d \n", frames[b]->i_frame, // (p1==0?'I':bi_cost_est[0][0], frames[b]->i_intra_mbs[b-p0] ); - x264_cpu_restore( h->param.cpu ); + x264_emms(); } if( b_intra_penalty ) diff --git a/tools/checkasm.c b/tools/checkasm.c index 73faf122..957e3a36 100644 --- a/tools/checkasm.c +++ b/tools/checkasm.c @@ -143,7 +143,7 @@ static int check_pixel( int cpu_ref, int cpu_new ) { float res_c, res_a; ok = 1; - x264_cpu_restore( cpu_new ); + x264_emms(); res_c = x264_pixel_ssim_wxh( &pixel_c, buf1+2, 32, buf2+2, 32, 32, 28 ); res_a = x264_pixel_ssim_wxh( &pixel_asm, buf1+2, 32, buf2+2, 32, 32, 28 ); if( fabs(res_c - res_a) > 1e-7 )