Merge FRAME_SUPERRES into HORZONLY_FRAME_SUPERRES.
Change-Id: I5fc45fa9fe6a354ae34001f48850eb68364a5a79
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 7114830..73db844 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3356,7 +3356,7 @@
}
}
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
static void write_superres_scale(const AV1_COMMON *const cm,
struct aom_write_bit_buffer *wb) {
// First bit is whether to to scale or not
@@ -3372,7 +3372,7 @@
SUPERRES_SCALE_BITS);
}
}
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_FRAME_SIZE
static void write_frame_size(const AV1_COMMON *cm, int frame_size_override,
@@ -3382,13 +3382,13 @@
struct aom_write_bit_buffer *wb)
#endif
{
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
const int coded_width = cm->superres_upscaled_width - 1;
const int coded_height = cm->superres_upscaled_height - 1;
#else
const int coded_width = cm->width - 1;
const int coded_height = cm->height - 1;
-#endif
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_FRAME_SIZE
if (frame_size_override) {
@@ -3403,9 +3403,9 @@
aom_wb_write_literal(wb, coded_height, 16);
#endif
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
write_superres_scale(cm, wb);
-#endif
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
write_render_size(cm, wb);
}
@@ -3419,21 +3419,21 @@
YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, ref_frame);
if (cfg != NULL) {
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
found = cm->superres_upscaled_width == cfg->y_crop_width &&
cm->superres_upscaled_height == cfg->y_crop_height;
#else
found =
cm->width == cfg->y_crop_width && cm->height == cfg->y_crop_height;
-#endif
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
found &= cm->render_width == cfg->render_width &&
cm->render_height == cfg->render_height;
}
aom_wb_write_bit(wb, found);
if (found) {
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
write_superres_scale(cm, wb);
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
break;
}
}
@@ -3739,13 +3739,13 @@
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Frame dimensions are larger than the maximum values");
}
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
const int coded_width = cm->superres_upscaled_width;
const int coded_height = cm->superres_upscaled_height;
#else
const int coded_width = cm->width;
const int coded_height = cm->height;
-#endif
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
int frame_size_override_flag =
(coded_width != cm->seq_params.max_frame_width ||
coded_height != cm->seq_params.max_frame_height);
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index d68444c..170d403 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -3995,13 +3995,13 @@
#else
if (cm->prev_frame) {
cm->use_prev_frame_mvs = !cm->error_resilient_mode &&
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
cm->width == cm->last_width &&
cm->height == cm->last_height &&
#else
cm->width == cm->prev_frame->buf.y_crop_width &&
cm->height == cm->prev_frame->buf.y_crop_height &&
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
!cm->intra_only && cm->last_show_frame;
} else {
cm->use_prev_frame_mvs = 0;
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index ee3d40a..96a6fd8 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -789,11 +789,11 @@
#if CONFIG_LOOP_RESTORATION
if (aom_realloc_frame_buffer(
&cpi->trial_frame_rst,
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
cm->superres_upscaled_width, cm->superres_upscaled_height,
#else
cm->width, cm->height,
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
cm->subsampling_x, cm->subsampling_y,
#if CONFIG_HIGHBITDEPTH
cm->use_highbitdepth,
@@ -3150,11 +3150,11 @@
#endif
av1_loop_filter_init(cm);
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
cm->superres_scale_denominator = SCALE_NUMERATOR;
cm->superres_upscaled_width = oxcf->width;
cm->superres_upscaled_height = oxcf->height;
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_LOOP_RESTORATION
av1_loop_restoration_precal();
#endif // CONFIG_LOOP_RESTORATION
@@ -4366,13 +4366,13 @@
"Failed to allocate frame buffer");
#if CONFIG_LOOP_RESTORATION
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
const int frame_width = cm->superres_upscaled_width;
const int frame_height = cm->superres_upscaled_height;
#else
const int frame_width = cm->width;
const int frame_height = cm->height;
-#endif
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
set_restoration_unit_size(frame_width, frame_height, cm->subsampling_x,
cm->subsampling_y, cm->rst_info);
for (int i = 0; i < MAX_MB_PLANE; ++i)
@@ -4442,7 +4442,7 @@
return new_denom;
}
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
static uint8_t calculate_next_superres_scale(AV1_COMP *cpi) {
// Choose an arbitrary random number
@@ -4486,9 +4486,9 @@
}
static int dimensions_are_ok(int owidth, int oheight, size_params_type *rsz) {
- return dimension_is_ok(owidth, rsz->resize_width, rsz->superres_denom) &&
- (CONFIG_HORZONLY_FRAME_SUPERRES ||
- dimension_is_ok(oheight, rsz->resize_height, rsz->superres_denom));
+ // Only need to check the width, as scaling is horizontal only.
+ (void)oheight;
+ return dimension_is_ok(owidth, rsz->resize_width, rsz->superres_denom);
}
static int validate_size_scales(RESIZE_MODE resize_mode,
@@ -4546,7 +4546,7 @@
}
return dimensions_are_ok(owidth, oheight, rsz);
}
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
// Calculates resize and superres params for next frame
size_params_type av1_calculate_next_size_params(AV1_COMP *cpi) {
@@ -4554,9 +4554,9 @@
size_params_type rsz = {
oxcf->width,
oxcf->height,
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
SCALE_NUMERATOR
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
};
int resize_denom;
if (oxcf->pass == 1) return rsz;
@@ -4571,12 +4571,12 @@
av1_calculate_scaled_size(&rsz.resize_width, &rsz.resize_height,
resize_denom);
}
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
rsz.superres_denom = calculate_next_superres_scale(cpi);
if (!validate_size_scales(oxcf->resize_mode, oxcf->superres_mode, oxcf->width,
oxcf->height, &rsz))
assert(0 && "Invalid scale parameters");
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
return rsz;
}
@@ -4584,14 +4584,14 @@
int encode_width = rsz->resize_width;
int encode_height = rsz->resize_height;
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
AV1_COMMON *cm = &cpi->common;
cm->superres_upscaled_width = encode_width;
cm->superres_upscaled_height = encode_height;
cm->superres_scale_denominator = rsz->superres_denom;
av1_calculate_scaled_superres_size(&encode_width, &encode_height,
rsz->superres_denom);
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
set_frame_size(cpi, encode_width, encode_height);
}
@@ -4600,7 +4600,7 @@
setup_frame_size_from_params(cpi, &rsz);
}
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
static void superres_post_encode(AV1_COMP *cpi) {
AV1_COMMON *cm = &cpi->common;
@@ -4639,7 +4639,7 @@
cpi->source = &cpi->scaled_source;
}
}
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
MACROBLOCKD *xd = &cpi->td.mb.e_mbd;
@@ -4728,12 +4728,12 @@
}
#if CONFIG_STRIPED_LOOP_RESTORATION
-#if CONFIG_FRAME_SUPERRES && CONFIG_HORZONLY_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
if (!av1_superres_unscaled(cm)) aom_extend_frame_borders(cm->frame_to_show);
-#endif
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
if (!no_restoration)
av1_loop_restoration_save_boundary_lines(cm->frame_to_show, cm, 0);
-#endif
+#endif // CONFIG_STRIPED_LOOP_RESTORATION
if (no_cdef) {
cm->cdef_bits = 0;
@@ -4749,9 +4749,9 @@
av1_cdef_frame(cm->frame_to_show, cm, xd);
}
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
superres_post_encode(cpi);
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_LOOP_RESTORATION
if (no_restoration) {
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 46371b4..f84485e 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -124,7 +124,7 @@
RESIZE_RANDOM = 2, // All frames are coded at a random scale.
RESIZE_MODES
} RESIZE_MODE;
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
typedef enum {
SUPERRES_NONE = 0, // No frame superres allowed
SUPERRES_FIXED = 1, // All frames are coded at the specified scale,
@@ -135,7 +135,7 @@
// q_index
SUPERRES_MODES
} SUPERRES_MODE;
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
typedef struct AV1EncoderConfig {
BITSTREAM_PROFILE profile;
@@ -213,14 +213,14 @@
uint8_t resize_scale_denominator;
uint8_t resize_kf_scale_denominator;
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
// Frame Super-Resolution size scaling.
SUPERRES_MODE superres_mode;
uint8_t superres_scale_denominator;
uint8_t superres_kf_scale_denominator;
int superres_qthresh;
int superres_kf_qthresh;
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
// Enable feature to reduce the frame quantization every x frames.
int frame_periodic_boost;
@@ -798,20 +798,20 @@
// Returns 1 if a frame is unscaled and 0 otherwise.
static INLINE int av1_resize_unscaled(const AV1_COMMON *cm) {
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
return cm->superres_upscaled_width == cm->render_width &&
cm->superres_upscaled_height == cm->render_height;
#else
return cm->width == cm->render_width && cm->height == cm->render_height;
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
}
static INLINE int av1_frame_unscaled(const AV1_COMMON *cm) {
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
return av1_superres_unscaled(cm) && av1_resize_unscaled(cm);
#else
return av1_resize_unscaled(cm);
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
}
#ifdef __cplusplus
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h
index 4bf4959..db51eed 100644
--- a/av1/encoder/ratectrl.h
+++ b/av1/encoder/ratectrl.h
@@ -50,9 +50,9 @@
typedef struct {
int resize_width;
int resize_height;
-#if CONFIG_FRAME_SUPERRES
+#if CONFIG_HORZONLY_FRAME_SUPERRES
uint8_t superres_denom;
-#endif // CONFIG_FRAME_SUPERRES
+#endif // CONFIG_HORZONLY_FRAME_SUPERRES
} size_params_type;
typedef struct {