]> granicus.if.org Git - libx264/commitdiff
* all: more fprintf -> x264_log.
authorLaurent Aimar <fenrir@videolan.org>
Tue, 17 Aug 2004 20:39:03 +0000 (20:39 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 17 Aug 2004 20:39:03 +0000 (20:39 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@35 df754926-b1dd-0310-bc7b-ec298dee348c

core/frame.c
core/macroblock.c
encoder/encoder.c
encoder/set.c

index 02a5b540f47a5cc2fa6b6bb2b55dc10ea8c1c319..eca2ab63f38e15f7300832361637e7ce55d7dbd7 100644 (file)
@@ -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;
                         }
                     }
index 4d305737c4d97bf86aa1a1f7a018fba8e728d962..a4d843de86cc29dd42abfb3fdf4b83d7c86f2b9d 100644 (file)
@@ -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* */
index f7ad61e2f2c18d031d7a7ad2438f853b6e182f2b..f5b901c66260d60fe904cc889b335ee71ff7c4bf 100644 (file)
@@ -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) */
index 94b1343ff45be28fa8ab9492a9db3873efed5910..e0c9504b2b2e6518dd9cda37ca7f43ac422b29db 100644 (file)
@@ -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;