Commit eaf2fc20 authored by Anton Mitrofanov's avatar Anton Mitrofanov

Various cosmetics of semicolon use

parent aae177c5
......@@ -3430,7 +3430,7 @@ uint8_t *x264_get_ref_msa( uint8_t *p_dst, intptr_t *p_dst_stride,
x264_mc_weight_w8_msa( p_dst, *p_dst_stride,
p_dst, *p_dst_stride,
pWeight, i_h4w );
for( i_cnt = i_h4w; i_cnt < i_height ; i_cnt++ )
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
{
uint64_t temp0;
v16i8 zero = {0};
......@@ -3666,7 +3666,7 @@ uint8_t *x264_get_ref_msa( uint8_t *p_dst, intptr_t *p_dst_stride,
pWeight, i_h4w );
p_src1 = src1_org + i_h4w * i_src_stride;
for( i_cnt = i_h4w; i_cnt < i_height ; i_cnt++ )
for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
{
uint64_t u_temp0;
v16i8 zero = {0};
......
......@@ -370,8 +370,8 @@ static ALWAYS_INLINE int x264_mb_predict_mv_direct16x16_spatial( x264_t *h, int
h->mb.i_partition = partition_col[0];
}
}
int i_mb_4x4 = b_interlaced ? 4 * (h->mb.i_b4_stride*mb_y + mb_x) : h->mb.i_b4_xy ;
int i_mb_8x8 = b_interlaced ? 2 * (h->mb.i_b8_stride*mb_y + mb_x) : h->mb.i_b8_xy ;
int i_mb_4x4 = b_interlaced ? 4 * (h->mb.i_b4_stride*mb_y + mb_x) : h->mb.i_b4_xy;
int i_mb_8x8 = b_interlaced ? 2 * (h->mb.i_b8_stride*mb_y + mb_x) : h->mb.i_b8_xy;
int8_t *l1ref0 = &h->fref[1][0]->ref[0][i_mb_8x8];
int8_t *l1ref1 = &h->fref[1][0]->ref[1][i_mb_8x8];
......
......@@ -71,7 +71,7 @@ int x264_quant_4x4_altivec( int16_t dct[16], uint16_t mf[16], uint16_t bias[16]
vec_u32_t multEvenvA, multOddvA;
vec_u16_t mfvA;
vec_u16_t biasvA;
vec_s16_t one = vec_splat_s16(1);;
vec_s16_t one = vec_splat_s16(1);
vec_s16_t nz = zero_s16v;
vector bool short mskB;
......@@ -216,7 +216,7 @@ int x264_quant_8x8_altivec( int16_t dct[64], uint16_t mf[64], uint16_t bias[64]
vec_u32_t multEvenvA, multOddvA;
vec_u16_t mfvA;
vec_u16_t biasvA;
vec_s16_t one = vec_splat_s16(1);;
vec_s16_t one = vec_splat_s16(1);
vec_s16_t nz = zero_s16v;
vector bool short mskB;
......
......@@ -863,7 +863,7 @@ static void ALWAYS_INLINE x264_cabac_block_residual_internal( x264_t *h, x264_ca
x264_cabac_encode_bypass( cb, 0 ); // sign
}
for( int i = last-1 ; i >= 0; i-- )
for( int i = last-1; i >= 0; i-- )
{
if( l[i] )
{
......
......@@ -708,7 +708,7 @@ static ALWAYS_INLINE void x264_macroblock_encode_internal( x264_t *h, int plane_
}
for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp )
{
for( int i = (p == 0 && h->mb.i_skip_intra) ? 3 : 0 ; i < 4; i++ )
for( int i = (p == 0 && h->mb.i_skip_intra) ? 3 : 0; i < 4; i++ )
{
int i_mode = h->mb.cache.intra4x4_pred_mode[x264_scan8[4*i]];
x264_mb_encode_i8x8( h, p, i, i_qp, i_mode, NULL, 1 );
......@@ -733,7 +733,7 @@ static ALWAYS_INLINE void x264_macroblock_encode_internal( x264_t *h, int plane_
}
for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp )
{
for( int i = (p == 0 && h->mb.i_skip_intra) ? 15 : 0 ; i < 16; i++ )
for( int i = (p == 0 && h->mb.i_skip_intra) ? 15 : 0; i < 16; i++ )
{
pixel *p_dst = &h->mb.pic.p_fdec[p][block_idx_xy_fdec[i]];
int i_mode = h->mb.cache.intra4x4_pred_mode[x264_scan8[i]];
......
......@@ -48,14 +48,14 @@ char **x264_split_options( const char *opt_str, const char * const *options )
while( *option && (strlen( *option ) != length || strncmp( opt, *option, length )) )
option++;
RETURN_IF_ERROR( !*option, "Invalid option '%.*s'\n", length, opt )
RETURN_IF_ERROR( !*option, "Invalid option '%.*s'\n", length, opt );
found_named = 1;
length += strcspn( opt + length, "," );
}
else
{
RETURN_IF_ERROR( opt_count >= options_count, "Too many options given\n" )
RETURN_IF_ERROR( found_named, "Ordered option given after named\n" )
RETURN_IF_ERROR( opt_count >= options_count, "Too many options given\n" );
RETURN_IF_ERROR( found_named, "Ordered option given after named\n" );
size += strlen( options[opt_count] ) + 1;
}
opt_count++;
......@@ -65,7 +65,7 @@ char **x264_split_options( const char *opt_str, const char * const *options )
int offset = 2 * (opt_count+1) * sizeof(char*);
size += offset + (opt - opt_str);
char **opts = calloc( 1, size );
RETURN_IF_ERROR( !opts, "malloc failed\n" )
RETURN_IF_ERROR( !opts, "malloc failed\n" );
#define insert_opt( src, length )\
do {\
......
......@@ -52,18 +52,18 @@ static int handle_opts( crop_hnd_t *h, video_info_t *info, char **opts, const ch
for( int i = 0; i < 4; i++ )
{
char *opt = x264_get_option( optlist[i], opts );
FAIL_IF_ERROR( !opt, "%s crop value not specified\n", optlist[i] )
FAIL_IF_ERROR( !opt, "%s crop value not specified\n", optlist[i] );
h->dims[i] = x264_otoi( opt, -1 );
FAIL_IF_ERROR( h->dims[i] < 0, "%s crop value `%s' is less than 0\n", optlist[i], opt )
FAIL_IF_ERROR( h->dims[i] < 0, "%s crop value `%s' is less than 0\n", optlist[i], opt );
int dim_mod = i&1 ? (h->csp->mod_height << info->interlaced) : h->csp->mod_width;
FAIL_IF_ERROR( h->dims[i] % dim_mod, "%s crop value `%s' is not a multiple of %d\n", optlist[i], opt, dim_mod )
FAIL_IF_ERROR( h->dims[i] % dim_mod, "%s crop value `%s' is not a multiple of %d\n", optlist[i], opt, dim_mod );
}
return 0;
}
static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x264_param_t *param, char *opt_string )
{
FAIL_IF_ERROR( x264_cli_csp_is_invalid( info->csp ), "invalid csp %d\n", info->csp )
FAIL_IF_ERROR( x264_cli_csp_is_invalid( info->csp ), "invalid csp %d\n", info->csp );
crop_hnd_t *h = calloc( 1, sizeof(crop_hnd_t) );
if( !h )
return -1;
......@@ -81,7 +81,7 @@ static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x2
h->dims[2] = info->width - h->dims[0] - h->dims[2];
h->dims[3] = info->height - h->dims[1] - h->dims[3];
FAIL_IF_ERROR( h->dims[2] <= 0 || h->dims[3] <= 0, "invalid output resolution %dx%d\n", h->dims[2], h->dims[3] )
FAIL_IF_ERROR( h->dims[2] <= 0 || h->dims[3] <= 0, "invalid output resolution %dx%d\n", h->dims[2], h->dims[3] );
if( info->width != h->dims[2] || info->height != h->dims[3] )
x264_cli_log( NAME, X264_LOG_INFO, "cropping to %dx%d\n", h->dims[2], h->dims[3] );
......
......@@ -217,13 +217,13 @@ static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info,
ret = 1;
}
FAIL_IF_ERROR( bit_depth != X264_BIT_DEPTH, "this build supports only bit depth %d\n", X264_BIT_DEPTH )
FAIL_IF_ERROR( ret, "unsupported bit depth conversion.\n" )
FAIL_IF_ERROR( bit_depth != X264_BIT_DEPTH, "this build supports only bit depth %d\n", X264_BIT_DEPTH );
FAIL_IF_ERROR( ret, "unsupported bit depth conversion.\n" );
/* only add the filter to the chain if it's needed */
if( change_fmt || bit_depth != 8 * x264_cli_csp_depth_factor( csp ) )
{
FAIL_IF_ERROR( !depth_filter_csp_is_supported(csp), "unsupported colorspace.\n" )
FAIL_IF_ERROR( !depth_filter_csp_is_supported(csp), "unsupported colorspace.\n" );
depth_hnd_t *h = x264_malloc( sizeof(depth_hnd_t) + (info->width+1)*sizeof(int16_t) );
if( !h )
......
......@@ -39,7 +39,7 @@ void x264_cli_plane_copy( uint8_t *dst, int i_dst, uint8_t *src, int i_src, int
int x264_cli_pic_copy( cli_pic_t *out, cli_pic_t *in )
{
int csp = in->img.csp & X264_CSP_MASK;
FAIL_IF_ERROR( x264_cli_csp_is_invalid( in->img.csp ), "invalid colorspace arg %d\n", in->img.csp )
FAIL_IF_ERROR( x264_cli_csp_is_invalid( in->img.csp ), "invalid colorspace arg %d\n", in->img.csp );
FAIL_IF_ERROR( in->img.csp != out->img.csp || in->img.height != out->img.height
|| in->img.width != out->img.width, "incompatible frame properties\n" );
/* copy data */
......
......@@ -265,7 +265,7 @@ static int handle_opts( const char * const *optlist, char **opts, video_info_t *
{
FAIL_IF_ERROR( 2 != sscanf( str_sar, "%u:%u", &out_sar_w, &out_sar_h ) &&
2 != sscanf( str_sar, "%u/%u", &out_sar_w, &out_sar_h ),
"invalid sar `%s'\n", str_sar )
"invalid sar `%s'\n", str_sar );
}
else
out_sar_w = out_sar_h = 1;
......@@ -275,19 +275,19 @@ static int handle_opts( const char * const *optlist, char **opts, video_info_t *
if( !strcasecmp( fittobox, "both" ) )
{
FAIL_IF_ERROR( width <= 0 || height <= 0, "invalid box resolution %sx%s\n",
x264_otos( str_width, "<unset>" ), x264_otos( str_height, "<unset>" ) )
x264_otos( str_width, "<unset>" ), x264_otos( str_height, "<unset>" ) );
}
else if( !strcasecmp( fittobox, "width" ) )
{
FAIL_IF_ERROR( width <= 0, "invalid box width `%s'\n", x264_otos( str_width, "<unset>" ) )
FAIL_IF_ERROR( width <= 0, "invalid box width `%s'\n", x264_otos( str_width, "<unset>" ) );
height = INT_MAX;
}
else if( !strcasecmp( fittobox, "height" ) )
{
FAIL_IF_ERROR( height <= 0, "invalid box height `%s'\n", x264_otos( str_height, "<unset>" ) )
FAIL_IF_ERROR( height <= 0, "invalid box height `%s'\n", x264_otos( str_height, "<unset>" ) );
width = INT_MAX;
}
else FAIL_IF_ERROR( 1, "invalid fittobox mode `%s'\n", fittobox )
else FAIL_IF_ERROR( 1, "invalid fittobox mode `%s'\n", fittobox );
/* maximally fit the new coded resolution to the box */
const x264_cli_csp_t *csp = x264_cli_get_csp( h->dst_csp );
......@@ -313,7 +313,7 @@ static int handle_opts( const char * const *optlist, char **opts, video_info_t *
if( str_width || str_height )
{
FAIL_IF_ERROR( width <= 0 || height <= 0, "invalid resolution %sx%s\n",
x264_otos( str_width, "<unset>" ), x264_otos( str_height, "<unset>" ) )
x264_otos( str_width, "<unset>" ), x264_otos( str_height, "<unset>" ) );
if( !str_sar ) /* res only -> adjust sar */
{
/* new_sar = (new_h * old_w * old_sar_w) / (old_h * new_w * old_sar_h) */
......@@ -403,7 +403,7 @@ static int check_resizer( resizer_hnd_t *h, cli_pic_t *in )
return -1;
h->buffer_allocated = 1;
}
FAIL_IF_ERROR( x264_init_sws_context( h ), "swscale init failed\n" )
FAIL_IF_ERROR( x264_init_sws_context( h ), "swscale init failed\n" );
return 0;
}
......@@ -440,7 +440,7 @@ static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x2
h->variable_input = 1;
h->dst_csp = pick_closest_supported_csp( info->csp );
FAIL_IF_ERROR( h->dst_csp == X264_CSP_NONE,
"filter get invalid input pixel format %d (colorspace %d)\n", convert_csp_to_pix_fmt( info->csp ), info->csp )
"filter get invalid input pixel format %d (colorspace %d)\n", convert_csp_to_pix_fmt( info->csp ), info->csp );
}
else
{
......@@ -479,17 +479,17 @@ static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x2
FAIL_IF_ERROR( src_pix_fmt == AV_PIX_FMT_NONE && src_pix_fmt_inv != AV_PIX_FMT_NONE,
"input colorspace %s with bit depth %d is not supported\n", av_get_pix_fmt_name( src_pix_fmt_inv ),
info->csp & X264_CSP_HIGH_DEPTH ? 16 : 8 );
FAIL_IF_ERROR( !sws_isSupportedInput( src_pix_fmt ), "input colorspace %s is not supported\n", av_get_pix_fmt_name( src_pix_fmt ) )
FAIL_IF_ERROR( !sws_isSupportedInput( src_pix_fmt ), "input colorspace %s is not supported\n", av_get_pix_fmt_name( src_pix_fmt ) );
FAIL_IF_ERROR( h->dst.pix_fmt == AV_PIX_FMT_NONE && dst_pix_fmt_inv != AV_PIX_FMT_NONE,
"input colorspace %s with bit depth %d is not supported\n", av_get_pix_fmt_name( dst_pix_fmt_inv ),
h->dst_csp & X264_CSP_HIGH_DEPTH ? 16 : 8 );
FAIL_IF_ERROR( !sws_isSupportedOutput( h->dst.pix_fmt ), "output colorspace %s is not supported\n", av_get_pix_fmt_name( h->dst.pix_fmt ) )
FAIL_IF_ERROR( !sws_isSupportedOutput( h->dst.pix_fmt ), "output colorspace %s is not supported\n", av_get_pix_fmt_name( h->dst.pix_fmt ) );
FAIL_IF_ERROR( h->dst.height != info->height && info->interlaced,
"swscale is not compatible with interlaced vertical resizing\n" )
"swscale is not compatible with interlaced vertical resizing\n" );
/* confirm that the desired resolution meets the colorspace requirements */
const x264_cli_csp_t *csp = x264_cli_get_csp( h->dst_csp );
FAIL_IF_ERROR( h->dst.width % csp->mod_width || h->dst.height % csp->mod_height,
"resolution %dx%d is not compliant with colorspace %s\n", h->dst.width, h->dst.height, csp->name )
"resolution %dx%d is not compliant with colorspace %s\n", h->dst.width, h->dst.height, csp->name );
if( h->dst.width != info->width || h->dst.height != info->height )
x264_cli_log( NAME, X264_LOG_INFO, "resizing to %dx%d\n", h->dst.width, h->dst.height );
......@@ -580,7 +580,7 @@ static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x2
}
/* pass if nothing needs to be done, otherwise fail */
FAIL_IF_ERROR( ret, "not compiled with swscale support\n" )
FAIL_IF_ERROR( ret, "not compiled with swscale support\n" );
return 0;
}
......
......@@ -67,16 +67,16 @@ static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x2
int val = x264_otoi( tok, -1 );
if( p )
{
FAIL_IF_ERROR( val <= 0, "invalid step `%s'\n", tok )
FAIL_IF_ERROR( val <= 0, "invalid step `%s'\n", tok );
h->step_size = val;
continue;
}
FAIL_IF_ERROR( val < 0 || val >= h->step_size, "invalid offset `%s'\n", tok )
FAIL_IF_ERROR( h->pattern_len >= MAX_PATTERN_SIZE, "max pattern size %d reached\n", MAX_PATTERN_SIZE )
FAIL_IF_ERROR( val < 0 || val >= h->step_size, "invalid offset `%s'\n", tok );
FAIL_IF_ERROR( h->pattern_len >= MAX_PATTERN_SIZE, "max pattern size %d reached\n", MAX_PATTERN_SIZE );
offsets[h->pattern_len++] = val;
}
FAIL_IF_ERROR( !h->step_size, "no step size provided\n" )
FAIL_IF_ERROR( !h->pattern_len, "no offsets supplied\n" )
FAIL_IF_ERROR( !h->step_size, "no step size provided\n" );
FAIL_IF_ERROR( !h->pattern_len, "no offsets supplied\n" );
h->pattern = malloc( h->pattern_len * sizeof(int) );
if( !h->pattern )
......
......@@ -159,9 +159,9 @@ static float get_avs_version( avs_hnd_t *h )
#if USE_AVXSYNTH
return 2.58f;
#else
FAIL_IF_ERROR( !h->func.avs_function_exists( h->env, "VersionNumber" ), "VersionNumber does not exist\n" )
FAIL_IF_ERROR( !h->func.avs_function_exists( h->env, "VersionNumber" ), "VersionNumber does not exist\n" );
AVS_Value ver = h->func.avs_invoke( h->env, "VersionNumber", avs_new_value_array( NULL, 0 ), NULL );
FAIL_IF_ERROR( avs_is_error( ver ), "unable to determine avisynth version: %s\n", avs_as_error( ver ) )
FAIL_IF_ERROR( avs_is_error( ver ), "unable to determine avisynth version: %s\n", avs_as_error( ver ) );
FAIL_IF_ERROR( !avs_is_float( ver ), "VersionNumber did not return a float value\n" );
float ret = avs_as_float( ver );
h->func.avs_release_value( ver );
......@@ -181,7 +181,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
avs_hnd_t *h = malloc( sizeof(avs_hnd_t) );
if( !h )
return -1;
FAIL_IF_ERROR( x264_avs_load_library( h ), "failed to load avisynth\n" )
FAIL_IF_ERROR( x264_avs_load_library( h ), "failed to load avisynth\n" );
h->env = h->func.avs_create_script_environment( AVS_INTERFACE_25 );
if( h->func.avs_get_error )
{
......@@ -208,7 +208,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
if( !strcasecmp( filename_ext, "avs" ) )
{
res = h->func.avs_invoke( h->env, "Import", arg, NULL );
FAIL_IF_ERROR( avs_is_error( res ), "%s\n", avs_as_string( res ) )
FAIL_IF_ERROR( avs_is_error( res ), "%s\n", avs_as_string( res ) );
/* check if the user is using a multi-threaded script and apply distributor if necessary.
adapted from avisynth's vfw interface */
AVS_Value mt_test = h->func.avs_invoke( h->env, "GetMTMode", avs_new_value_bool( 0 ), NULL );
......@@ -248,18 +248,18 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
}
x264_cli_printf( X264_LOG_INFO, "failed\n" );
}
FAIL_IF_ERROR( !filter[i], "unable to find source filter to open `%s'\n", psz_filename )
FAIL_IF_ERROR( !filter[i], "unable to find source filter to open `%s'\n", psz_filename );
}
FAIL_IF_ERROR( !avs_is_clip( res ), "`%s' didn't return a video clip\n", psz_filename )
FAIL_IF_ERROR( !avs_is_clip( res ), "`%s' didn't return a video clip\n", psz_filename );
h->clip = h->func.avs_take_clip( res, h->env );
const AVS_VideoInfo *vi = h->func.avs_get_video_info( h->clip );
FAIL_IF_ERROR( !avs_has_video( vi ), "`%s' has no video data\n", psz_filename )
FAIL_IF_ERROR( !avs_has_video( vi ), "`%s' has no video data\n", psz_filename );
/* if the clip is made of fields instead of frames, call weave to make them frames */
if( avs_is_field_based( vi ) )
{
x264_cli_log( "avs", X264_LOG_WARNING, "detected fieldbased (separated) input, weaving to frames\n" );
AVS_Value tmp = h->func.avs_invoke( h->env, "Weave", res, NULL );
FAIL_IF_ERROR( avs_is_error( tmp ), "couldn't weave fields into frames\n" )
FAIL_IF_ERROR( avs_is_error( tmp ), "couldn't weave fields into frames\n" );
res = update_clip( h, &vi, tmp, res );
info->interlaced = 1;
info->tff = avs_is_tff( vi );
......@@ -267,7 +267,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
#if !HAVE_SWSCALE
/* if swscale is not available, convert the CSP if necessary */
FAIL_IF_ERROR( avs_version < 2.6f && (opt->output_csp == X264_CSP_I422 || opt->output_csp == X264_CSP_I444),
"avisynth >= 2.6 is required for i422/i444 output\n" )
"avisynth >= 2.6 is required for i422/i444 output\n" );
if( (opt->output_csp == X264_CSP_I420 && !avs_is_yv12( vi )) || (opt->output_csp == X264_CSP_I422 && !avs_is_yv16( vi )) ||
(opt->output_csp == X264_CSP_I444 && !avs_is_yv24( vi )) || (opt->output_csp == X264_CSP_RGB && !avs_is_rgb( vi )) )
{
......@@ -277,11 +277,11 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
opt->output_csp == X264_CSP_I444 ? "YV24" : "RGB";
x264_cli_log( "avs", X264_LOG_WARNING, "converting input clip to %s\n", csp );
FAIL_IF_ERROR( opt->output_csp < X264_CSP_I444 && (vi->width&1),
"input clip width not divisible by 2 (%dx%d)\n", vi->width, vi->height )
"input clip width not divisible by 2 (%dx%d)\n", vi->width, vi->height );
FAIL_IF_ERROR( opt->output_csp == X264_CSP_I420 && info->interlaced && (vi->height&3),
"input clip height not divisible by 4 (%dx%d)\n", vi->width, vi->height )
"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 )
"input clip height not divisible by 2 (%dx%d)\n", vi->width, vi->height );
char conv_func[14];
snprintf( conv_func, sizeof(conv_func), "ConvertTo%s", csp );
char matrix[7] = "";
......@@ -302,7 +302,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
arg_arr[1] = avs_new_value_bool( info->interlaced );
arg_arr[2] = avs_new_value_string( matrix );
AVS_Value res2 = h->func.avs_invoke( h->env, conv_func, avs_new_value_array( arg_arr, arg_count ), arg_name );
FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert input clip to %s\n", csp )
FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert input clip to %s\n", csp );
res = update_clip( h, &vi, res2, res );
}
/* if swscale is not available, change the range if necessary. This only applies to YUV-based CSPs however */
......@@ -315,7 +315,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
arg_arr[1] = avs_new_value_string( levels );
const char *arg_name[] = { NULL, "levels" };
AVS_Value res2 = h->func.avs_invoke( h->env, "ColorYUV", avs_new_value_array( arg_arr, 2 ), arg_name );
FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert range: %s\n", avs_as_error( res2 ) )
FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert range: %s\n", avs_as_error( res2 ) );
res = update_clip( h, &vi, res2, res );
// notification that the input range has changed to the desired one
opt->input_range = opt->output_range;
......@@ -381,7 +381,7 @@ static int read_frame( cli_pic_t *pic, hnd_t handle, int i_frame )
return -1;
AVS_VideoFrame *frm = pic->opaque = h->func.avs_get_frame( h->clip, i_frame );
const char *err = h->func.avs_clip_get_error( h->clip );
FAIL_IF_ERROR( err, "%s occurred while reading frame %d\n", err, i_frame )
FAIL_IF_ERROR( err, "%s occurred while reading frame %d\n", err, i_frame );
for( int i = 0; i < pic->img.planes; i++ )
{
/* explicitly cast away the const attribute to avoid a warning */
......
......@@ -102,14 +102,14 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
if( !idx )
{
FFMS_Indexer *indexer = FFMS_CreateIndexer( psz_filename, &e );
FAIL_IF_ERROR( !indexer, "could not create indexer\n" )
FAIL_IF_ERROR( !indexer, "could not create indexer\n" );
if( opt->progress )
FFMS_SetProgressCallback( indexer, update_progress, &h->time );
idx = FFMS_DoIndexing2( indexer, FFMS_IEH_ABORT, &e );
fprintf( stderr, "%*c", PROGRESS_LENGTH+1, '\r' );
FAIL_IF_ERROR( !idx, "could not create index\n" )
FAIL_IF_ERROR( !idx, "could not create index\n" );
if( opt->index_file && FFMS_WriteIndex( opt->index_file, idx, &e ) )
x264_cli_log( "ffms", X264_LOG_WARNING, "could not write index file\n" );
......@@ -120,8 +120,8 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
h->video_source = FFMS_CreateVideoSource( psz_filename, trackno, idx, 1, seekmode, &e );
FFMS_DestroyIndex( idx );
FAIL_IF_ERROR( trackno < 0, "could not find video track\n" )
FAIL_IF_ERROR( !h->video_source, "could not create video source\n" )
FAIL_IF_ERROR( trackno < 0, "could not find video track\n" );
FAIL_IF_ERROR( !h->video_source, "could not create video source\n" );
const FFMS_VideoProperties *videop = FFMS_GetVideoProperties( h->video_source );
info->num_frames = h->num_frames = videop->NumFrames;
......@@ -134,7 +134,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
info->thread_safe = 0;
const FFMS_Frame *frame = FFMS_GetFrame( h->video_source, 0, &e );
FAIL_IF_ERROR( !frame, "could not read frame 0\n" )
FAIL_IF_ERROR( !frame, "could not read frame 0\n" );
info->fullrange = 0;
info->width = frame->EncodedWidth;
......@@ -185,7 +185,7 @@ static int read_frame( cli_pic_t *pic, hnd_t handle, int i_frame )
FFMS_ErrorInfo e;
e.BufferSize = 0;
const FFMS_Frame *frame = FFMS_GetFrame( h->video_source, i_frame, &e );
FAIL_IF_ERROR( !frame, "could not read frame %d \n", i_frame )
FAIL_IF_ERROR( !frame, "could not read frame %d \n", i_frame );
memcpy( pic->img.stride, frame->Linesize, sizeof(pic->img.stride) );
memcpy( pic->img.plane, frame->Data, sizeof(pic->img.plane) );
......@@ -194,7 +194,7 @@ static int read_frame( cli_pic_t *pic, hnd_t handle, int i_frame )
{
const FFMS_FrameInfo *info = FFMS_GetFrameInfo( h->track, i_frame );
FAIL_IF_ERROR( info->PTS == AV_NOPTS_VALUE, "invalid timestamp. "
"Use --force-cfr and specify a framerate with --fps\n" )
"Use --force-cfr and specify a framerate with --fps\n" );
pic->pts = info->PTS >> h->reduce_pts;
pic->duration = 0;
......
......@@ -168,15 +168,15 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
if( opt->format )
FAIL_IF_ERROR( !(format = av_find_input_format( opt->format )), "unknown file format: %s\n", opt->format );
FAIL_IF_ERROR( avformat_open_input( &h->lavf, psz_filename, format, &options ), "could not open input file\n" )
FAIL_IF_ERROR( avformat_open_input( &h->lavf, psz_filename, format, &options ), "could not open input file\n" );
if( options )
av_dict_free( &options );
FAIL_IF_ERROR( avformat_find_stream_info( h->lavf, NULL ) < 0, "could not find input stream info\n" )
FAIL_IF_ERROR( avformat_find_stream_info( h->lavf, NULL ) < 0, "could not find input stream info\n" );
int i = 0;
while( i < h->lavf->nb_streams && h->lavf->streams[i]->codec->codec_type != AVMEDIA_TYPE_VIDEO )
i++;
FAIL_IF_ERROR( i == h->lavf->nb_streams, "could not find video stream\n" )
FAIL_IF_ERROR( i == h->lavf->nb_streams, "could not find video stream\n" );
h->stream_id = i;
h->next_frame = 0;
AVCodecContext *c = h->lavf->streams[i]->codec;
......@@ -188,13 +188,13 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
info->thread_safe = 0;
h->vfr_input = info->vfr;
FAIL_IF_ERROR( avcodec_open2( c, avcodec_find_decoder( c->codec_id ), NULL ),
"could not find decoder for video stream\n" )
"could not find decoder for video stream\n" );
/* prefetch the first frame and set/confirm flags */
h->first_pic = malloc( sizeof(cli_pic_t) );
FAIL_IF_ERROR( !h->first_pic || lavf_input.picture_alloc( h->first_pic, h, X264_CSP_OTHER, info->width, info->height ),
"malloc failed\n" )
else if( read_frame_internal( h->first_pic, h, 0, info ) )
"malloc failed\n" );
if( read_frame_internal( h->first_pic, h, 0, info ) )
return -1;
info->width = c->width;
......
......@@ -54,7 +54,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
}
else
sscanf( opt->resolution, "%dx%d", &info->width, &info->height );
FAIL_IF_ERROR( !info->width || !info->height, "raw input requires a resolution.\n" )
FAIL_IF_ERROR( !info->width || !info->height, "raw input requires a resolution.\n" );
if( opt->colorspace )
{
for( info->csp = X264_CSP_CLI_MAX-1; info->csp > X264_CSP_NONE; info->csp-- )
......
......@@ -49,7 +49,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
{
thread_hnd_t *h = malloc( sizeof(thread_hnd_t) );
FAIL_IF_ERR( !h || cli_input.picture_alloc( &h->pic, *p_handle, info->csp, info->width, info->height ),
"x264", "malloc failed\n" )
"x264", "malloc failed\n" );
h->input = cli_input;
h->p_handle = *p_handle;
h->next_frame = -1;
......
......@@ -61,7 +61,7 @@ static double correct_fps( double fps, timecode_hnd_t *h )
fps_den = i * h->timebase_num;
fps_num = round( fps_den * fps_sig ) * exponent;
FAIL_IF_ERROR( fps_num > UINT32_MAX, "tcfile fps correction failed.\n"
" Specify an appropriate timebase manually or remake tcfile.\n" )
" Specify an appropriate timebase manually or remake tcfile.\n" );
if( fabs( ((double)fps_num / fps_den) / exponent - fps_sig ) < DOUBLE_EPSILON )
break;
++i;
......@@ -87,7 +87,7 @@ static int try_mkv_timebase_den( double *fpss, timecode_hnd_t *h, int loop_num )
fps_den = round( MKV_TIMEBASE_DEN / fps_sig ) / exponent;
h->timebase_num = fps_den && h->timebase_num ? gcd( h->timebase_num, fps_den ) : fps_den;
FAIL_IF_ERROR( h->timebase_num > UINT32_MAX || !h->timebase_num, "automatic timebase generation failed.\n"
" Specify timebase manually.\n" )
" Specify timebase manually.\n" );
}
return 0;
}
......@@ -100,7 +100,7 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info
double *fpss = NULL;
ret = fscanf( tcfile_in, "# timecode format v%d", &tcfv );
FAIL_IF_ERROR( ret != 1 || (tcfv != 1 && tcfv != 2), "unsupported timecode format\n" )
FAIL_IF_ERROR( ret != 1 || (tcfv != 1 && tcfv != 2), "unsupported timecode format\n" );
#define NO_TIMECODE_LINE (buff[0] == '#' || buff[0] == '\n' || buff[0] == '\r')
if( tcfv == 1 )
{
......@@ -115,10 +115,10 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info
if( NO_TIMECODE_LINE )
continue;
FAIL_IF_ERROR( sscanf( buff, "assume %lf", &h->assume_fps ) != 1 && sscanf( buff, "Assume %lf", &h->assume_fps ) != 1,
"tcfile parsing error: assumed fps not found\n" )
"tcfile parsing error: assumed fps not found\n" );
break;
}
FAIL_IF_ERROR( h->assume_fps <= 0, "invalid assumed fps %.6f\n", h->assume_fps )
FAIL_IF_ERROR( h->assume_fps <= 0, "invalid assumed fps %.6f\n", h->assume_fps );
file_pos = ftell( tcfile_in );
h->stored_pts_num = 0;
......@@ -131,9 +131,9 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info
continue;
}
ret = sscanf( buff, "%d,%d,%lf", &start, &end, &seq_fps );
FAIL_IF_ERROR( ret != 3 && ret != EOF, "invalid input tcfile\n" )
FAIL_IF_ERROR( ret != 3 && ret != EOF, "invalid input tcfile\n" );
FAIL_IF_ERROR( start > end || start <= prev_start || end <= prev_end || seq_fps <= 0,
"invalid input tcfile at line %d: %s\n", num, buff )
"invalid input tcfile at line %d: %s\n", num, buff );
prev_start = start;
prev_end = end;
if( h->auto_timebase_den || h->auto_timebase_num )
......@@ -234,7 +234,7 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info
h->stored_pts_num++;
}
timecodes_num = h->stored_pts_num;
FAIL_IF_ERROR( !timecodes_num, "input tcfile doesn't have any timecodes!\n" )
FAIL_IF_ERROR( !timecodes_num, "input tcfile doesn't have any timecodes!\n" );
fseek( tcfile_in, file_pos, SEEK_SET );
timecodes = malloc( timecodes_num * sizeof(double) );
......@@ -246,7 +246,7 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info
{
ret = sscanf( buff, "%lf", &timecodes[0] );
timecodes[0] *= 1e-3; /* Timecode format v2 is expressed in milliseconds. */
FAIL_IF_ERROR( ret != 1, "invalid input tcfile for frame 0\n" )
FAIL_IF_ERROR( ret != 1, "invalid input tcfile for frame 0\n" );
for( num = 1; num < timecodes_num && fgets( buff, sizeof(buff), tcfile_in ) != NULL; )
{
if( NO_TIMECODE_LINE )
......@@ -254,11 +254,11 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info
ret = sscanf( buff, "%lf", &timecodes[num] );
timecodes[num] *= 1e-3; /* Timecode format v2 is expressed in milliseconds. */
FAIL_IF_ERROR( ret != 1 || timecodes[num] <= timecodes[num - 1],
"invalid input tcfile for frame %d\n", num )
"invalid input tcfile for frame %d\n", num );
++num;
}
}
FAIL_IF_ERROR( num < timecodes_num, "failed to read input tcfile for frame %d", num )
FAIL_IF_ERROR( num < timecodes_num, "failed to read input tcfile for frame %d", num );
if( timecodes_num == 1 )
h->timebase_den = info->fps_num;
......@@ -314,7 +314,7 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info
x264_cli_log( "timecode", X264_LOG_INFO, "automatic timebase generation %"PRIu64"/%"PRIu64"\n", h->timebase_num, h->timebase_den );
}
else FAIL_IF_ERROR( h->timebase_den > UINT32_MAX || !h->timebase_den, "automatic timebase generation failed.\n"
" Specify an appropriate timebase manually.\n" )
" Specify an appropriate timebase manually.\n" );
h->pts = malloc( h->stored_pts_num * sizeof(int64_t) );
if( !h->pts )
......@@ -322,7 +322,7 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info
for( num = 0; num < h->stored_pts_num; num++ )
{
h->pts[num] = timecodes[num] * ((double)h->timebase_den / h->timebase_num) + 0.5;
FAIL_IF_ERROR( num > 0 && h->pts[num] <= h->pts[num - 1], "invalid timebase or timecode for frame %d\n", num )
FAIL_IF_ERROR( num > 0 && h->pts[num] <= h->pts[num - 1], "invalid timebase or timecode for frame %d\n", num );
}
free( timecodes );
......@@ -344,7 +344,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
int ret = 0;
FILE *tcfile_in;
timecode_hnd_t *h = malloc( sizeof(timecode_hnd_t) );
FAIL_IF_ERROR( !h, "malloc failed\n" )
FAIL_IF_ERROR( !h, "malloc failed\n" );
h->input = cli_input;
h->p_handle = *p_handle;
h->pts = NULL;
......@@ -357,7 +357,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
h->timebase_den = 0; /* set later by auto timebase generation */
}
FAIL_IF_ERROR( h->timebase_num > UINT32_MAX || h->timebase_den > UINT32_MAX,
"timebase you specified exceeds H.264 maximum\n" )
"timebase you specified exceeds H.264 maximum\n" );
}
h->auto_timebase_num = !ret;
h->auto_timebase_den = ret < 2;
......@@ -367,8 +367,8 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
h->timebase_den = 0; /* set later by auto timebase generation */
tcfile_in = x264_fopen( psz_filename, "rb" );
FAIL_IF_ERROR( !tcfile_in, "can't open `%s'\n", psz_filename )
else if( !x264_is_regular_file( tcfile_in ) )
FAIL_IF_ERROR( !tcfile_in, "can't open `%s'\n", psz_filename );
if( !x264_is_regular_file( tcfile_in ) )
{
x264_cli_log( "timecode", X264_LOG_ERROR, "tcfile input incompatible with non-regular file `%s'\n", psz_filename );
fclose( tcfile_in );
......
......@@ -99,8 +99,8 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
break;
}
}
FAIL_IF_ERROR( strncmp( header, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1 ), "bad sequence header magic\n" )
FAIL_IF_ERROR( i == MAX_YUV4_HEADER, "bad sequence header length\n" )
FAIL_IF_ERROR( strncmp( header, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1 ), "bad sequence header magic\n" );
FAIL_IF_ERROR( i == MAX_YUV4_HEADER, "bad sequence header length\n" );
/* Scan properties */
header_end = &header[i+1]; /* Include space */
......@@ -187,7 +187,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
h->bit_depth = 8;
}
FAIL_IF_ERROR( colorspace <= X264_CSP_NONE || colorspace >= X264_CSP_MAX, "colorspace unhandled\n" )
FAIL_IF_ERROR( colorspace <= X264_CSP_NONE || colorspace >= X264_CSP_MAX, "colorspace unhandled\n" );
FAIL_IF_ERROR( h->bit_depth < 8 || h->bit_depth > 16, "unsupported bit depth `%d'\n", h->bit_depth );
info->thread_safe = 1;
......@@ -215,7 +215,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
int len = 1;
while( len <= MAX_FRAME_HEADER && fgetc( h->fh ) != '\n' )
len++;
FAIL_IF_ERROR( len > MAX_FRAME_HEADER || len < sizeof(Y4M_FRAME_MAGIC), "bad frame header length\n" )
FAIL_IF_ERROR( len > MAX_FRAME_HEADER || len < sizeof(Y4M_FRAME_MAGIC), "bad frame header length\n" );
h->frame_header_len = len;
h->frame_size += len;
......@@ -252,7 +252,7 @@ static int read_frame_internal( cli_pic_t *pic, y4m_hnd_t *h, int bit_depth_uc )
* produces y4m files with variable-length frame headers so just error out if that happens. */
while( i <= h->frame_header_len && header[i-1] != '\n' )
i++;
FAIL_IF_ERROR( i != h->frame_header_len, "bad frame header length\n" )
FAIL_IF_ERROR( i != h->frame_header_len, "bad frame header length\n" );
}
else
{
......@@ -261,9 +261,9 @@ static int read_frame_internal( cli_pic_t *pic, y4m_hnd_t *h, int bit_depth_uc )
return -1;
while( i <= MAX_FRAME_HEADER && fgetc( h->fh ) != '\n' )
i++;
FAIL_IF_ERROR( i > MAX_FRAME_HEADER, "bad frame header length\n" )
FAIL_IF_ERROR( i > MAX_FRAME_HEADER, "bad frame header length\n" );
}
FAIL_IF_ERROR( memcmp( header, Y4M_FRAME_MAGIC, slen ), "bad frame header magic\n" )
FAIL_IF_ERROR( memcmp( header, Y4M_FRAME_MAGIC, slen ), "bad frame header magic\n" );
for( i = 0; i < pic->img.planes; i++ )
{
......
......@@ -245,7 +245,7 @@ static int mk_write_bin( mk_context *c, unsigned id, const void *data, unsigned
{
CHECK( mk_write_id( c, id ) );
CHECK( mk_write_size( c, size ) );
CHECK( mk_append_context_data( c, data, size ) ) ;
CHECK( mk_append_context_data( c, data, size ) );
return 0;
}
......
......@@ -171,7 +171,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, cli_output_opt_t *opt
return -1;
int b_regular = x264_is_regular_file( fh );
fclose( fh );
FAIL_IF_ERR( !b_regular, "mp4", "MP4 output is incompatible with non-regular file `%s'\n", psz_filename )
FAIL_IF_ERR( !b_regular, "mp4", "MP4 output is incompatible with non-regular file `%s'\n", psz_filename );
mp4_hnd_t *p_mp4 = calloc( 1, sizeof(mp4_hnd_t) );
if( !p_mp4 )
......@@ -180,7 +180,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, cli_output_opt_t *opt
#ifdef _WIN32
/* GPAC doesn't support Unicode filenames. */
char ansi_filename[MAX_PATH];
FAIL_IF_ERR( !x264_ansi_filename( psz_filename, ansi_filename, MAX_PATH, 1 ), "mp4", "invalid ansi filename\n" )
FAIL_IF_ERR( !x264_ansi_filename( psz_filename, ansi_filename, MAX_PATH, 1 ), "mp4", "invalid ansi filename\n" );
p_mp4->p_file = gf_isom_open( ansi_filename, GF_ISOM_OPEN_WRITE, NULL );
#else
p_mp4->p_file = gf_isom_open( psz_filename, GF_ISOM_OPEN_WRITE, NULL );
......@@ -210,7 +210,7 @@ static int set_param( hnd_t handle, x264_param_t *p_param )
p_mp4->i_time_res = (uint64_t)p_param->i_timebase_den * p_mp4->i_dts_compress_multiplier;
p_mp4->i_time_inc = (uint64_t)p_param->i_timebase_num * p_mp4->i_dts_compress_multiplier;