Commit b5def023 authored by Imdad Sardharwalla's avatar Imdad Sardharwalla Committed by Debargha Mukherjee

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
parent 841c030f
......@@ -104,7 +104,6 @@ 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 */
/*!\brief Initialize a decoder instance
......
......@@ -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
......
......@@ -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
......
......@@ -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);
}
}
}
......
......@@ -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
......
......@@ -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");
......
......@@ -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 =
......
......@@ -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_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment