cosmetics
authorLoren Merritt <pengvado@videolan.org>
Sun, 2 Oct 2005 20:12:46 +0000 (20:12 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sun, 2 Oct 2005 20:12:46 +0000 (20:12 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@312 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/encoder.c
encoder/ratecontrol.c
matroska.h
x264.c
x264.h

index afed92e..4a4f9b8 100644 (file)
@@ -389,6 +389,7 @@ static int x264_validate_parameters( x264_t *h )
         h->mb.b_lossless = 1;
         h->param.analyse.b_transform_8x8 = 0;
         h->param.i_cqm_preset = X264_CQM_FLAT;
+        h->param.psz_cqm_file = NULL;
         h->param.rc.f_ip_factor = 1;
         h->param.rc.f_pb_factor = 1;
         h->param.analyse.b_psnr = 0;
index c6b78dc..164b4fb 100644 (file)
@@ -263,25 +263,16 @@ int x264_ratecontrol_new( x264_t *h )
     /* Load stat file and init 2pass algo */
     if( h->param.rc.b_stat_read )
     {
-        int stats_size;
         char *p, *stats_in;
-        FILE *stats_file;
 
         /* read 1st pass stats */
         assert( h->param.rc.psz_stat_in );
-        stats_file = fopen( h->param.rc.psz_stat_in, "rb");
-        if(!stats_file)
+        stats_in = x264_slurp_file( h->param.rc.psz_stat_in );
+        if( !stats_in )
         {
             x264_log(h, X264_LOG_ERROR, "ratecontrol_init: can't open stats file\n");
             return -1;
         }
-        // FIXME: error checking
-        fseek(stats_file, 0, SEEK_END);
-        stats_size = ftell(stats_file);
-        fseek(stats_file, 0, SEEK_SET);
-        stats_in = x264_malloc(stats_size+10);
-        fread(stats_in, 1, stats_size, stats_file);
-        fclose(stats_file);
 
         /* find number of pics */
         p = stats_in;
index 11812ca..ee95d0b 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * matroska.c:
+ * matroska.h:
  *****************************************************************************
  * Copyright (C) 2005 x264 project
  * $Id: $
diff --git a/x264.c b/x264.c
index b1fdc4c..fe5057f 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -567,7 +567,7 @@ static int  Parse( int argc, char **argv,
             case OPT_SEEK:
                 opt->i_seek = atoi( optarg );
                 break;
-            case'o':
+            case 'o':
                 if( !strncasecmp(optarg + strlen(optarg) - 4, ".mp4", 4) )
                 {
 #ifdef MP4_OUTPUT
@@ -581,14 +581,14 @@ static int  Parse( int argc, char **argv,
                     return -1;
 #endif
                 }
-        else if( !strncasecmp(optarg + strlen(optarg) - 4, ".mkv", 4) )
-        {
-            p_open_outfile = open_file_mkv;
+                else if( !strncasecmp(optarg + strlen(optarg) - 4, ".mkv", 4) )
+                {
+                    p_open_outfile = open_file_mkv;
                     p_write_nalu = write_nalu_mkv;
                     p_set_outfile_param = set_param_mkv;
                     p_set_eop = set_eop_mkv;
                     p_close_outfile = close_file_mkv;
-        }
+                }
                 if( !strcmp(optarg, "-") )
                     opt->hout = stdout;
                 else if( p_open_outfile( optarg, &opt->hout ) )
@@ -1720,7 +1720,7 @@ static int set_param_mkv( hnd_t handle, x264_param_t *p_param )
 
     if( dw > 0 && dh > 0 )
     {
-       int64_t a = dw, b = dh;
+        int64_t a = dw, b = dh;
 
         for (;;)
         {
@@ -1731,8 +1731,8 @@ static int set_param_mkv( hnd_t handle, x264_param_t *p_param )
             b = c;
         }
 
-       dw /= b;
-       dh /= b;
+        dw /= b;
+        dh /= b;
     }
 
     p_mkv->d_width = (int)dw;
@@ -1781,7 +1781,7 @@ static int write_nalu_mkv( hnd_t handle, uint8_t *p_nalu, int i_size )
         if( !p_mkv->b_writing_frame )
         {
             if( mk_startFrame(p_mkv->w) < 0 )
-               return -1;
+                return -1;
             p_mkv->b_writing_frame = 1;
         }
         psize = i_size - 4 ;
@@ -1789,8 +1789,8 @@ static int write_nalu_mkv( hnd_t handle, uint8_t *p_nalu, int i_size )
         dsize[1] = psize >> 8;
         dsize[2] = psize;
         if( mk_addFrameData(p_mkv->w, dsize, 3) < 0 ||
-           mk_addFrameData(p_mkv->w, p_nalu + 4, i_size - 4) < 0 )
-           return -1;
+            mk_addFrameData(p_mkv->w, p_nalu + 4, i_size - 4) < 0 )
+            return -1;
         break;
 
     default:
diff --git a/x264.h b/x264.h
index 843d09f..741b2f7 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -154,12 +154,12 @@ typedef struct
 
     int         i_cqm_preset;
     char        *psz_cqm_file;      /* JM format */
-    int8_t      cqm_4iy[16];        /* used only if i_cqm_preset == X264_CQM_CUSTOM */
-    int8_t      cqm_4ic[16];
-    int8_t      cqm_4py[16];
-    int8_t      cqm_4pc[16];
-    int8_t      cqm_8iy[64];
-    int8_t      cqm_8py[64];
+    uint8_t     cqm_4iy[16];        /* used only if i_cqm_preset == X264_CQM_CUSTOM */
+    uint8_t     cqm_4ic[16];
+    uint8_t     cqm_4py[16];
+    uint8_t     cqm_4pc[16];
+    uint8_t     cqm_8iy[64];
+    uint8_t     cqm_8py[64];
 
     /* Log */
     void        (*pf_log)( void *, int i_level, const char *psz, va_list );