Commit 94ad3707 authored by Urvang Joshi's avatar Urvang Joshi
Browse files

Merge FRAME_SUPERRES into HORZONLY_FRAME_SUPERRES.

Change-Id: I5fc45fa9fe6a354ae34001f48850eb68364a5a79
parent a0bba1b2
......@@ -303,7 +303,7 @@ static const arg_def_t resize_denominator =
ARG_DEF(NULL, "resize-denominator", 1, "Frame resize denominator");
static const arg_def_t resize_kf_denominator = ARG_DEF(
NULL, "resize-kf-denominator", 1, "Frame resize keyframe denominator");
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
static const arg_def_t superres_mode =
ARG_DEF(NULL, "superres-mode", 1, "Frame super-resolution mode");
static const arg_def_t superres_denominator = ARG_DEF(
......@@ -316,7 +316,7 @@ static const arg_def_t superres_qthresh = ARG_DEF(
static const arg_def_t superres_kf_qthresh =
ARG_DEF(NULL, "superres-kf-qthresh", 1,
"Frame super-resolution keyframe qindex threshold");
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
static const struct arg_enum_list end_usage_enum[] = { { "vbr", AOM_VBR },
{ "cbr", AOM_CBR },
{ "cq", AOM_CQ },
......@@ -344,13 +344,13 @@ static const arg_def_t *rc_args[] = { &dropframe_thresh,
&resize_mode,
&resize_denominator,
&resize_kf_denominator,
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
&superres_mode,
&superres_denominator,
&superres_kf_denominator,
&superres_qthresh,
&superres_kf_qthresh,
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
&end_usage,
&target_bitrate,
&min_quantizer,
......@@ -1119,7 +1119,7 @@ static int parse_stream_params(struct AvxEncoderConfig *global,
config->cfg.rc_resize_denominator = arg_parse_uint(&arg);
} else if (arg_match(&arg, &resize_kf_denominator, argi)) {
config->cfg.rc_resize_kf_denominator = arg_parse_uint(&arg);
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
} else if (arg_match(&arg, &superres_mode, argi)) {
config->cfg.rc_superres_mode = arg_parse_uint(&arg);
} else if (arg_match(&arg, &superres_denominator, argi)) {
......@@ -1130,7 +1130,7 @@ static int parse_stream_params(struct AvxEncoderConfig *global,
config->cfg.rc_superres_qthresh = arg_parse_uint(&arg);
} else if (arg_match(&arg, &superres_kf_qthresh, argi)) {
config->cfg.rc_superres_kf_qthresh = arg_parse_uint(&arg);
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
} else if (arg_match(&arg, &end_usage, argi)) {
config->cfg.rc_end_usage = arg_parse_enum_or_int(&arg);
} else if (arg_match(&arg, &target_bitrate, argi)) {
......@@ -1346,13 +1346,13 @@ static void show_stream_config(struct stream_state *stream,
SHOW(rc_resize_mode);
SHOW(rc_resize_denominator);
SHOW(rc_resize_kf_denominator);
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
SHOW(rc_superres_mode);
SHOW(rc_superres_denominator);
SHOW(rc_superres_kf_denominator);
SHOW(rc_superres_qthresh);
SHOW(rc_superres_kf_qthresh);
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
SHOW(rc_end_usage);
SHOW(rc_target_bitrate);
SHOW(rc_min_quantizer);
......
......@@ -253,7 +253,7 @@ static aom_codec_err_t validate_config(aom_codec_alg_priv_t *ctx,
SCALE_NUMERATOR << 1);
RANGE_CHECK(cfg, rc_resize_kf_denominator, SCALE_NUMERATOR,
SCALE_NUMERATOR << 1);
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
RANGE_CHECK_HI(cfg, rc_superres_mode, SUPERRES_MODES - 1);
RANGE_CHECK(cfg, rc_superres_denominator, SCALE_NUMERATOR,
SCALE_NUMERATOR << 1);
......@@ -261,7 +261,7 @@ static aom_codec_err_t validate_config(aom_codec_alg_priv_t *ctx,
SCALE_NUMERATOR << 1);
RANGE_CHECK(cfg, rc_superres_qthresh, 1, 63);
RANGE_CHECK(cfg, rc_superres_kf_qthresh, 1, 63);
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
// AV1 does not support a lower bound on the keyframe interval in
// automatic keyframe placement mode.
......@@ -534,7 +534,7 @@ static aom_codec_err_t set_encoder_config(
oxcf->resize_kf_scale_denominator == SCALE_NUMERATOR)
oxcf->resize_mode = RESIZE_NONE;
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
oxcf->superres_mode = (SUPERRES_MODE)cfg->rc_superres_mode;
oxcf->superres_scale_denominator = (uint8_t)cfg->rc_superres_denominator;
oxcf->superres_kf_scale_denominator =
......@@ -553,7 +553,7 @@ static aom_codec_err_t set_encoder_config(
if (oxcf->superres_mode == SUPERRES_QTHRESH &&
oxcf->superres_qthresh == 255 && oxcf->superres_kf_qthresh == 255)
oxcf->superres_mode = SUPERRES_NONE;
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
oxcf->maximum_buffer_size_ms = is_vbr ? 240000 : cfg->rc_buf_sz;
oxcf->starting_buffer_level_ms = is_vbr ? 60000 : cfg->rc_buf_initial_sz;
......
......@@ -141,11 +141,11 @@ void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
// Now we need to allocate enough space to store the line buffers for the
// stripes
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
const int frame_w = cm->superres_upscaled_width;
#else
const int frame_w = cm->width;
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_HIGHBITDEPTH
const int use_highbd = cm->use_highbitdepth ? 1 : 0;
#else
......
......@@ -58,7 +58,7 @@ specialize qw/av1_convolve_horiz ssse3/;
add_proto qw/void av1_convolve_vert/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, ConvolveParams *conv_params";
specialize qw/av1_convolve_vert ssse3/;
if (aom_config("CONFIG_FRAME_SUPERRES") eq "yes") {
if (aom_config("CONFIG_HORZONLY_FRAME_SUPERRES") eq "yes") {
add_proto qw/void av1_convolve_horiz_rs/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const int16_t *x_filters, int interp_taps, const int x0_qn, const int x_step_qn";
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
add_proto qw/void av1_highbd_convolve_horiz_rs/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const int16_t *x_filters, int interp_taps, const int x0_qn, const int x_step_qn, int bd";
......
......@@ -25,7 +25,7 @@
#define MAX_BLOCK_HEIGHT (MAX_SB_SIZE)
#define MAX_STEP (32)
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
#define UPSCALE_PROC_UNIT 64 // Source step (roughly)
#define UPSCALE_PROC_UNIT_SCALE (UPSCALE_PROC_UNIT / SCALE_NUMERATOR)
......@@ -77,7 +77,7 @@ void av1_highbd_convolve_horiz_rs_c(const uint16_t *src, int src_stride,
}
}
#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
void av1_convolve_horiz_c(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h,
......
......@@ -693,10 +693,10 @@ typedef enum ATTRIBUTE_PACKED {
} RestorationType;
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
#define SUPERRES_SCALE_BITS 3
#define SUPERRES_SCALE_DENOMINATOR_MIN (SCALE_NUMERATOR + 1)
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#ifdef __cplusplus
} // extern "C"
......
......@@ -404,12 +404,12 @@ typedef struct AV1Common {
InterpFilter interp_filter;
loop_filter_info_n lf_info;
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
// The denominator of the superres scale; the numerator is fixed.
uint8_t superres_scale_denominator;
int superres_upscaled_width;
int superres_upscaled_height;
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_LOOP_RESTORATION
RestorationInfo rst_info[MAX_MB_PLANE];
......
......@@ -207,14 +207,7 @@ static const InterpKernel filteredinterp_filters1000[(1 << RS_SUBPEL_BITS)] = {
{ 0, 1, -2, 4, 127, -3, 1, 0 }, { 0, 0, -1, 2, 128, -1, 0, 0 },
};
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
#define UPSCALE_NORMATIVE_TAPS 8
#else
#define UPSCALE_NORMATIVE_TAPS 6
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
const int16_t av1_resize_filter_normative[(
1 << RS_SUBPEL_BITS)][UPSCALE_NORMATIVE_TAPS] = {
#if UPSCALE_NORMATIVE_TAPS == 2
......@@ -322,7 +315,7 @@ const int16_t av1_resize_filter_normative[(
#error "Invalid value of UPSCALE_NORMATIVE_TAPS"
#endif // UPSCALE_NORMATIVE_TAPS == 2
};
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
// Filters for factor of 2 downsampling.
static const int16_t av1_down2_symeven_half_filter[] = { 56, 12, -3, -1 };
......@@ -433,7 +426,7 @@ static void interpolate(const uint8_t *const input, int in_length,
SUBPEL_TAPS);
}
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
#define UPSCALE_PROC_UNIT 0 // Source step (roughly), 0: do not use
#define UPSCALE_PROC_UNIT_SCALE (UPSCALE_PROC_UNIT / SCALE_NUMERATOR)
......@@ -452,59 +445,7 @@ static int32_t get_upscale_convolve_x0(int in_length, int out_length,
RS_SCALE_EXTRA_OFF - err / 2;
return (int32_t)((uint32_t)x0 & RS_SCALE_SUBPEL_MASK);
}
#if !CONFIG_HORZONLY_FRAME_SUPERRES
static void interpolate_normative_core(const uint8_t *const src, int in_length,
uint8_t *dst, int out_length,
int superres_denom,
const int16_t *interp_filters,
int interp_taps) {
(void)superres_denom;
assert(in_length < out_length);
const int32_t x_step_qn =
av1_get_upscale_convolve_step(in_length, out_length);
const int32_t x0_qn =
get_upscale_convolve_x0(in_length, out_length, x_step_qn);
// Note since we are upscaling, the first output sample is located before
// the first input sample. Hence srcp = src - 1 + ... below
const uint8_t *srcp = src - 1;
#if UPSCALE_PROC_UNIT
int32_t x0 = x0_qn;
const int oproc_unit = UPSCALE_PROC_UNIT_SCALE * superres_denom;
int olen = oproc_unit;
for (int op = 0; op < out_length; op += olen) {
olen = AOMMIN(oproc_unit, out_length - op);
av1_convolve_horiz_rs(srcp, 0, dst + op, 0, olen, 1, interp_filters,
interp_taps, x0, x_step_qn);
x0 += olen * x_step_qn;
// Note srcp may advance by UPSCALE_PROC_UNIT +/- 1
srcp += (x0 >> RS_SCALE_SUBPEL_BITS);
x0 &= RS_SCALE_SUBPEL_MASK;
}
#else
av1_convolve_horiz_rs(srcp, 0, dst, 0, out_length, 1, interp_filters,
interp_taps, x0_qn, x_step_qn);
#endif // UPSCALE_PROC_UNIT
}
static void interpolate_normative(const uint8_t *const input, int in_length,
uint8_t *output, int out_length,
int superres_denom) {
uint8_t *intbuf_alloc = (uint8_t *)aom_malloc(
sizeof(*input) * (in_length + UPSCALE_NORMATIVE_TAPS + 2));
uint8_t *intbuf = intbuf_alloc + UPSCALE_NORMATIVE_TAPS / 2 + 1;
memcpy(intbuf, input, sizeof(*intbuf) * in_length);
for (int k = 0; k < UPSCALE_NORMATIVE_TAPS / 2 + 1; ++k) {
intbuf[-k - 1] = intbuf[0];
intbuf[in_length + k] = intbuf[in_length - 1];
}
interpolate_normative_core(intbuf, in_length, output, out_length,
superres_denom, &av1_resize_filter_normative[0][0],
UPSCALE_NORMATIVE_TAPS);
aom_free(intbuf_alloc);
}
#endif // !CONFIG_HORZONLY_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#ifndef __clang_analyzer__
static void down2_symeven(const uint8_t *const input, int length,
......@@ -718,7 +659,7 @@ Error:
aom_free(arrbuf2);
}
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
static void upscale_normative_plane(const uint8_t *const input, int height,
int width, int in_stride, uint8_t *output,
int height2, int width2, int out_stride,
......@@ -727,7 +668,6 @@ static void upscale_normative_plane(const uint8_t *const input, int height,
assert(height > 0);
assert(width2 > 0);
assert(height2 > 0);
#if CONFIG_HORZONLY_FRAME_SUPERRES
(void)height;
(void)height2;
(void)superres_denom;
......@@ -737,27 +677,8 @@ static void upscale_normative_plane(const uint8_t *const input, int height,
av1_convolve_horiz_rs(input - 1, in_stride, output, out_stride, width2,
height2, &av1_resize_filter_normative[0][0],
UPSCALE_NORMATIVE_TAPS, x0_qn, x_step_qn);
#else
uint8_t *intbuf = (uint8_t *)aom_malloc(sizeof(uint8_t) * width2 * height);
uint8_t *arrbuf = (uint8_t *)aom_malloc(sizeof(uint8_t) * height);
uint8_t *arrbuf2 = (uint8_t *)aom_malloc(sizeof(uint8_t) * height2);
if (intbuf == NULL || arrbuf == NULL || arrbuf2 == NULL) goto Error;
for (int i = 0; i < height; ++i)
interpolate_normative(input + in_stride * i, width, intbuf + width2 * i,
width2, superres_denom);
for (int i = 0; i < width2; ++i) {
fill_col_to_arr(intbuf + i, width2, height, arrbuf);
interpolate_normative(arrbuf, height, arrbuf2, height2, superres_denom);
fill_arr_to_col(output + i, out_stride, height2, arrbuf2);
}
Error:
aom_free(intbuf);
aom_free(arrbuf);
aom_free(arrbuf2);
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
}
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_HIGHBITDEPTH
static void highbd_interpolate_core(const uint16_t *const input, int in_length,
......@@ -852,62 +773,6 @@ static void highbd_interpolate(const uint16_t *const input, int in_length,
&interp_filters[0][0], SUBPEL_TAPS);
}
#if CONFIG_FRAME_SUPERRES
#if !CONFIG_HORZONLY_FRAME_SUPERRES
static void highbd_interpolate_normative_core(const uint16_t *const src,
int in_length, uint16_t *dst,
int out_length,
int superres_denom, int bd,
const int16_t *interp_filters,
int interp_taps) {
(void)superres_denom;
assert(in_length < out_length);
const int32_t x_step_qn =
av1_get_upscale_convolve_step(in_length, out_length);
const int32_t x0_qn =
get_upscale_convolve_x0(in_length, out_length, x_step_qn);
// Note since we are upscaling, the first output sample is located before
// the first input sample. Hence srcp = src - 1 + ... below
const uint16_t *srcp = src - 1;
#if UPSCALE_PROC_UNIT
int32_t x0 = x0_qn;
const int oproc_unit = UPSCALE_PROC_UNIT_SCALE * superres_denom;
int olen = oproc_unit;
for (int op = 0; op < out_length; op += olen) {
olen = AOMMIN(oproc_unit, out_length - op);
av1_highbd_convolve_horiz_rs(srcp, 0, dst + op, 0, olen, 1, interp_filters,
interp_taps, x0, x_step_qn, bd);
x0 += olen * x_step_qn;
// Note srcp may advance by UPSCALE_PROC_UNIT +/- 1
srcp += (x0 >> RS_SCALE_SUBPEL_BITS);
x0 &= RS_SCALE_SUBPEL_MASK;
}
#else
av1_highbd_convolve_horiz_rs(srcp, 0, dst, 0, out_length, 1, interp_filters,
interp_taps, x0_qn, x_step_qn, bd);
#endif // UPSCALE_PROC_UNIT
}
static void highbd_interpolate_normative(const uint16_t *const input,
int in_length, uint16_t *output,
int out_length, int bd,
int superres_denom) {
uint16_t *intbuf_alloc = (uint16_t *)aom_malloc(
sizeof(*input) * (in_length + UPSCALE_NORMATIVE_TAPS + 2));
uint16_t *intbuf = intbuf_alloc + UPSCALE_NORMATIVE_TAPS / 2 + 1;
memcpy(intbuf, input, sizeof(*intbuf) * in_length);
for (int k = 0; k < UPSCALE_NORMATIVE_TAPS / 2 + 1; ++k) {
intbuf[-k - 1] = intbuf[0];
intbuf[in_length + k] = intbuf[in_length - 1];
}
highbd_interpolate_normative_core(
intbuf, in_length, output, out_length, superres_denom, bd,
&av1_resize_filter_normative[0][0], UPSCALE_NORMATIVE_TAPS);
aom_free(intbuf_alloc);
}
#endif // !CONFIG_HORZONLY_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
#ifndef __clang_analyzer__
static void highbd_down2_symeven(const uint16_t *const input, int length,
uint16_t *output, int bd) {
......@@ -1104,7 +969,7 @@ Error:
aom_free(arrbuf2);
}
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
static void highbd_upscale_normative_plane(const uint8_t *const input,
int height, int width, int in_stride,
uint8_t *output, int height2,
......@@ -1114,7 +979,6 @@ static void highbd_upscale_normative_plane(const uint8_t *const input,
assert(height > 0);
assert(width2 > 0);
assert(height2 > 0);
#if CONFIG_HORZONLY_FRAME_SUPERRES
(void)height;
(void)height2;
(void)superres_denom;
......@@ -1125,31 +989,8 @@ static void highbd_upscale_normative_plane(const uint8_t *const input,
CONVERT_TO_SHORTPTR(output), out_stride, width2,
height2, &av1_resize_filter_normative[0][0],
UPSCALE_NORMATIVE_TAPS, x0_qn, x_step_qn, bd);
#else
uint16_t *intbuf = (uint16_t *)aom_malloc(sizeof(uint16_t) * width2 * height);
uint16_t *arrbuf = (uint16_t *)aom_malloc(sizeof(uint16_t) * height);
uint16_t *arrbuf2 = (uint16_t *)aom_malloc(sizeof(uint16_t) * height2);
if (intbuf == NULL || arrbuf == NULL || arrbuf2 == NULL) goto Error;
for (int i = 0; i < height; ++i) {
highbd_interpolate_normative(CONVERT_TO_SHORTPTR(input + in_stride * i),
width, intbuf + width2 * i, width2,
superres_denom, bd);
}
for (int i = 0; i < width2; ++i) {
highbd_fill_col_to_arr(intbuf + i, width2, height, arrbuf);
highbd_interpolate_normative(arrbuf, height, arrbuf2, height2,
superres_denom, bd);
highbd_fill_arr_to_col(CONVERT_TO_SHORTPTR(output + i), out_stride, height2,
arrbuf2);
}
Error:
aom_free(intbuf);
aom_free(arrbuf);
aom_free(arrbuf2);
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
}
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#endif // CONFIG_HIGHBITDEPTH
......@@ -1268,7 +1109,7 @@ void av1_resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
aom_extend_frame_borders(dst);
}
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_HIGHBITDEPTH
void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst,
......@@ -1307,7 +1148,7 @@ void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src,
}
aom_extend_frame_borders(dst);
}
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
YV12_BUFFER_CONFIG *unscaled,
......@@ -1342,14 +1183,11 @@ void av1_calculate_scaled_size(int *width, int *height, int resize_denom) {
calculate_scaled_size_helper(height, resize_denom);
}
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
void av1_calculate_scaled_superres_size(int *width, int *height,
int superres_denom) {
(void)height;
calculate_scaled_size_helper(width, superres_denom);
#if !CONFIG_HORZONLY_FRAME_SUPERRES
calculate_scaled_size_helper(height, superres_denom);
#endif // !CONFIG_HORZONLY_FRAME_SUPERRES
}
void av1_calculate_unscaled_superres_size(int *width, int *height, int denom) {
......@@ -1357,11 +1195,7 @@ void av1_calculate_unscaled_superres_size(int *width, int *height, int denom) {
// Note: av1_calculate_scaled_superres_size() rounds *up* after division
// when the resulting dimensions are odd. So here, we round *down*.
*width = *width * denom / SCALE_NUMERATOR;
#if CONFIG_HORZONLY_FRAME_SUPERRES
(void)height;
#else
*height = *height * denom / SCALE_NUMERATOR;
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
}
}
......@@ -1438,8 +1272,6 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) {
// Scale up and back into frame_to_show.
assert(frame_to_show->y_crop_width != cm->width);
assert(IMPLIES(!CONFIG_HORZONLY_FRAME_SUPERRES,
frame_to_show->y_crop_height != cm->height));
#if CONFIG_HIGHBITDEPTH
av1_upscale_normative_and_extend_frame(&copy_buffer, frame_to_show,
cm->superres_scale_denominator,
......@@ -1452,4 +1284,4 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) {
// Free the copy buffer
aom_free_frame_buffer(&copy_buffer);
}
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
......@@ -71,7 +71,7 @@ void av1_resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst);
#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_HIGHBITDEPTH
void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst,
......@@ -81,7 +81,7 @@ void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst,
int superres_denom);
#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
YV12_BUFFER_CONFIG *unscaled,
......@@ -91,7 +91,7 @@ YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
// resize scale denominator.
void av1_calculate_scaled_size(int *width, int *height, int resize_denom);
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
// Similar to above, but calculates scaled dimensions after superres from the
// given original dimensions and superres scale denominator.
void av1_calculate_scaled_superres_size(int *width, int *height,
......@@ -108,20 +108,16 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool);
static INLINE int av1_superres_unscaled(const AV1_COMMON *cm) {
return (cm->superres_scale_denominator == SCALE_NUMERATOR);
}
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION
#if CONFIG_HORZONLY_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION
#define UPSCALE_NORMATIVE_TAPS 8
#else
#define UPSCALE_NORMATIVE_TAPS 6
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
extern const int16_t av1_resize_filter_normative[1 << RS_SUBPEL_BITS]
[UPSCALE_NORMATIVE_TAPS];
int32_t av1_get_upscale_convolve_step(int in_length, int out_length);
#endif
#endif // CONFIG_HORZONLY_FRAME_SUPERRES && CONFIG_LOOP_RESTORATION
#ifdef __cplusplus
} // extern "C"
......
......@@ -17,7 +17,7 @@
#include "./aom_scale_rtcd.h"
#include "aom_mem/aom_mem.h"
#include "av1/common/onyxc_int.h"
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
#include "av1/common/resize.h"
#endif
#include "av1/common/restoration.h"
......@@ -1616,7 +1616,7 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
const int mi_size_x = MI_SIZE >> ss_x;
const int mi_size_y = MI_SIZE >> ss_y;
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
// Write m for the relative mi column or row, D for the superres denominator
// and N for the superres numerator. If u is the upscaled (called "unscaled"
// elsewhere) pixel offset then we can write the downscaled pixel offset in
......@@ -1626,17 +1626,15 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
//
// from which we get u = D * MI_SIZE * m / N
const int mi_to_num_x = mi_size_x * cm->superres_scale_denominator;
const int mi_to_num_y =
mi_size_y *
(CONFIG_HORZONLY_FRAME_SUPERRES ? 1 : cm->superres_scale_denominator);
const int mi_to_num_y = mi_size_y;
const int denom_x = size * SCALE_NUMERATOR;
const int denom_y = CONFIG_HORZONLY_FRAME_SUPERRES ? size : denom_x;
const int denom_y = size;
#else
const int mi_to_num_x = mi_size_x;
const int mi_to_num_y = mi_size_y;
const int denom_x = size;
const int denom_y = size;
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
const int rnd_x = denom_x - 1;
const int rnd_y = denom_y - 1;
......@@ -1707,7 +1705,7 @@ static void save_deblock_boundary_lines(
assert(row + RESTORATION_CTX_VERT <= src_height);
#endif // NDEBUG
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
const int ss_x = is_uv && cm->subsampling_x;
const int upscaled_width = (cm->superres_upscaled_width + ss_x) >> ss_x;
const int step = av1_get_upscale_convolve_step(src_width, upscaled_width);
......@@ -1731,7 +1729,7 @@ static void save_deblock_boundary_lines(
for (int i = 0; i < RESTORATION_CTX_VERT; i++) {
memcpy(bdry_rows + i * bdry_stride, src_rows + i * src_stride, line_bytes);
}
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
extend_lines(bdry_rows, upscaled_width, RESTORATION_CTX_VERT, bdry_stride,
RESTORATION_EXTRA_HORZ, use_highbd);
}
......@@ -1751,7 +1749,7 @@ static void save_cdef_boundary_lines(const YV12_BUFFER_CONFIG *frame,
const int bdry_stride = boundaries->stripe_boundary_stride << use_highbd;
uint8_t *bdry_rows = bdry_start + RESTORATION_CTX_VERT * stripe * bdry_stride;
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
// At the point where this function is called, we've already applied
// superres. So we don't need to extend the lines here, we can just
// pull directly from the topmost row of the upscaled frame.
......@@ -1761,7 +1759,7 @@ static void save_cdef_boundary_lines(const YV12_BUFFER_CONFIG *frame,
(void)cm;
const int src_width = frame->crop_widths[is_uv];
const int upscaled_width = src_width;
#endif // CONFIG_FRAME_SUPERRES
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
const int line_bytes = upscaled_width << use_highbd;
for (int i = 0; i < RESTORATION_CTX_VERT; i++) {
// Copy the line at 'row' into both context lines. This is because
......
......@@ -11,9 +11,9 @@
#include "av1/common/tile_common.h"
#include "av1/common/onyxc_int.h"
#if CONFIG_FRAME_SUPERRES
#if CONFIG_HORZONLY_FRAME_SUPERRES
#include "av1/common/resize.h"
#endif
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
#include "aom_dsp/aom_dsp_common.h"
#if CONFIG_DEPENDENT_HORZTILES
......@@ -252,7 +252,7 @@ AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info, const AV1_COMMON *cm,
r.top = (tile_info->mi_row_start * MI_SIZE + ss_y) >> ss_y;