Commit d91c8c9a authored by Fergus Simpson's avatar Fergus Simpson

frame_superres: Make frame_superres independent of loop_restoration

The frame superresolution experiment currently makes no use of the
features of the loop restoration experiment. While this is planned for
the future, there is no reason to continue having frame superresolution
depend on loop restoration for now.

Frame superresolution was made dependent by having every preproccesor if
containing its config flag also depend on the loop restoration config
flag. Those if's are modified to only check the frame superresolution
flag by this patch.

Change-Id: Ieef47de29125af8d080739ffeac5c55a1fa99e23
parent 1e90dc19
......@@ -528,12 +528,14 @@ typedef enum {
RESTORE_SWITCHABLE_TYPES = RESTORE_SWITCHABLE,
RESTORE_TYPES,
} RestorationType;
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_FRAME_SUPERRES
#define SUPERRES_SCALE_DENOMINATOR 16
#define SUPERRES_SCALE_BITS 3
#define SUPERRES_SCALE_NUMERATOR_MIN 8
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_LOOP_RESTORATION
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -163,6 +163,12 @@ typedef struct AV1Common {
int last_width;
int last_height;
#if CONFIG_FRAME_SUPERRES
// The numerator of the superres scale, the denominator is fixed
uint8_t superres_scale_numerator;
int superres_width, superres_height;
#endif // CONFIG_FRAME_SUPERRES
// TODO(jkoleszar): this implies chroma ss right now, but could vary per
// plane. Revisit as part of the future change to YV12_BUFFER_CONFIG to
// support additional planes.
......@@ -296,11 +302,6 @@ typedef struct AV1Common {
#if CONFIG_LOOP_RESTORATION
RestorationInfo rst_info[MAX_MB_PLANE];
RestorationInternal rst_internal;
#if CONFIG_FRAME_SUPERRES
// The numerator of the superres scale, the denominator is fixed
uint8_t superres_scale_numerator;
int superres_width, superres_height;
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_LOOP_RESTORATION
// Flag signaling how frame contexts should be updated at the end of
......
......@@ -2770,7 +2770,7 @@ static void setup_render_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
av1_read_frame_size(rb, &cm->render_width, &cm->render_height);
}
#if CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES
// TODO(afergs): make "struct aom_read_bit_buffer *const rb"?
static void setup_superres_size(AV1_COMMON *const cm,
struct aom_read_bit_buffer *rb, int *width,
......@@ -2800,7 +2800,7 @@ static void setup_superres_size(AV1_COMMON *const cm,
cm->superres_scale_numerator = SUPERRES_SCALE_DENOMINATOR;
}
}
#endif // CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
static void resize_mv_buffer(AV1_COMMON *cm) {
aom_free(cm->cur_frame->mvs);
......@@ -2848,9 +2848,9 @@ static void setup_frame_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
BufferPool *const pool = cm->buffer_pool;
av1_read_frame_size(rb, &width, &height);
setup_render_size(cm, rb);
#if CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES
setup_superres_size(cm, rb, &width, &height);
#endif // CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
resize_context_buffers(cm, width, height);
lock_buffer_pool(pool);
......
......@@ -4400,7 +4400,7 @@ static void write_render_size(const AV1_COMMON *cm,
}
}
#if CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES
static void write_superres_scale(const AV1_COMMON *const cm,
struct aom_write_bit_buffer *wb) {
// This scaling and frame superres are probably incompatible
......@@ -4417,31 +4417,31 @@ static void write_superres_scale(const AV1_COMMON *const cm,
SUPERRES_SCALE_BITS);
}
}
#endif // CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
static void write_frame_size(const AV1_COMMON *cm,
struct aom_write_bit_buffer *wb) {
#if CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES
// If SUPERRES scaling is happening, write the full resolution instead of the
// downscaled resolution. The decoder will reduce this resolution itself.
if (cm->superres_scale_numerator != SUPERRES_SCALE_DENOMINATOR) {
aom_wb_write_literal(wb, cm->superres_width - 1, 16);
aom_wb_write_literal(wb, cm->superres_height - 1, 16);
} else {
#endif // CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
aom_wb_write_literal(wb, cm->width - 1, 16);
aom_wb_write_literal(wb, cm->height - 1, 16);
#if CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES
}
#endif // CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
// TODO(afergs): Also write something different to render_size?
// When superres scales, they'll be almost guaranteed to be
// different on the other side.
write_render_size(cm, wb);
#if CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES
write_superres_scale(cm, wb);
#endif // CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
}
static void write_frame_size_with_refs(AV1_COMP *cpi,
......@@ -4584,10 +4584,10 @@ static void write_uncompressed_header(AV1_COMP *cpi,
}
#endif
#if CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES
// TODO(afergs): Remove - this is just to stop superres from breaking
cm->superres_scale_numerator = SUPERRES_SCALE_DENOMINATOR;
#endif // CONFIG_LOOP_RESTORATION && CONFIG_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
if (cm->frame_type == KEY_FRAME) {
write_sync_code(wb);
......
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