From 4c8ccfe6de4a44cd46bcaf1fc17ae90bfe34d958 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Sun, 2 Oct 2005 20:12:46 +0000 Subject: [PATCH] cosmetics git-svn-id: svn://svn.videolan.org/x264/trunk@312 df754926-b1dd-0310-bc7b-ec298dee348c --- encoder/encoder.c | 1 + encoder/ratecontrol.c | 13 ++----------- matroska.h | 2 +- x264.c | 22 +++++++++++----------- x264.h | 12 ++++++------ 5 files changed, 21 insertions(+), 29 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index afed92eb..4a4f9b8e 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -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; diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index c6b78dc0..164b4fb9 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -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; diff --git a/matroska.h b/matroska.h index 11812cab..ee95d0b1 100644 --- a/matroska.h +++ b/matroska.h @@ -1,5 +1,5 @@ /***************************************************************************** - * matroska.c: + * matroska.h: ***************************************************************************** * Copyright (C) 2005 x264 project * $Id: $ diff --git a/x264.c b/x264.c index b1fdc4c0..fe5057f2 100644 --- 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 843d09fd..741b2f7d 100644 --- 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 ); -- 2.47.3