From f36b1e49b3c4cd992080c13ff346f4846f8541b8 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 3 Mar 2010 11:22:29 -0800 Subject: [PATCH] Use x264_log in more places instead of fprintf --- common/common.c | 12 ++++++------ common/cpu.c | 2 +- encoder/analyse.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/common.c b/common/common.c index 71fce028..73a848a2 100644 --- a/common/common.c +++ b/common/common.c @@ -262,7 +262,7 @@ static int x264_param_apply_preset( x264_param_t *param, const char *preset ) } else { - fprintf( stderr, "x264 [error]: invalid preset '%s'\n", preset ); + x264_log( NULL, X264_LOG_ERROR, "invalid preset '%s'\n", preset ); return -1; } return 0; @@ -349,14 +349,14 @@ static int x264_param_apply_tune( x264_param_t *param, const char *tune ) } else { - fprintf( stderr, "x264 [error]: invalid tune '%s'\n", s ); + x264_log( NULL, X264_LOG_ERROR, "invalid tune '%s'\n", s ); x264_free( tmp ); return -1; } if( 0 ) { psy_failure: - fprintf( stderr, "x264 [warning]: only 1 psy tuning can be used: ignoring tune %s\n", s ); + x264_log( NULL, X264_LOG_WARNING, "only 1 psy tuning can be used: ignoring tune %s\n", s ); } s = strtok( NULL, ",./-+" ); } @@ -403,7 +403,7 @@ int x264_param_apply_profile( x264_param_t *param, const char *profile ) param->analyse.i_weighted_pred = X264_WEIGHTP_NONE; if( param->b_interlaced ) { - fprintf( stderr, "x264 [error]: baseline profile doesn't support interlacing\n" ); + x264_log( NULL, X264_LOG_ERROR, "baseline profile doesn't support interlacing\n" ); return -1; } } @@ -418,13 +418,13 @@ int x264_param_apply_profile( x264_param_t *param, const char *profile ) } else { - fprintf( stderr, "x264 [error]: invalid profile: %s\n", profile ); + x264_log( NULL, X264_LOG_ERROR, "invalid profile: %s\n", profile ); return -1; } if( (param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant == 0) || (param->rc.i_rc_method == X264_RC_CRF && param->rc.f_rf_constant == 0) ) { - fprintf( stderr, "x264 [error]: %s profile doesn't support lossless\n", profile ); + x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support lossless\n", profile ); return -1; } return 0; diff --git a/common/cpu.c b/common/cpu.c index 9f2d5a65..23761ecf 100644 --- a/common/cpu.c +++ b/common/cpu.c @@ -213,7 +213,7 @@ uint32_t x264_cpu_detect( void ) else if( cache == 64 ) cpu |= X264_CPU_CACHELINE_64; else - fprintf( stderr, "x264 [warning]: unable to determine cacheline size\n" ); + x264_log( NULL, X264_LOG_WARNING, "unable to determine cacheline size\n" ); } #ifdef BROKEN_STACK_ALIGNMENT diff --git a/encoder/analyse.c b/encoder/analyse.c index dfdea4c1..dce63eaa 100644 --- a/encoder/analyse.c +++ b/encoder/analyse.c @@ -3322,13 +3322,13 @@ static void x264_analyse_update_cache( x264_t *h, x264_mb_analysis_t *a ) if( (h->mb.cache.mv[l][x264_scan8[15]][1] >> (2 - h->mb.b_interlaced)) + h->mb.i_mb_y*16 > completed ) { x264_log( h, X264_LOG_WARNING, "internal error (MV out of thread range)\n"); - fprintf(stderr, "mb type: %d \n", h->mb.i_type); - fprintf(stderr, "mv: l%dr%d (%d,%d) \n", l, ref, + x264_log( h, X264_LOG_DEBUG, "mb type: %d \n", h->mb.i_type); + x264_log( h, X264_LOG_DEBUG, "mv: l%dr%d (%d,%d) \n", l, ref, h->mb.cache.mv[l][x264_scan8[15]][0], h->mb.cache.mv[l][x264_scan8[15]][1] ); - fprintf(stderr, "limit: %d \n", h->mb.mv_max_spel[1]); - fprintf(stderr, "mb_xy: %d,%d \n", h->mb.i_mb_x, h->mb.i_mb_y); - fprintf(stderr, "completed: %d \n", completed ); + x264_log( h, X264_LOG_DEBUG, "limit: %d \n", h->mb.mv_max_spel[1]); + x264_log( h, X264_LOG_DEBUG, "mb_xy: %d,%d \n", h->mb.i_mb_x, h->mb.i_mb_y); + x264_log( h, X264_LOG_DEBUG, "completed: %d \n", completed ); x264_log( h, X264_LOG_WARNING, "recovering by using intra mode\n"); x264_mb_analyse_intra( h, a, COST_MAX ); h->mb.i_type = I_16x16; -- 2.47.3