Commit f04062e6 authored by Henrik Gramner's avatar Henrik Gramner Committed by Anton Mitrofanov
Browse files

Silence various static analyzer warnings

Those are false positives, but it doesn't hurt to get rid of them.
parent b1cbf7eb
......@@ -582,7 +582,6 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
int errortype = X264_PARAM_BAD_VALUE;
int name_was_bool;
int value_was_null = !value;
int i;
if( !name )
return X264_PARAM_BAD_NAME;
......@@ -603,10 +602,11 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
name = name_buf;
}
if( (!strncmp( name, "no-", 3 ) && (i = 3)) ||
(!strncmp( name, "no", 2 ) && (i = 2)) )
if( !strncmp( name, "no", 2 ) )
{
name += i;
name += 2;
if( name[0] == '-' )
name++;
value = atobool(value) ? "false" : "true";
}
name_was_bool = 0;
......@@ -628,7 +628,9 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
p->cpu = 0;
for( init=buf; (tok=strtok_r(init, ",", &saveptr)); init=NULL )
{
for( i=0; x264_cpu_names[i].flags && strcasecmp(tok, x264_cpu_names[i].name); i++ );
int i = 0;
while( x264_cpu_names[i].flags && strcasecmp(tok, x264_cpu_names[i].name) )
i++;
p->cpu |= x264_cpu_names[i].flags;
if( !x264_cpu_names[i].flags )
b_error = 1;
......
......@@ -895,9 +895,6 @@ struct x264_t
/* stats */
struct
{
/* Current frame stats */
x264_frame_stat_t frame;
/* Cumulated stats */
/* per slice info */
......@@ -927,6 +924,8 @@ struct x264_t
/* num p-frames weighted */
int i_wpred[2];
/* Current frame stats */
x264_frame_stat_t frame;
} stat;
/* 0 = luma 4x4, 1 = luma 8x8, 2 = chroma 4x4, 3 = chroma 8x8 */
......
......@@ -1010,9 +1010,9 @@ static int x264_validate_parameters( x264_t *h, int b_open )
h->param.i_fps_num = 25;
h->param.i_fps_den = 1;
}
float fps = (float) h->param.i_fps_num / h->param.i_fps_den;
float fps = (float)h->param.i_fps_num / h->param.i_fps_den;
if( h->param.i_keyint_min == X264_KEYINT_MIN_AUTO )
h->param.i_keyint_min = X264_MIN( h->param.i_keyint_max / 10, fps );
h->param.i_keyint_min = X264_MIN( h->param.i_keyint_max / 10, (int)fps );
h->param.i_keyint_min = x264_clip3( h->param.i_keyint_min, 1, h->param.i_keyint_max/2+1 );
h->param.rc.i_lookahead = x264_clip3( h->param.rc.i_lookahead, 0, X264_LOOKAHEAD_MAX );
{
......@@ -3043,9 +3043,8 @@ static void x264_thread_sync_context( x264_t *dst, x264_t *src )
static void x264_thread_sync_stat( x264_t *dst, x264_t *src )
{
if( dst == src )
return;
memcpy( &dst->stat.i_frame_count, &src->stat.i_frame_count, sizeof(dst->stat) - sizeof(dst->stat.frame) );
if( dst != src )
memcpy( &dst->stat, &src->stat, offsetof(x264_t, stat.frame) - offsetof(x264_t, stat) );
}
static void *x264_slices_write( x264_t *h )
......
......@@ -707,10 +707,11 @@ void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc,
sad_thresh = bsad*sad_thresh>>3;
while( nmvsad > limit*2 && sad_thresh > bsad )
{
int i;
int i = 0;
// halve the range if the domain is too large... eh, close enough
sad_thresh = (sad_thresh + bsad) >> 1;
for( i = 0; i < nmvsad && mvsads[i].sad <= sad_thresh; i++ );
while( i < nmvsad && mvsads[i].sad <= sad_thresh )
i++;
for( int j = i; j < nmvsad; j++ )
{
uint32_t sad;
......
......@@ -283,8 +283,8 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
"input clip height not divisible by 4 (%dx%d)\n", vi->width, vi->height )
FAIL_IF_ERROR( (opt->output_csp == X264_CSP_I420 || info->interlaced) && (vi->height&1),
"input clip height not divisible by 2 (%dx%d)\n", vi->width, vi->height )
char conv_func[14] = { "ConvertTo" };
strcat( conv_func, csp );
char conv_func[14];
snprintf( conv_func, sizeof(conv_func), "ConvertTo%s", csp );
char matrix[7] = "";
int arg_count = 2;
/* if doing a rgb <-> yuv conversion then range is handled via 'matrix'. though it's only supported in 2.56+ */
......@@ -292,8 +292,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
{
// if converting from yuv, then we specify the matrix for the input, otherwise use the output's.
int use_pc_matrix = avs_is_yuv( vi ) ? opt->input_range == RANGE_PC : opt->output_range == RANGE_PC;
strcpy( matrix, use_pc_matrix ? "PC." : "Rec" );
strcat( matrix, "601" ); /* FIXME: use correct coefficients */
snprintf( matrix, sizeof(matrix), "%s601", use_pc_matrix ? "PC." : "Rec" ); /* FIXME: use correct coefficients */
arg_count++;
// notification that the input range has changed to the desired one
opt->input_range = opt->output_range;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment