From: Laurent Aimar Date: Tue, 17 Aug 2004 20:39:03 +0000 (+0000) Subject: * all: more fprintf -> x264_log. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dab6f065ffd7ab2ecc591ef22e0d556a3516a48f;p=libx264 * all: more fprintf -> x264_log. git-svn-id: svn://svn.videolan.org/x264/trunk@35 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/core/frame.c b/core/frame.c index 02a5b540..eca2ab63 100644 --- a/core/frame.c +++ b/core/frame.c @@ -116,7 +116,7 @@ void x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src break; default: - fprintf( stderr, "Arg invalid CSP\n" ); + x264_log( h, X264_LOG_ERROR, "Arg invalid CSP\n" ); break; } } @@ -639,7 +639,7 @@ void x264_frame_deblocking_filter( x264_t *h, int i_slice_type ) else { /* FIXME */ - fprintf( stderr, "deblocking filter doesn't work yet with B slice\n" ); + x264_log( h, X264_LOG_ERROR, "deblocking filter doesn't work yet with B slice\n" ); return; } } diff --git a/core/macroblock.c b/core/macroblock.c index 4d305737..a4d843de 100644 --- a/core/macroblock.c +++ b/core/macroblock.c @@ -485,7 +485,7 @@ void x264_mb_mc( x264_t *h ) } else if( h->mb.i_type == B_8x8 || h->mb.i_type == B_DIRECT ) { - fprintf( stderr, "mc_luma with unsupported mb\n" ); + x264_log( h, X264_LOG_ERROR, "mc_luma with unsupported mb\n" ); return; } else /* B_*x* */ diff --git a/encoder/encoder.c b/encoder/encoder.c index f7ad61e2..f5b901c6 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -341,6 +341,48 @@ x264_t *x264_encoder_open ( x264_param_t *param ) h->param.i_cabac_init_idc = x264_clip3( h->param.i_cabac_init_idc, -1, 2 ); + /* VUI */ + if( h->param.vui.i_sar_width > 0 && h->param.vui.i_sar_height > 0 ) + { + int w = param->vui.i_sar_width; + int h = param->vui.i_sar_height; + int a = w, b = h; + + while( b != 0 ) + { + int t = a; + + a = b; + b = t % b; + } + + w /= a; + h /= a; + while( w > 65535 || h > 65535 ) + { + w /= 2; + h /= 2; + } + + h->param.vui.i_sar_width = 0; + h->param.vui.i_sar_height = 0; + if( w == 0 || h == 0 ) + { + x264_log( h, X264_LOG_ERROR, "cannot create valid sample aspect ratio\n" ); + } + else if( w == h ) + { + x264_log( h, X264_LOG_INFO, "no need for a SAR\n" ); + } + else + { + x264_log( h, X264_LOG_INFO, "using SAR=%d/%d\n", w, h ); + h->param.vui.i_sar_width = w; + h->param.vui.i_sar_height = h; + } + } + + /* Init x264_t */ h->out.i_nal = 0; h->out.i_bitstream = 1000000; /* FIXME estimate max size (idth/height) */ diff --git a/encoder/set.c b/encoder/set.c index 94b1343f..e0c9504b 100644 --- a/encoder/set.c +++ b/encoder/set.c @@ -107,46 +107,13 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param ) } sps->b_vui = 0; + sps->vui.b_aspect_ratio_info_present = 0; if( param->vui.i_sar_width > 0 && param->vui.i_sar_height > 0 ) { - int w = param->vui.i_sar_width; - int h = param->vui.i_sar_height; - int a = w, b = h; - - while( b != 0 ) - { - int t = a; - - a = b; - b = t % b; - } - - w /= a; - h /= a; - while( w > 65535 || h > 65535 ) - { - w /= 2; - h /= 2; - } - - if( w == 0 || h == 0 ) - { - fprintf( stderr, "x264: cannot create valid sample aspect ratio\n" ); - sps->vui.b_aspect_ratio_info_present = 0; - } - else if( w == h ) - { - fprintf( stderr, "x264: no need for a SAR\n" ); - sps->vui.b_aspect_ratio_info_present = 0; - } - else - { - fprintf( stderr, "x264: using SAR=%d/%d\n", w, h ); - sps->vui.b_aspect_ratio_info_present = 1; - sps->vui.i_sar_width = w; - sps->vui.i_sar_height= h; - } + sps->vui.b_aspect_ratio_info_present = 1; + sps->vui.i_sar_width = param->vui.i_sar_width; + sps->vui.i_sar_height= param->vui.i_sar_height; } sps->b_vui |= sps->vui.b_aspect_ratio_info_present;