diff options
author | trav90 <travawine@palemoon.org> | 2018-10-19 23:05:00 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-19 23:05:03 -0500 |
commit | d2499ead93dc4298c0882fe98902acb1b5209f99 (patch) | |
tree | cb0b942aed59e5108f9a3e9d64e7b77854383421 /third_party/aom/apps/aomenc.c | |
parent | 41fbdea457bf50c0a43e1c27c5cbf7f0a3a9eb33 (diff) | |
download | UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.tar UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.tar.gz UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.tar.lz UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.tar.xz UXP-d2499ead93dc4298c0882fe98902acb1b5209f99.zip |
Update libaom to commit ID 1e227d41f0616de9548a673a83a21ef990b62591
Diffstat (limited to 'third_party/aom/apps/aomenc.c')
-rw-r--r-- | third_party/aom/apps/aomenc.c | 77 |
1 files changed, 46 insertions, 31 deletions
diff --git a/third_party/aom/apps/aomenc.c b/third_party/aom/apps/aomenc.c index 31cb662e4..2e5d35cfe 100644 --- a/third_party/aom/apps/aomenc.c +++ b/third_party/aom/apps/aomenc.c @@ -180,9 +180,6 @@ static const arg_def_t use_webm = ARG_DEF(NULL, "webm", 0, "Output WebM (default when WebM IO is enabled)"); static const arg_def_t use_ivf = ARG_DEF(NULL, "ivf", 0, "Output IVF"); static const arg_def_t use_obu = ARG_DEF(NULL, "obu", 0, "Output OBU"); -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 = @@ -203,6 +200,12 @@ static const arg_def_t bitdeptharg = ARG_DEF_ENUM( bitdepth_enum); static const arg_def_t inbitdeptharg = ARG_DEF(NULL, "input-bit-depth", 1, "Bit depth of input"); + +static const arg_def_t input_chroma_subsampling_x = ARG_DEF( + NULL, "input-chroma-subsampling-x", 1, "chroma subsampling x value."); +static const arg_def_t input_chroma_subsampling_y = ARG_DEF( + NULL, "input-chroma-subsampling-y", 1, "chroma subsampling y value."); + static const arg_def_t *main_args[] = { &help, #if CONFIG_FILEOPTIONS &use_cfg, @@ -222,7 +225,6 @@ static const arg_def_t *main_args[] = { &help, &use_webm, &use_ivf, &use_obu, - &out_part, &q_hist_n, &rate_hist_n, &disable_warnings, @@ -411,16 +413,13 @@ static const arg_def_t max_intra_rate_pct = #if CONFIG_AV1_ENCODER static const arg_def_t cpu_used_av1 = ARG_DEF(NULL, "cpu-used", 1, "CPU Used (0..8)"); -static const arg_def_t dev_sf_av1 = - ARG_DEF(NULL, "dev-sf", 1, "Dev Speed (0..255)"); -static const arg_def_t single_tile_decoding = - ARG_DEF(NULL, "single-tile-decoding", 1, - "Single tile decoding (0: off (default), 1: on)"); +static const arg_def_t rowmtarg = + ARG_DEF(NULL, "row-mt", 1, + "Enable row based multi-threading (0: off (default), 1: on)"); 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 (set to 0 while threads > 1)"); + ARG_DEF(NULL, "tile-rows", 1, "Number of tile rows to use, log2"); static const arg_def_t tile_width = ARG_DEF(NULL, "tile-width", 1, "Tile widths (comma separated)"); static const arg_def_t tile_height = @@ -619,11 +618,10 @@ static const arg_def_t superblock_size = ARG_DEF_ENUM( NULL, "sb-size", 1, "Superblock size to use", superblock_size_enum); static const arg_def_t *av1_args[] = { &cpu_used_av1, - &dev_sf_av1, &auto_altref, &sharpness, &static_thresh, - &single_tile_decoding, + &rowmtarg, &tile_cols, &tile_rows, &arnr_maxframes, @@ -670,16 +668,17 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1, &enable_ref_frame_mvs, &bitdeptharg, &inbitdeptharg, + &input_chroma_subsampling_x, + &input_chroma_subsampling_y, &sframe_dist, &sframe_mode, &save_as_annexb, NULL }; static const int av1_arg_ctrl_map[] = { AOME_SET_CPUUSED, - AOME_SET_DEVSF, AOME_SET_ENABLEAUTOALTREF, AOME_SET_SHARPNESS, AOME_SET_STATIC_THRESHOLD, - AV1E_SET_SINGLE_TILE_DECODING, + AV1E_SET_ROW_MT, AV1E_SET_TILE_COLUMNS, AV1E_SET_TILE_ROWS, AOME_SET_ARNR_MAXFRAMES, @@ -830,6 +829,8 @@ struct stream_state { struct aom_image *img; aom_codec_ctx_t decoder; int mismatch_seen; + unsigned int chroma_subsampling_x; + unsigned int chroma_subsampling_y; }; static void validate_positive_rational(const char *msg, @@ -927,9 +928,7 @@ static void parse_global_config(struct AvxEncoderConfig *global, int *argc, global->framerate = arg_parse_rational(&arg); validate_positive_rational(arg.name, &global->framerate); global->have_framerate = 1; - } else if (arg_match(&arg, &out_part, argi)) - global->out_part = 1; - else if (arg_match(&arg, &debugmode, argi)) + } else if (arg_match(&arg, &debugmode, argi)) global->debug = 1; else if (arg_match(&arg, &q_hist_n, argi)) global->show_q_hist_buckets = arg_parse_uint(&arg); @@ -1087,6 +1086,11 @@ static void set_config_arg_ctrls(struct stream_config *config, int key, assert(j < (int)ARG_CTRL_CNT_MAX); config->arg_ctrls[j][0] = key; config->arg_ctrls[j][1] = arg_parse_enum_or_int(arg); + + if (key == AOME_SET_ENABLEAUTOALTREF && config->arg_ctrls[j][1] > 1) { + warn("auto-alt-ref > 1 is deprecated... setting auto-alt-ref=1\n"); + config->arg_ctrls[j][1] = 1; + } if (j == config->arg_ctrl_cnt) config->arg_ctrl_cnt++; } @@ -1174,6 +1178,10 @@ static int parse_stream_params(struct AvxEncoderConfig *global, config->cfg.g_bit_depth = arg_parse_enum_or_int(&arg); } else if (arg_match(&arg, &inbitdeptharg, argi)) { config->cfg.g_input_bit_depth = arg_parse_uint(&arg); + } else if (arg_match(&arg, &input_chroma_subsampling_x, argi)) { + stream->chroma_subsampling_x = arg_parse_uint(&arg); + } else if (arg_match(&arg, &input_chroma_subsampling_y, argi)) { + stream->chroma_subsampling_y = arg_parse_uint(&arg); #if CONFIG_WEBM_IO } else if (arg_match(&arg, &stereo_mode, argi)) { config->stereo_fmt = arg_parse_enum_or_int(&arg); @@ -1531,7 +1539,6 @@ static void initialize_encoder(struct stream_state *stream, int flags = 0; flags |= global->show_psnr ? AOM_CODEC_USE_PSNR : 0; - flags |= global->out_part ? AOM_CODEC_USE_OUTPUT_PARTITION : 0; flags |= stream->config.use_16bit_internal ? AOM_CODEC_USE_HIGHBITDEPTH : 0; /* Construct Encoder Context */ @@ -1609,14 +1616,14 @@ static void encode_frame(struct stream_state *stream, aom_img_alloc(NULL, AOM_IMG_FMT_I42016, cfg->g_w, cfg->g_h, 16); } I420Scale_16( - (uint16 *)img->planes[AOM_PLANE_Y], img->stride[AOM_PLANE_Y] / 2, - (uint16 *)img->planes[AOM_PLANE_U], img->stride[AOM_PLANE_U] / 2, - (uint16 *)img->planes[AOM_PLANE_V], img->stride[AOM_PLANE_V] / 2, - img->d_w, img->d_h, (uint16 *)stream->img->planes[AOM_PLANE_Y], + (uint16_t *)img->planes[AOM_PLANE_Y], img->stride[AOM_PLANE_Y] / 2, + (uint16_t *)img->planes[AOM_PLANE_U], img->stride[AOM_PLANE_U] / 2, + (uint16_t *)img->planes[AOM_PLANE_V], img->stride[AOM_PLANE_V] / 2, + img->d_w, img->d_h, (uint16_t *)stream->img->planes[AOM_PLANE_Y], stream->img->stride[AOM_PLANE_Y] / 2, - (uint16 *)stream->img->planes[AOM_PLANE_U], + (uint16_t *)stream->img->planes[AOM_PLANE_U], stream->img->stride[AOM_PLANE_U] / 2, - (uint16 *)stream->img->planes[AOM_PLANE_V], + (uint16_t *)stream->img->planes[AOM_PLANE_V], stream->img->stride[AOM_PLANE_V] / 2, stream->img->d_w, stream->img->d_h, kFilterBox); img = stream->img; @@ -2043,17 +2050,25 @@ int main(int argc, const char **argv_) { input.fmt == AOM_IMG_FMT_I42016)) { stream->config.cfg.g_profile = 0; profile_updated = 1; + } else if (input.bit_depth == 12 && + input.file_type == FILE_TYPE_Y4M) { + // Note that here the input file values for chroma subsampling + // are used instead of those from the command line. + aom_codec_control(&stream->encoder, AV1E_SET_CHROMA_SUBSAMPLING_X, + input.y4m.dst_c_dec_h >> 1); + aom_codec_control(&stream->encoder, AV1E_SET_CHROMA_SUBSAMPLING_Y, + input.y4m.dst_c_dec_v >> 1); + } else if (input.bit_depth == 12 && + input.file_type == FILE_TYPE_RAW) { + aom_codec_control(&stream->encoder, AV1E_SET_CHROMA_SUBSAMPLING_X, + stream->chroma_subsampling_x); + aom_codec_control(&stream->encoder, AV1E_SET_CHROMA_SUBSAMPLING_Y, + stream->chroma_subsampling_y); } break; default: break; } } - /* Automatically set the codec bit depth to match the input bit depth. - * Upgrade the profile if required. */ - if (stream->config.cfg.g_input_bit_depth > - (unsigned int)stream->config.cfg.g_bit_depth) { - stream->config.cfg.g_bit_depth = stream->config.cfg.g_input_bit_depth; - } if (stream->config.cfg.g_bit_depth > 10) { switch (stream->config.cfg.g_profile) { case 0: |