Commit 1b5328e0 authored by hui su's avatar hui su Committed by Hui Su

aomenc: remove config control of "allow_screen_content_tools"

Always let the encoder decide if "allow_screen_content_tools" should be set.

-The screen content detector(is_screen_content()) works fairly well.

-Keeping the config control may lead to mismatches. For example, user
may encode the 1st frame with the flag on, then turn the flag off for
the 2nd frame via config control. On the decoder side, the flag is on
for both frames, because the flag is only transmitted in the header of
all-intra frame, i.e. the 1st frame in this example.

BUT=aomedia:656

Change-Id: I0652fe2b9f8df19bfbf7ed7d3513205c80ea9c61
parent 8e43f21f
......@@ -513,6 +513,7 @@ static const arg_def_t input_chroma_sample_position =
chroma_sample_position_enum);
#endif
// TODO(huisu): remove "tune-content" control flag.
static const struct arg_enum_list tune_content_enum[] = {
{ "default", AOM_CONTENT_DEFAULT },
{ "screen", AOM_CONTENT_SCREEN },
......
......@@ -5082,8 +5082,10 @@ static void encode_frame_internal(AV1_COMP *cpi) {
av1_zero(rdc->coef_counts);
av1_zero(rdc->comp_pred_diff);
#if CONFIG_PALETTE
if (cpi->auto_tune_content && frame_is_intra_only(cm)) {
#if CONFIG_PALETTE || CONFIG_INTRABC
// 'allow_screen_content_tools' is assigned at intra-only frame, and will
// remain unchanged till the next intra-only frame.
if (frame_is_intra_only(cm)) {
cm->allow_screen_content_tools = is_screen_content(
cpi->source->y_buffer,
#if CONFIG_HIGHBITDEPTH
......@@ -5091,7 +5093,7 @@ static void encode_frame_internal(AV1_COMP *cpi) {
#endif // CONFIG_HIGHBITDEPTH
cpi->source->y_stride, cpi->source->y_width, cpi->source->y_height);
}
#endif // CONFIG_PALETTE
#endif // CONFIG_PALETTE || CONFIG_INTRABC
#if CONFIG_GLOBAL_MOTION
av1_zero(rdc->global_motion_used);
......
......@@ -2198,11 +2198,6 @@ void av1_change_config(struct AV1_COMP *cpi, const AV1EncoderConfig *oxcf) {
cm->reset_frame_context = RESET_FRAME_CONTEXT_NONE;
#if CONFIG_PALETTE || CONFIG_INTRABC
if (frame_is_intra_only(cm)) {
cm->allow_screen_content_tools = (cpi->oxcf.content == AOM_CONTENT_SCREEN);
// Automatically decide if screen content tools should be enabled.
cpi->auto_tune_content = (cpi->oxcf.content == AOM_CONTENT_DEFAULT);
}
if (x->palette_buffer == 0) {
CHECK_MEM_ERROR(cm, x->palette_buffer,
aom_memalign(16, sizeof(*x->palette_buffer)));
......
......@@ -655,12 +655,6 @@ typedef struct AV1_COMP {
#if CONFIG_SPEED_REFS
int sb_scanning_pass_idx;
#endif // CONFIG_SPEED_REFS
#if CONFIG_PALETTE || CONFIG_INTRABC
// Specify if encoder does automatic classification of source video as
// screen content or not.
int auto_tune_content;
#endif // CONFIG_PALETTE || CONFIG_INTRABC
} AV1_COMP;
void av1_initialize_enc(void);
......
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