Commit 1fee28bd authored by David Barker's avatar David Barker Committed by Debargha Mukherjee

Harmonize superres + loop-restoration + lf-across-tiles

Properly support loopfiltering-across-tiles in combination with
superres and/or loop-restoration:

Upscale one tile column at a time, rather than doing the whole
frame at once. This allows us to correctly support the loop filter
across tiles flag, by temporarily extending the left/right boundaries
of each tile column to avoid sampling from adjacent tiles.

This code is also reused by striped-loop-restoration, when upscaling the
deblocked context above/below each stripe. That way, we i) ensure
that the upscaling is done consistently, and ii) fix the last remaining
case where loop-restoration didn't respect the loop filter across tiles
flag.

This also makes it easy to perform extension of the left/right edges
of the frame "as needed", so we don't need to extend the frame borders
immediately after deblocking. This should give marginally better CDEF
filtering for frames using superres.

Change-Id: I28712a177853a20c9eb2993e740da8ba7c95a8cc
parent c363ab76
This diff is collapsed.
......@@ -64,9 +64,12 @@ void av1_resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst, int bd);
#if CONFIG_HORZONLY_FRAME_SUPERRES
void av1_upscale_normative_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst,
int superres_denom, int bd);
void av1_upscale_normative_rows(const AV1_COMMON *cm, const uint8_t *src,
int src_stride, uint8_t *dst, int dst_stride,
int plane, int rows);
void av1_upscale_normative_and_extend_frame(const AV1_COMMON *cm,
const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst);
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
......
......@@ -1748,7 +1748,6 @@ static void save_deblock_boundary_lines(
int stripe, int use_highbd, int is_above,
RestorationStripeBoundaries *boundaries) {
const int is_uv = plane > 0;
const int src_width = frame->crop_widths[is_uv];
const uint8_t *src_buf = REAL_PTR(use_highbd, frame->buffers[plane]);
const int src_stride = frame->strides[is_uv] << use_highbd;
const uint8_t *src_rows = src_buf + row * src_stride;
......@@ -1774,22 +1773,19 @@ static void save_deblock_boundary_lines(
if (!av1_superres_unscaled(cm)) {
const int ss_x = is_uv && cm->subsampling_x;
upscaled_width = (cm->superres_upscaled_width + ss_x) >> ss_x;
const int step = av1_get_upscale_convolve_step(src_width, upscaled_width);
if (use_highbd)
av1_highbd_convolve_horiz_rs(
(uint16_t *)src_rows, src_stride >> 1, (uint16_t *)bdry_rows,
bdry_stride >> 1, upscaled_width, RESTORATION_CTX_VERT,
&av1_resize_filter_normative[0][0], UPSCALE_NORMATIVE_TAPS, 0, step,
cm->bit_depth);
av1_upscale_normative_rows(
cm, CONVERT_TO_BYTEPTR(src_rows), frame->strides[is_uv],
CONVERT_TO_BYTEPTR(bdry_rows), boundaries->stripe_boundary_stride,
plane, RESTORATION_CTX_VERT);
else
av1_convolve_horiz_rs(src_rows, src_stride, bdry_rows, bdry_stride,
upscaled_width, RESTORATION_CTX_VERT,
&av1_resize_filter_normative[0][0],
UPSCALE_NORMATIVE_TAPS, 0, step);
av1_upscale_normative_rows(cm, src_rows, frame->strides[is_uv], bdry_rows,
boundaries->stripe_boundary_stride, plane,
RESTORATION_CTX_VERT);
} else {
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
upscaled_width = src_width;
const int line_bytes = src_width << use_highbd;
upscaled_width = frame->crop_widths[is_uv];
const int line_bytes = upscaled_width << use_highbd;
for (int i = 0; i < RESTORATION_CTX_VERT; i++) {
memcpy(bdry_rows + i * bdry_stride, src_rows + i * src_stride,
line_bytes);
......
......@@ -3464,9 +3464,6 @@ void av1_decode_tg_tiles_and_wrapup(AV1Decoder *pbi, const uint8_t *data,
}
#if CONFIG_STRIPED_LOOP_RESTORATION
#if CONFIG_HORZONLY_FRAME_SUPERRES
if (!av1_superres_unscaled(cm)) aom_extend_frame_borders(&pbi->cur_buf->buf);
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
if (cm->rst_info[0].frame_restoration_type != RESTORE_NONE ||
cm->rst_info[1].frame_restoration_type != RESTORE_NONE ||
cm->rst_info[2].frame_restoration_type != RESTORE_NONE) {
......
......@@ -5220,9 +5220,6 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
}
#if CONFIG_STRIPED_LOOP_RESTORATION
#if CONFIG_HORZONLY_FRAME_SUPERRES
if (!av1_superres_unscaled(cm)) aom_extend_frame_borders(cm->frame_to_show);
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
if (!no_restoration)
av1_loop_restoration_save_boundary_lines(cm->frame_to_show, cm, 0);
#endif // CONFIG_STRIPED_LOOP_RESTORATION
......
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