From b5def0239b21b9303a8117205a2e13e17861d99a Mon Sep 17 00:00:00 2001 From: Imdad Sardharwalla <imdad.sardharwalla@argondesign.com> Date: Thu, 14 Dec 2017 11:20:24 +0000 Subject: [PATCH] Clean up stray monochrome flags. The monochrome flags have been removed from both the encoder and decoder, as this is now an option in the colour space. Change-Id: Iccd0f051f35811174ba286c6ee454443fd5268be --- aom/aom_decoder.h | 3 +-- aom/aom_encoder.h | 7 ------- aomdec.c | 2 +- aomenc.c | 15 ++++----------- av1/av1_cx_iface.c | 4 ---- examples/aom_cx_set_ref.c | 14 ++++++-------- examples/encoder_util.c | 5 ++++- examples/encoder_util.h | 2 +- 8 files changed, 17 insertions(+), 35 deletions(-) diff --git a/aom/aom_decoder.h b/aom/aom_decoder.h index c5c54c8abd..ceab93453f 100644 --- a/aom/aom_decoder.h +++ b/aom/aom_decoder.h @@ -104,8 +104,7 @@ typedef struct aom_codec_dec_cfg { unsigned int w; /**< Width */ unsigned int h; /**< Height */ unsigned int allow_lowbitdepth; /**< Allow use of low-bitdepth coding path */ - unsigned int monochrome; /**< Whether or not the stream is monochrome */ -} aom_codec_dec_cfg_t; /**< alias for struct aom_codec_dec_cfg */ +} aom_codec_dec_cfg_t; /**< alias for struct aom_codec_dec_cfg */ /*!\brief Initialize a decoder instance * diff --git a/aom/aom_encoder.h b/aom/aom_encoder.h index 7a7f4e4219..208ba011fa 100644 --- a/aom/aom_encoder.h +++ b/aom/aom_encoder.h @@ -620,13 +620,6 @@ typedef struct aom_codec_enc_cfg { */ unsigned int large_scale_tile; - /*!\brief Monochrome mode - * - * If this is nonzero, the encoder will generate a monochrome stream - * with no chroma planes. - */ - unsigned int monochrome; - /*!\brief Number of explicit tile widths specified * * This value indicates the number of tile widths specified diff --git a/aomdec.c b/aomdec.c index 8aaffd6097..c1144e3216 100644 --- a/aomdec.c +++ b/aomdec.c @@ -533,7 +533,7 @@ static int main_loop(int argc, const char **argv_) { int use_y4m = 1; int opt_yv12 = 0; int opt_i420 = 0; - aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH, 0 }; + aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH }; #if CONFIG_HIGHBITDEPTH unsigned int output_bit_depth = 0; #endif diff --git a/aomenc.c b/aomenc.c index 6202e0587f..6ecb055f5b 100644 --- a/aomenc.c +++ b/aomenc.c @@ -1192,12 +1192,6 @@ static int parse_stream_params(struct AvxEncoderConfig *global, } else if (arg_match(&arg, &tile_height, argi)) { config->cfg.tile_height_count = arg_parse_list(&arg, config->cfg.tile_heights, MAX_TILE_HEIGHTS); -#endif -#if CONFIG_MONO_VIDEO - } else if (arg_match(&arg, &input_color_space, argi)) { - aom_color_space_t color_space = arg_parse_enum_or_int(&arg); - config->cfg.monochrome = (color_space == AOM_CS_MONOCHROME); - set_config_arg_ctrls(config, AV1E_SET_COLOR_SPACE, &arg); #endif } else { int i, match = 0; @@ -1506,7 +1500,7 @@ static void initialize_encoder(struct stream_state *stream, #if CONFIG_AV1_DECODER if (global->test_decode != TEST_DECODE_OFF) { const AvxInterface *decoder = get_aom_decoder_by_name(global->codec->name); - aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH, 0 }; + aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH }; aom_codec_dec_init(&stream->decoder, decoder->codec_interface(), &cfg, 0); #if CONFIG_EXT_TILE @@ -1745,7 +1739,7 @@ static float usec_to_fps(uint64_t usec, unsigned int frames) { } static void test_decode(struct stream_state *stream, - enum TestDecodeFatality fatal, int is_mono) { + enum TestDecodeFatality fatal) { aom_image_t enc_img, dec_img; if (stream->mismatch_seen) return; @@ -1777,7 +1771,7 @@ static void test_decode(struct stream_state *stream, ctx_exit_on_error(&stream->encoder, "Failed to get encoder reference frame"); ctx_exit_on_error(&stream->decoder, "Failed to get decoder reference frame"); - if (!aom_compare_img(&enc_img, &dec_img, is_mono ? 1 : 3)) { + if (!aom_compare_img(&enc_img, &dec_img)) { int y[4], u[4], v[4]; #if CONFIG_HIGHBITDEPTH if (enc_img.fmt & AOM_IMG_FMT_HIGHBITDEPTH) { @@ -2205,8 +2199,7 @@ int main(int argc, const char **argv_) { if (got_data && global.test_decode != TEST_DECODE_OFF) { FOREACH_STREAM(stream, streams) { - test_decode(stream, global.test_decode, - stream->config.cfg.monochrome); + test_decode(stream, global.test_decode); } } } diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c index 992b70dace..28b9e32437 100644 --- a/av1/av1_cx_iface.c +++ b/av1/av1_cx_iface.c @@ -1515,9 +1515,6 @@ static aom_codec_err_t ctrl_set_color_space(aom_codec_alg_priv_t *ctx, va_list args) { struct av1_extracfg extra_cfg = ctx->extra_cfg; extra_cfg.color_space = CAST(AV1E_SET_COLOR_SPACE, args); -#if CONFIG_MONO_VIDEO - ctx->cfg.monochrome = (extra_cfg.color_space == AOM_CS_MONOCHROME); -#endif return update_extra_cfg(ctx, &extra_cfg); } @@ -1702,7 +1699,6 @@ static aom_codec_enc_cfg_map_t encoder_usage_cfg_map[] = { 0, // kf_min_dist 9999, // kf_max_dist 0, // large_scale_tile - 0, // monochrome 0, // tile_width_count 0, // tile_height_count { 0 }, // tile_widths diff --git a/examples/aom_cx_set_ref.c b/examples/aom_cx_set_ref.c index e6ec4c569d..456e81300e 100644 --- a/examples/aom_cx_set_ref.c +++ b/examples/aom_cx_set_ref.c @@ -69,8 +69,7 @@ void usage_exit() { } static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder, - unsigned int frame_out, int *mismatch_seen, - int is_mono) { + unsigned int frame_out, int *mismatch_seen) { aom_image_t enc_img, dec_img; struct av1_ref_frame ref_enc, ref_dec; @@ -85,7 +84,7 @@ static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder, die_codec(decoder, "Failed to get decoder reference frame"); dec_img = ref_dec.img; - if (!aom_compare_img(&enc_img, &dec_img, is_mono ? 1 : 3)) { + if (!aom_compare_img(&enc_img, &dec_img)) { int y[4], u[4], v[4]; *mismatch_seen = 1; @@ -107,8 +106,7 @@ static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder, static int encode_frame(aom_codec_ctx_t *ecodec, aom_image_t *img, unsigned int frame_in, AvxVideoWriter *writer, int test_decode, aom_codec_ctx_t *dcodec, - unsigned int *frame_out, int *mismatch_seen, - int is_mono) { + unsigned int *frame_out, int *mismatch_seen) { int got_pkts = 0; aom_codec_iter_t iter = NULL; const aom_codec_cx_pkt_t *pkt = NULL; @@ -149,7 +147,7 @@ static int encode_frame(aom_codec_ctx_t *ecodec, aom_image_t *img, // Mismatch checking if (got_data && test_decode) { - testing_decode(ecodec, dcodec, *frame_out, mismatch_seen, is_mono); + testing_decode(ecodec, dcodec, *frame_out, mismatch_seen); } return got_pkts; @@ -289,7 +287,7 @@ int main(int argc, char **argv) { } encode_frame(&ecodec, &raw, frame_in, writer, test_decode, &dcodec, - &frame_out, &mismatch_seen, cfg.monochrome); + &frame_out, &mismatch_seen); frame_in++; if (mismatch_seen) break; } @@ -297,7 +295,7 @@ int main(int argc, char **argv) { // Flush encoder. if (!mismatch_seen) while (encode_frame(&ecodec, NULL, frame_in, writer, test_decode, &dcodec, - &frame_out, &mismatch_seen, cfg.monochrome)) { + &frame_out, &mismatch_seen)) { } printf("\n"); diff --git a/examples/encoder_util.c b/examples/encoder_util.c index 474690dc84..32acf0a76d 100644 --- a/examples/encoder_util.c +++ b/examples/encoder_util.c @@ -102,7 +102,10 @@ void aom_find_mismatch(const aom_image_t *const img1, } int aom_compare_img(const aom_image_t *const img1, - const aom_image_t *const img2, int num_planes) { + const aom_image_t *const img2) { + assert(img1->cs == img2->cs); + int num_planes = img1->cs == AOM_CS_MONOCHROME ? 1 : 3; + uint32_t l_w = img1->d_w; uint32_t c_w = (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift; const uint32_t c_h = diff --git a/examples/encoder_util.h b/examples/encoder_util.h index 72057a9a92..38deef03d4 100644 --- a/examples/encoder_util.h +++ b/examples/encoder_util.h @@ -31,6 +31,6 @@ void aom_find_mismatch(const aom_image_t *const img1, // Returns 1 if the two images match. int aom_compare_img(const aom_image_t *const img1, - const aom_image_t *const img2, int num_planes); + const aom_image_t *const img2); #endif // EXAMPLES_ENCODER_UTIL_H_ -- GitLab