Commit 8b7a4e16 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan Committed by Frédéric BARBIER

Fix unit tests with --disable-lowbitdepth

This moves up to the main the decision of which coding path to use,
aligning the decoder's logic on the encoder's logic.

Change-Id: I61c709ca1160aefb156d0be25cab8bb1c20ff92a
parent cc8a1bed
......@@ -107,7 +107,8 @@ typedef struct aom_codec_dec_cfg {
unsigned int threads; /**< Maximum number of threads to use, default 1 */
unsigned int w; /**< Width */
unsigned int h; /**< Height */
} aom_codec_dec_cfg_t; /**< alias for struct aom_codec_dec_cfg */
unsigned int allow_lowbitdepth; /**< Allow use of low-bitdepth coding path */
} aom_codec_dec_cfg_t; /**< alias for struct aom_codec_dec_cfg */
/*!\brief Initialize a decoder instance
*
......
......@@ -519,7 +519,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 };
aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH };
#if CONFIG_HIGHBITDEPTH
unsigned int output_bit_depth = 0;
#endif
......
......@@ -1363,7 +1363,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 };
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
......
......@@ -443,6 +443,8 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
return AOM_CODEC_MEM_ERROR;
}
#endif
frame_worker_data->pbi->allow_lowbitdepth = ctx->cfg.allow_lowbitdepth;
// If decoding in serial mode, FrameWorker thread could create tile worker
// thread or loopfilter thread.
frame_worker_data->pbi->max_threads =
......
......@@ -4216,7 +4216,8 @@ static void error_handler(void *data) {
}
static void read_bitdepth_colorspace_sampling(AV1_COMMON *cm,
struct aom_read_bit_buffer *rb) {
struct aom_read_bit_buffer *rb,
int allow_lowbitdepth) {
if (cm->profile >= PROFILE_2) {
cm->bit_depth = aom_rb_read_bit(rb) ? AOM_BITS_12 : AOM_BITS_10;
} else {
......@@ -4224,7 +4225,7 @@ static void read_bitdepth_colorspace_sampling(AV1_COMMON *cm,
}
#if CONFIG_HIGHBITDEPTH
cm->use_highbitdepth = cm->bit_depth > AOM_BITS_8 || !CONFIG_LOWBITDEPTH;
cm->use_highbitdepth = cm->bit_depth > AOM_BITS_8 || !allow_lowbitdepth;
#endif
#if CONFIG_COLORSPACE_HEADERS
cm->color_space = aom_rb_read_literal(rb, 5);
......@@ -4459,7 +4460,7 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Invalid frame sync code");
read_bitdepth_colorspace_sampling(cm, rb);
read_bitdepth_colorspace_sampling(cm, rb, pbi->allow_lowbitdepth);
pbi->refresh_frame_flags = (1 << REF_FRAMES) - 1;
for (i = 0; i < INTER_REFS_PER_FRAME; ++i) {
......@@ -4515,7 +4516,7 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Invalid frame sync code");
read_bitdepth_colorspace_sampling(cm, rb);
read_bitdepth_colorspace_sampling(cm, rb, pbi->allow_lowbitdepth);
pbi->refresh_frame_flags = aom_rb_read_literal(rb, REF_FRAMES);
setup_frame_size(cm, rb);
......
......@@ -122,6 +122,7 @@ typedef struct AV1Decoder {
aom_decrypt_cb decrypt_cb;
void *decrypt_state;
int allow_lowbitdepth;
int max_threads;
int inv_tile_order;
int need_resync; // wait for key/intra-only frame.
......
......@@ -210,6 +210,7 @@ void EncoderTest::MismatchHook(const aom_image_t *img_enc,
void EncoderTest::RunLoop(VideoSource *video) {
aom_codec_dec_cfg_t dec_cfg = aom_codec_dec_cfg_t();
dec_cfg.allow_lowbitdepth = 1;
stats_.Reset();
......
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