svc example: override settings with y4m input If the input is y4m, then override width, height and frame rate with the info from the y4m file. Change-Id: I8044cf1f5599fd01c451525027d56a11693c2b84
diff --git a/examples/svc_encoder_rtc.c b/examples/svc_encoder_rtc.c index e83afb0..24541f9 100644 --- a/examples/svc_encoder_rtc.c +++ b/examples/svc_encoder_rtc.c
@@ -1179,21 +1179,17 @@ svc_params.framerate_factor[2] = 1; } + if (app_input.input_ctx.file_type == FILE_TYPE_Y4M) { + // Override these settings with the info from Y4M file. + cfg.g_w = app_input.input_ctx.width; + cfg.g_h = app_input.input_ctx.height; + // g_timebase is the reciprocal of frame rate. + cfg.g_timebase.num = app_input.input_ctx.framerate.denominator; + cfg.g_timebase.den = app_input.input_ctx.framerate.numerator; + } framerate = cfg.g_timebase.den / cfg.g_timebase.num; set_rate_control_metrics(&rc, framerate, ss_number_layers, ts_number_layers); - if (app_input.input_ctx.file_type == FILE_TYPE_Y4M) { - if (app_input.input_ctx.width != cfg.g_w || - app_input.input_ctx.height != cfg.g_h) { - die("Incorrect width or height: %d x %d", cfg.g_w, cfg.g_h); - } - if (app_input.input_ctx.framerate.numerator != cfg.g_timebase.den || - app_input.input_ctx.framerate.denominator != cfg.g_timebase.num) { - die("Incorrect framerate: numerator %d denominator %d", - cfg.g_timebase.num, cfg.g_timebase.den); - } - } - AvxVideoInfo info; info.codec_fourcc = get_fourcc_by_aom_encoder(encoder); info.frame_width = cfg.g_w;