Commit 7b2d1448 authored by Fergus Simpson's avatar Fergus Simpson

Revert "frame_superres: Send scale every frame"

This reverts commit 846d67dd.

Writing the scale every frame was not the right decision. The correct
thing to do will be also writing the superres scale when the size is
set using a previous frame.

Change-Id: I0402e7f6d2b89ac7c386f81e8628198d22db5066
parent 6f9dfa51
......@@ -2885,12 +2885,23 @@ static void setup_render_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
#if CONFIG_FRAME_SUPERRES
// TODO(afergs): make "struct aom_read_bit_buffer *const rb"?
static void setup_superres_scale(AV1_COMMON *const cm,
struct aom_read_bit_buffer *rb) {
static void setup_superres_size(AV1_COMMON *const cm,
struct aom_read_bit_buffer *rb, int *width,
int *height) {
// TODO(afergs): Save input resolution - it's the upscaled resolution
if (aom_rb_read_bit(rb)) {
cm->superres_scale_numerator =
(uint8_t)aom_rb_read_literal(rb, SUPERRES_SCALE_BITS);
cm->superres_scale_numerator += SUPERRES_SCALE_NUMERATOR_MIN;
// Don't edit cm->width or cm->height directly, or the buffers won't get
// resized correctly
// TODO(afergs): Should the render resolution not be modified? It's the same
// by default (ie. when it isn't sent)...
// resize_context_buffers() will change cm->width to equal cm->render_width,
// then they'll be the same again
*width = *width * cm->superres_scale_numerator / SUPERRES_SCALE_DENOMINATOR;
*height =
*width * cm->superres_scale_numerator / SUPERRES_SCALE_DENOMINATOR;
} else {
// 1:1 scaling - ie. no scaling, scale not provided
cm->superres_scale_numerator = SUPERRES_SCALE_DENOMINATOR;
......@@ -2943,8 +2954,11 @@ static void setup_frame_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
int width, height;
BufferPool *const pool = cm->buffer_pool;
av1_read_frame_size(rb, &width, &height);
resize_context_buffers(cm, width, height);
setup_render_size(cm, rb);
#if CONFIG_FRAME_SUPERRES
setup_superres_size(cm, rb, &width, &height);
#endif // CONFIG_FRAME_SUPERRES
resize_context_buffers(cm, width, height);
lock_buffer_pool(pool);
if (aom_realloc_frame_buffer(
......@@ -3000,6 +3014,9 @@ static void setup_frame_size_with_refs(AV1_COMMON *cm,
if (!found) {
av1_read_frame_size(rb, &width, &height);
setup_render_size(cm, rb);
#if CONFIG_FRAME_SUPERRES
setup_superres_size(cm, rb, &width, &height);
#endif // CONFIG_FRAME_SUPERRES
}
if (width <= 0 || height <= 0)
......@@ -4414,9 +4431,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
set_sb_size(cm, BLOCK_64X64);
#endif // CONFIG_EXT_PARTITION
#if CONFIG_FRAME_SUPERRES
setup_superres_scale(cm, rb);
#endif // CONFIG_FRAME_SUPERRES
setup_loopfilter(cm, rb);
#if CONFIG_CDEF
setup_cdef(cm, rb);
......
......@@ -4128,7 +4128,7 @@ static void write_superres_scale(const AV1_COMMON *const cm,
aom_wb_write_bit(wb, 0); // no scaling
} else {
aom_wb_write_bit(wb, 1); // scaling, write scale factor
// TODO(afergs): write factor to the compressed header instead?
// TODO(afergs): write factor to the compressed header instead
aom_wb_write_literal(
wb, cm->superres_scale_numerator - SUPERRES_SCALE_NUMERATOR_MIN,
SUPERRES_SCALE_BITS);
......@@ -4142,6 +4142,9 @@ static void write_frame_size(const AV1_COMMON *cm,
aom_wb_write_literal(wb, cm->height - 1, 16);
write_render_size(cm, wb);
#if CONFIG_FRAME_SUPERRES
write_superres_scale(cm, wb);
#endif // CONFIG_FRAME_SUPERRES
}
static void write_frame_size_with_refs(AV1_COMP *cpi,
......@@ -4443,9 +4446,6 @@ static void write_uncompressed_header(AV1_COMP *cpi,
assert(cm->sb_size == BLOCK_64X64);
#endif // CONFIG_EXT_PARTITION
#if CONFIG_FRAME_SUPERRES
write_superres_scale(cm, wb);
#endif // CONFIG_FRAME_SUPERRES
encode_loopfilter(cm, wb);
#if CONFIG_CDEF
encode_cdef(cm, 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