summaryrefslogtreecommitdiff
path: root/vpxenc.c
diff options
context:
space:
mode:
Diffstat (limited to 'vpxenc.c')
-rw-r--r--vpxenc.c330
1 files changed, 164 insertions, 166 deletions
diff --git a/vpxenc.c b/vpxenc.c
index cc81f4aa2..0a0c0718b 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -128,50 +128,50 @@ int fourcc_is_ivf(const char detect[4]) {
return 0;
}
-static const arg_def_t debugmode = ARG_DEF("D", "debug", 0,
- "Debug mode (makes output deterministic)");
-static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
- "Output filename");
-static const arg_def_t use_yv12 = ARG_DEF(NULL, "yv12", 0,
- "Input file is YV12 ");
-static const arg_def_t use_i420 = ARG_DEF(NULL, "i420", 0,
- "Input file is I420 (default)");
-static const arg_def_t use_i422 = ARG_DEF(NULL, "i422", 0,
- "Input file is I422");
-static const arg_def_t use_i444 = ARG_DEF(NULL, "i444", 0,
- "Input file is I444");
-static const arg_def_t use_i440 = ARG_DEF(NULL, "i440", 0,
- "Input file is I440");
-static const arg_def_t codecarg = ARG_DEF(NULL, "codec", 1,
- "Codec to use");
-static const arg_def_t passes = ARG_DEF("p", "passes", 1,
- "Number of passes (1/2)");
-static const arg_def_t pass_arg = ARG_DEF(NULL, "pass", 1,
- "Pass to execute (1/2)");
-static const arg_def_t fpf_name = ARG_DEF(NULL, "fpf", 1,
- "First pass statistics file name");
+static const arg_def_t debugmode = ARG_DEF(
+ "D", "debug", 0, "Debug mode (makes output deterministic)");
+static const arg_def_t outputfile = ARG_DEF(
+ "o", "output", 1, "Output filename");
+static const arg_def_t use_yv12 = ARG_DEF(
+ NULL, "yv12", 0, "Input file is YV12 ");
+static const arg_def_t use_i420 = ARG_DEF(
+ NULL, "i420", 0, "Input file is I420 (default)");
+static const arg_def_t use_i422 = ARG_DEF(
+ NULL, "i422", 0, "Input file is I422");
+static const arg_def_t use_i444 = ARG_DEF(
+ NULL, "i444", 0, "Input file is I444");
+static const arg_def_t use_i440 = ARG_DEF(
+ NULL, "i440", 0, "Input file is I440");
+static const arg_def_t codecarg = ARG_DEF(
+ NULL, "codec", 1, "Codec to use");
+static const arg_def_t passes = ARG_DEF(
+ "p", "passes", 1, "Number of passes (1/2)");
+static const arg_def_t pass_arg = ARG_DEF(
+ NULL, "pass", 1, "Pass to execute (1/2)");
+static const arg_def_t fpf_name = ARG_DEF(
+ NULL, "fpf", 1, "First pass statistics file name");
#if CONFIG_FP_MB_STATS
-static const arg_def_t fpmbf_name = ARG_DEF(NULL, "fpmbf", 1,
- "First pass block statistics file name");
+static const arg_def_t fpmbf_name = ARG_DEF(
+ NULL, "fpmbf", 1, "First pass block statistics file name");
#endif
-static const arg_def_t limit = ARG_DEF(NULL, "limit", 1,
- "Stop encoding after n input frames");
-static const arg_def_t skip = ARG_DEF(NULL, "skip", 1,
- "Skip the first n input frames");
-static const arg_def_t deadline = ARG_DEF("d", "deadline", 1,
- "Deadline per frame (usec)");
-static const arg_def_t best_dl = ARG_DEF(NULL, "best", 0,
- "Use Best Quality Deadline");
-static const arg_def_t good_dl = ARG_DEF(NULL, "good", 0,
- "Use Good Quality Deadline");
-static const arg_def_t rt_dl = ARG_DEF(NULL, "rt", 0,
- "Use Realtime Quality Deadline");
-static const arg_def_t quietarg = ARG_DEF("q", "quiet", 0,
- "Do not print encode progress");
-static const arg_def_t verbosearg = ARG_DEF("v", "verbose", 0,
- "Show encoder parameters");
-static const arg_def_t psnrarg = ARG_DEF(NULL, "psnr", 0,
- "Show PSNR in status line");
+static const arg_def_t limit = ARG_DEF(
+ NULL, "limit", 1, "Stop encoding after n input frames");
+static const arg_def_t skip = ARG_DEF(
+ NULL, "skip", 1, "Skip the first n input frames");
+static const arg_def_t deadline = ARG_DEF(
+ "d", "deadline", 1, "Deadline per frame (usec)");
+static const arg_def_t best_dl = ARG_DEF(
+ NULL, "best", 0, "Use Best Quality Deadline");
+static const arg_def_t good_dl = ARG_DEF(
+ NULL, "good", 0, "Use Good Quality Deadline");
+static const arg_def_t rt_dl = ARG_DEF(
+ NULL, "rt", 0, "Use Realtime Quality Deadline");
+static const arg_def_t quietarg = ARG_DEF(
+ "q", "quiet", 0, "Do not print encode progress");
+static const arg_def_t verbosearg = ARG_DEF(
+ "v", "verbose", 0, "Show encoder parameters");
+static const arg_def_t psnrarg = ARG_DEF(
+ NULL, "psnr", 0, "Show PSNR in status line");
static const struct arg_enum_list test_decode_enum[] = {
{"off", TEST_DECODE_OFF},
@@ -179,25 +179,25 @@ static const struct arg_enum_list test_decode_enum[] = {
{"warn", TEST_DECODE_WARN},
{NULL, 0}
};
-static const arg_def_t recontest = ARG_DEF_ENUM(NULL, "test-decode", 1,
- "Test encode/decode mismatch",
- test_decode_enum);
-static const arg_def_t framerate = ARG_DEF(NULL, "fps", 1,
- "Stream frame rate (rate/scale)");
-static const arg_def_t use_ivf = ARG_DEF(NULL, "ivf", 0,
- "Output IVF (default is WebM if WebM IO is enabled)");
-static const arg_def_t out_part = ARG_DEF("P", "output-partitions", 0,
- "Makes encoder output partitions. Requires IVF output!");
-static const arg_def_t q_hist_n = ARG_DEF(NULL, "q-hist", 1,
- "Show quantizer histogram (n-buckets)");
-static const arg_def_t rate_hist_n = ARG_DEF(NULL, "rate-hist", 1,
- "Show rate histogram (n-buckets)");
-static const arg_def_t disable_warnings =
- ARG_DEF(NULL, "disable-warnings", 0,
- "Disable warnings about potentially incorrect encode settings.");
-static const arg_def_t disable_warning_prompt =
- ARG_DEF("y", "disable-warning-prompt", 0,
- "Display warnings, but do not prompt user to continue.");
+static const arg_def_t recontest = ARG_DEF_ENUM(
+ NULL, "test-decode", 1, "Test encode/decode mismatch", test_decode_enum);
+static const arg_def_t framerate = ARG_DEF(
+ NULL, "fps", 1, "Stream frame rate (rate/scale)");
+static const arg_def_t use_ivf = ARG_DEF(
+ NULL, "ivf", 0, "Output IVF (default is WebM if WebM IO is enabled)");
+static const arg_def_t out_part = ARG_DEF(
+ "P", "output-partitions", 0,
+ "Makes encoder output partitions. Requires IVF output!");
+static const arg_def_t q_hist_n = ARG_DEF(
+ NULL, "q-hist", 1, "Show quantizer histogram (n-buckets)");
+static const arg_def_t rate_hist_n = ARG_DEF(
+ NULL, "rate-hist", 1, "Show rate histogram (n-buckets)");
+static const arg_def_t disable_warnings = ARG_DEF(
+ NULL, "disable-warnings", 0,
+ "Disable warnings about potentially incorrect encode settings.");
+static const arg_def_t disable_warning_prompt = ARG_DEF(
+ "y", "disable-warning-prompt", 0,
+ "Display warnings, but do not prompt user to continue.");
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
static const arg_def_t test16bitinternalarg = ARG_DEF(
@@ -213,16 +213,14 @@ static const arg_def_t *main_args[] = {
NULL
};
-static const arg_def_t usage = ARG_DEF("u", "usage", 1,
- "Usage profile number to use");
-static const arg_def_t threads = ARG_DEF("t", "threads", 1,
- "Max number of threads to use");
-static const arg_def_t profile = ARG_DEF(NULL, "profile", 1,
- "Bitstream profile number to use");
-static const arg_def_t width = ARG_DEF("w", "width", 1,
- "Frame width");
-static const arg_def_t height = ARG_DEF("h", "height", 1,
- "Frame height");
+static const arg_def_t usage = ARG_DEF(
+ "u", "usage", 1, "Usage profile number to use");
+static const arg_def_t threads = ARG_DEF(
+ "t", "threads", 1, "Max number of threads to use");
+static const arg_def_t profile = ARG_DEF(
+ NULL, "profile", 1, "Bitstream profile number to use");
+static const arg_def_t width = ARG_DEF("w", "width", 1, "Frame width");
+static const arg_def_t height = ARG_DEF("h", "height", 1, "Frame height");
#if CONFIG_WEBM_IO
static const struct arg_enum_list stereo_mode_enum[] = {
{"mono", STEREO_FORMAT_MONO},
@@ -232,15 +230,15 @@ static const struct arg_enum_list stereo_mode_enum[] = {
{"right-left", STEREO_FORMAT_RIGHT_LEFT},
{NULL, 0}
};
-static const arg_def_t stereo_mode = ARG_DEF_ENUM(NULL, "stereo-mode", 1,
- "Stereo 3D video format", stereo_mode_enum);
+static const arg_def_t stereo_mode = ARG_DEF_ENUM(
+ NULL, "stereo-mode", 1, "Stereo 3D video format", stereo_mode_enum);
#endif
-static const arg_def_t timebase = ARG_DEF(NULL, "timebase", 1,
- "Output timestamp precision (fractional seconds)");
-static const arg_def_t error_resilient = ARG_DEF(NULL, "error-resilient", 1,
- "Enable error resiliency features");
-static const arg_def_t lag_in_frames = ARG_DEF(NULL, "lag-in-frames", 1,
- "Max number of frames to lag");
+static const arg_def_t timebase = ARG_DEF(
+ NULL, "timebase", 1, "Output timestamp precision (fractional seconds)");
+static const arg_def_t error_resilient = ARG_DEF(
+ NULL, "error-resilient", 1, "Enable error resiliency features");
+static const arg_def_t lag_in_frames = ARG_DEF(
+ NULL, "lag-in-frames", 1, "Max number of frames to lag");
static const arg_def_t *global_args[] = {
&use_yv12, &use_i420, &use_i422, &use_i444, &use_i440,
@@ -257,18 +255,18 @@ static const arg_def_t *global_args[] = {
&lag_in_frames, NULL
};
-static const arg_def_t dropframe_thresh = ARG_DEF(NULL, "drop-frame", 1,
- "Temporal resampling threshold (buf %)");
-static const arg_def_t resize_allowed = ARG_DEF(NULL, "resize-allowed", 1,
- "Spatial resampling enabled (bool)");
-static const arg_def_t resize_width = ARG_DEF(NULL, "resize-width", 1,
- "Width of encoded frame");
-static const arg_def_t resize_height = ARG_DEF(NULL, "resize-height", 1,
- "Height of encoded frame");
-static const arg_def_t resize_up_thresh = ARG_DEF(NULL, "resize-up", 1,
- "Upscale threshold (buf %)");
-static const arg_def_t resize_down_thresh = ARG_DEF(NULL, "resize-down", 1,
- "Downscale threshold (buf %)");
+static const arg_def_t dropframe_thresh = ARG_DEF(
+ NULL, "drop-frame", 1, "Temporal resampling threshold (buf %)");
+static const arg_def_t resize_allowed = ARG_DEF(
+ NULL, "resize-allowed", 1, "Spatial resampling enabled (bool)");
+static const arg_def_t resize_width = ARG_DEF(
+ NULL, "resize-width", 1, "Width of encoded frame");
+static const arg_def_t resize_height = ARG_DEF(
+ NULL, "resize-height", 1, "Height of encoded frame");
+static const arg_def_t resize_up_thresh = ARG_DEF(
+ NULL, "resize-up", 1, "Upscale threshold (buf %)");
+static const arg_def_t resize_down_thresh = ARG_DEF(
+ NULL, "resize-down", 1, "Downscale threshold (buf %)");
static const struct arg_enum_list end_usage_enum[] = {
{"vbr", VPX_VBR},
{"cbr", VPX_CBR},
@@ -276,24 +274,24 @@ static const struct arg_enum_list end_usage_enum[] = {
{"q", VPX_Q},
{NULL, 0}
};
-static const arg_def_t end_usage = ARG_DEF_ENUM(NULL, "end-usage", 1,
- "Rate control mode", end_usage_enum);
-static const arg_def_t target_bitrate = ARG_DEF(NULL, "target-bitrate", 1,
- "Bitrate (kbps)");
-static const arg_def_t min_quantizer = ARG_DEF(NULL, "min-q", 1,
- "Minimum (best) quantizer");
-static const arg_def_t max_quantizer = ARG_DEF(NULL, "max-q", 1,
- "Maximum (worst) quantizer");
-static const arg_def_t undershoot_pct = ARG_DEF(NULL, "undershoot-pct", 1,
- "Datarate undershoot (min) target (%)");
-static const arg_def_t overshoot_pct = ARG_DEF(NULL, "overshoot-pct", 1,
- "Datarate overshoot (max) target (%)");
-static const arg_def_t buf_sz = ARG_DEF(NULL, "buf-sz", 1,
- "Client buffer size (ms)");
-static const arg_def_t buf_initial_sz = ARG_DEF(NULL, "buf-initial-sz", 1,
- "Client initial buffer size (ms)");
-static const arg_def_t buf_optimal_sz = ARG_DEF(NULL, "buf-optimal-sz", 1,
- "Client optimal buffer size (ms)");
+static const arg_def_t end_usage = ARG_DEF_ENUM(
+ NULL, "end-usage", 1, "Rate control mode", end_usage_enum);
+static const arg_def_t target_bitrate = ARG_DEF(
+ NULL, "target-bitrate", 1, "Bitrate (kbps)");
+static const arg_def_t min_quantizer = ARG_DEF(
+ NULL, "min-q", 1, "Minimum (best) quantizer");
+static const arg_def_t max_quantizer = ARG_DEF(
+ NULL, "max-q", 1, "Maximum (worst) quantizer");
+static const arg_def_t undershoot_pct = ARG_DEF(
+ NULL, "undershoot-pct", 1, "Datarate undershoot (min) target (%)");
+static const arg_def_t overshoot_pct = ARG_DEF(
+ NULL, "overshoot-pct", 1, "Datarate overshoot (max) target (%)");
+static const arg_def_t buf_sz = ARG_DEF(
+ NULL, "buf-sz", 1, "Client buffer size (ms)");
+static const arg_def_t buf_initial_sz = ARG_DEF(
+ NULL, "buf-initial-sz", 1, "Client initial buffer size (ms)");
+static const arg_def_t buf_optimal_sz = ARG_DEF(
+ NULL, "buf-optimal-sz", 1, "Client optimal buffer size (ms)");
static const arg_def_t *rc_args[] = {
&dropframe_thresh, &resize_allowed, &resize_width, &resize_height,
&resize_up_thresh, &resize_down_thresh, &end_usage, &target_bitrate,
@@ -302,59 +300,59 @@ static const arg_def_t *rc_args[] = {
};
-static const arg_def_t bias_pct = ARG_DEF(NULL, "bias-pct", 1,
- "CBR/VBR bias (0=CBR, 100=VBR)");
-static const arg_def_t minsection_pct = ARG_DEF(NULL, "minsection-pct", 1,
- "GOP min bitrate (% of target)");
-static const arg_def_t maxsection_pct = ARG_DEF(NULL, "maxsection-pct", 1,
- "GOP max bitrate (% of target)");
+static const arg_def_t bias_pct = ARG_DEF(
+ NULL, "bias-pct", 1, "CBR/VBR bias (0=CBR, 100=VBR)");
+static const arg_def_t minsection_pct = ARG_DEF(
+ NULL, "minsection-pct", 1, "GOP min bitrate (% of target)");
+static const arg_def_t maxsection_pct = ARG_DEF(
+ NULL, "maxsection-pct", 1, "GOP max bitrate (% of target)");
static const arg_def_t *rc_twopass_args[] = {
&bias_pct, &minsection_pct, &maxsection_pct, NULL
};
-static const arg_def_t kf_min_dist = ARG_DEF(NULL, "kf-min-dist", 1,
- "Minimum keyframe interval (frames)");
-static const arg_def_t kf_max_dist = ARG_DEF(NULL, "kf-max-dist", 1,
- "Maximum keyframe interval (frames)");
-static const arg_def_t kf_disabled = ARG_DEF(NULL, "disable-kf", 0,
- "Disable keyframe placement");
+static const arg_def_t kf_min_dist = ARG_DEF(
+ NULL, "kf-min-dist", 1, "Minimum keyframe interval (frames)");
+static const arg_def_t kf_max_dist = ARG_DEF(
+ NULL, "kf-max-dist", 1, "Maximum keyframe interval (frames)");
+static const arg_def_t kf_disabled = ARG_DEF(
+ NULL, "disable-kf", 0, "Disable keyframe placement");
static const arg_def_t *kf_args[] = {
&kf_min_dist, &kf_max_dist, &kf_disabled, NULL
};
-static const arg_def_t noise_sens = ARG_DEF(NULL, "noise-sensitivity", 1,
- "Noise sensitivity (frames to blur)");
-static const arg_def_t sharpness = ARG_DEF(NULL, "sharpness", 1,
- "Loop filter sharpness (0..7)");
-static const arg_def_t static_thresh = ARG_DEF(NULL, "static-thresh", 1,
- "Motion detection threshold");
-static const arg_def_t cpu_used = ARG_DEF(NULL, "cpu-used", 1,
- "CPU Used (-16..16)");
-static const arg_def_t auto_altref = ARG_DEF(NULL, "auto-alt-ref", 1,
- "Enable automatic alt reference frames");
-static const arg_def_t arnr_maxframes = ARG_DEF(NULL, "arnr-maxframes", 1,
- "AltRef max frames (0..15)");
-static const arg_def_t arnr_strength = ARG_DEF(NULL, "arnr-strength", 1,
- "AltRef filter strength (0..6)");
-static const arg_def_t arnr_type = ARG_DEF(NULL, "arnr-type", 1,
- "AltRef type");
+static const arg_def_t noise_sens = ARG_DEF(
+ NULL, "noise-sensitivity", 1, "Noise sensitivity (frames to blur)");
+static const arg_def_t sharpness = ARG_DEF(
+ NULL, "sharpness", 1, "Loop filter sharpness (0..7)");
+static const arg_def_t static_thresh = ARG_DEF(
+ NULL, "static-thresh", 1, "Motion detection threshold");
+static const arg_def_t cpu_used = ARG_DEF(
+ NULL, "cpu-used", 1, "CPU Used (-16..16)");
+static const arg_def_t auto_altref = ARG_DEF(
+ NULL, "auto-alt-ref", 1, "Enable automatic alt reference frames");
+static const arg_def_t arnr_maxframes = ARG_DEF(
+ NULL, "arnr-maxframes", 1, "AltRef max frames (0..15)");
+static const arg_def_t arnr_strength = ARG_DEF(
+ NULL, "arnr-strength", 1, "AltRef filter strength (0..6)");
+static const arg_def_t arnr_type = ARG_DEF(
+ NULL, "arnr-type", 1, "AltRef type");
static const struct arg_enum_list tuning_enum[] = {
{"psnr", VP8_TUNE_PSNR},
{"ssim", VP8_TUNE_SSIM},
{NULL, 0}
};
-static const arg_def_t tune_ssim = ARG_DEF_ENUM(NULL, "tune", 1,
- "Material to favor", tuning_enum);
-static const arg_def_t cq_level = ARG_DEF(NULL, "cq-level", 1,
- "Constant/Constrained Quality level");
-static const arg_def_t max_intra_rate_pct = ARG_DEF(NULL, "max-intra-rate", 1,
- "Max I-frame bitrate (pct)");
+static const arg_def_t tune_ssim = ARG_DEF_ENUM(
+ NULL, "tune", 1, "Material to favor", tuning_enum);
+static const arg_def_t cq_level = ARG_DEF(
+ NULL, "cq-level", 1, "Constant/Constrained Quality level");
+static const arg_def_t max_intra_rate_pct = ARG_DEF(
+ NULL, "max-intra-rate", 1, "Max I-frame bitrate (pct)");
#if CONFIG_VP8_ENCODER
-static const arg_def_t token_parts =
- ARG_DEF(NULL, "token-parts", 1, "Number of token partitions to use, log2");
+static const arg_def_t token_parts = ARG_DEF(
+ NULL, "token-parts", 1, "Number of token partitions to use, log2");
static const arg_def_t *vp8_args[] = {
&cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh,
&token_parts, &arnr_maxframes, &arnr_strength, &arnr_type,
@@ -372,11 +370,12 @@ static const int vp8_arg_ctrl_map[] = {
#endif
#if CONFIG_VP9_ENCODER
-static const arg_def_t tile_cols =
- ARG_DEF(NULL, "tile-columns", 1, "Number of tile columns to use, log2");
-static const arg_def_t tile_rows =
- ARG_DEF(NULL, "tile-rows", 1, "Number of tile rows to use, log2");
-static const arg_def_t lossless = ARG_DEF(NULL, "lossless", 1, "Lossless mode");
+static const arg_def_t tile_cols = ARG_DEF(
+ NULL, "tile-columns", 1, "Number of tile columns to use, log2");
+static const arg_def_t tile_rows = ARG_DEF(
+ NULL, "tile-rows", 1, "Number of tile rows to use, log2");
+static const arg_def_t lossless = ARG_DEF(
+ NULL, "lossless", 1, "Lossless mode");
static const arg_def_t frame_parallel_decoding = ARG_DEF(
NULL, "frame-parallel", 1, "Enable frame parallel decodability features");
static const arg_def_t aq_mode = ARG_DEF(
@@ -395,13 +394,12 @@ static const struct arg_enum_list bitdepth_enum[] = {
{NULL, 0}
};
-static const arg_def_t bitdeptharg = ARG_DEF_ENUM("b", "bit-depth", 1,
- "Bit depth for codec "
- "(8 for version <=1, "
- "10 or 12 for version 2)",
- bitdepth_enum);
-static const arg_def_t inbitdeptharg = ARG_DEF(NULL, "input-bit-depth", 1,
- "Bit depth of input");
+static const arg_def_t bitdeptharg = ARG_DEF_ENUM(
+ "b", "bit-depth", 1,
+ "Bit depth for codec (8 for version <=1, 10 or 12 for version 2)",
+ bitdepth_enum);
+static const arg_def_t inbitdeptharg = ARG_DEF(
+ NULL, "input-bit-depth", 1, "Bit depth of input");
#endif
static const struct arg_enum_list tune_content_enum[] = {
@@ -1161,7 +1159,6 @@ static int parse_stream_params(struct VpxEncoderConfig *global,
if (j == config->arg_ctrl_cnt)
config->arg_ctrl_cnt++;
}
-
}
}
if (!match)
@@ -1917,14 +1914,15 @@ int main(int argc, const char **argv_) {
/* If the input file doesn't specify its w/h (raw files), try to get
* the data from the first stream's configuration.
*/
- if (!input.width || !input.height)
- FOREACH_STREAM( {
- if (stream->config.cfg.g_w && stream->config.cfg.g_h) {
- input.width = stream->config.cfg.g_w;
- input.height = stream->config.cfg.g_h;
- break;
- }
- });
+ if (!input.width || !input.height) {
+ FOREACH_STREAM({
+ if (stream->config.cfg.g_w && stream->config.cfg.g_h) {
+ input.width = stream->config.cfg.g_w;
+ input.height = stream->config.cfg.g_h;
+ break;
+ }
+ });
+ }
/* Update stream configurations from the input file's parameters */
if (!input.width || !input.height)