Commit 5105f7ac authored by Debargha Mukherjee's avatar Debargha Mukherjee Committed by Urvang Joshi

Merge in STRIPED_LOOP_RESTORATION flag

CONFIG_LOOP_RESTORATION still exists.
Only CONFIG_STRIPED_LOOP_RESTORATION has been merged into
CONFIG_LOOP_RESTORATION as always 1.

Change-Id: I37d7a1fcd4cbb56e2fc037b1568ae63f72ed6a66
parent 1e3da463
......@@ -116,7 +116,6 @@ void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
CHECK_MEM_ERROR(cm, cm->rst_tmpbuf,
(int32_t *)aom_memalign(16, RESTORATION_TMPBUF_SIZE));
#if CONFIG_STRIPED_LOOP_RESTORATION
// For striped loop restoration, we divide each row of tiles into "stripes",
// of height 64 luma pixels but with an offset by RESTORATION_TILE_OFFSET
// luma pixels to match the output from CDEF. We will need to store 2 *
......@@ -167,7 +166,6 @@ void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
boundaries->stripe_boundary_stride = stride;
}
#endif // CONFIG_STRIPED_LOOP_RESTORATION
}
void av1_free_restoration_buffers(AV1_COMMON *cm) {
......@@ -177,7 +175,6 @@ void av1_free_restoration_buffers(AV1_COMMON *cm) {
av1_free_restoration_struct(&cm->rst_info[p]);
aom_free(cm->rst_tmpbuf);
cm->rst_tmpbuf = NULL;
#if CONFIG_STRIPED_LOOP_RESTORATION
for (p = 0; p < num_planes; ++p) {
RestorationStripeBoundaries *boundaries = &cm->rst_info[p].boundaries;
aom_free(boundaries->stripe_boundary_above);
......@@ -185,7 +182,6 @@ void av1_free_restoration_buffers(AV1_COMMON *cm) {
boundaries->stripe_boundary_above = NULL;
boundaries->stripe_boundary_below = NULL;
}
#endif
}
#endif // CONFIG_LOOP_RESTORATION
......
......@@ -197,7 +197,6 @@ static void copy_tile(int width, int height, const uint8_t *src, int src_stride,
copy_tile_lowbd(width, height, src, src_stride, dst, dst_stride);
}
#if CONFIG_STRIPED_LOOP_RESTORATION
#define REAL_PTR(hbd, d) ((hbd) ? (uint8_t *)CONVERT_TO_SHORTPTR(d) : (d))
// Helper function: Save one column of left/right context to the appropriate
......@@ -543,7 +542,6 @@ static void restore_processing_stripe_boundary(
}
}
}
#endif
#if USE_WIENER_HIGH_INTERMEDIATE_PRECISION
#define wiener_convolve8_add_src aom_convolve8_add_src_hip
......@@ -1374,7 +1372,6 @@ static const stripe_filter_fun stripe_filters[NUM_STRIPE_FILTERS] = {
// Filter one restoration unit
void av1_loop_restoration_filter_unit(
const RestorationTileLimits *limits, const RestorationUnitInfo *rui,
#if CONFIG_STRIPED_LOOP_RESTORATION
const RestorationStripeBoundaries *rsb, RestorationLineBuffers *rlbs,
const AV1PixelRect *tile_rect, int tile_stripe0,
#if CONFIG_LOOPFILTERING_ACROSS_TILES
......@@ -1385,7 +1382,6 @@ void av1_loop_restoration_filter_unit(
int loop_filter_across_tiles_enabled,
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES_EXT
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES
#endif // CONFIG_STRIPED_LOOP_RESTORATION
int ss_x, int ss_y, int highbd, int bit_depth, uint8_t *data8, int stride,
uint8_t *dst8, int dst_stride, int32_t *tmpbuf) {
RestorationType unit_rtype = rui->restoration_type;
......@@ -1406,8 +1402,7 @@ void av1_loop_restoration_filter_unit(
const int procunit_width = RESTORATION_PROC_UNIT_SIZE >> ss_x;
// Convolve the whole tile one stripe at a time
#if CONFIG_STRIPED_LOOP_RESTORATION
// Convolve the whole tile one stripe at a time
RestorationTileLimits remaining_stripes = *limits;
int i = 0;
while (i < unit_h) {
......@@ -1471,23 +1466,13 @@ void av1_loop_restoration_filter_unit(
i += h;
}
#else
const int stripe_height = RESTORATION_PROC_UNIT_SIZE >> ss_y;
for (int i = 0; i < unit_h; i += stripe_height) {
const int h = AOMMIN(stripe_height, unit_h - i);
stripe_filter(rui, unit_w, h, procunit_width, data8_tl + i * stride, stride,
dst8_tl + i * dst_stride, dst_stride, tmpbuf, bit_depth);
}
#endif // CONFIG_STRIPED_LOOP_RESTORATION
}
typedef struct {
const RestorationInfo *rsi;
#if CONFIG_STRIPED_LOOP_RESTORATION
RestorationLineBuffers *rlbs;
const AV1_COMMON *cm;
int tile_stripe0;
#endif // CONFIG_STRIPED_LOOP_RESTORATION
int ss_x, ss_y;
int highbd, bit_depth;
uint8_t *data8, *dst8;
......@@ -1497,14 +1482,9 @@ typedef struct {
static void filter_frame_on_tile(int tile_row, int tile_col, void *priv) {
(void)tile_col;
#if CONFIG_STRIPED_LOOP_RESTORATION
FilterFrameCtxt *ctxt = (FilterFrameCtxt *)priv;
ctxt->tile_stripe0 =
(tile_row == 0) ? 0 : ctxt->cm->rst_end_stripe[tile_row - 1];
#else
(void)tile_row;
(void)priv;
#endif // CONFIG_STRIPED_LOOP_RESTORATION
}
static void filter_frame_on_unit(const RestorationTileLimits *limits,
......@@ -1513,14 +1493,9 @@ static void filter_frame_on_unit(const RestorationTileLimits *limits,
FilterFrameCtxt *ctxt = (FilterFrameCtxt *)priv;
const RestorationInfo *rsi = ctxt->rsi;
#if !CONFIG_STRIPED_LOOP_RESTORATION
(void)tile_rect;
#endif // CONFIG_STRIPED_LOOP_RESTORATION
av1_loop_restoration_filter_unit(
limits, &rsi->unit_info[rest_unit_idx],
#if CONFIG_STRIPED_LOOP_RESTORATION
&rsi->boundaries, ctxt->rlbs, tile_rect, ctxt->tile_stripe0,
limits, &rsi->unit_info[rest_unit_idx], &rsi->boundaries, ctxt->rlbs,
tile_rect, ctxt->tile_stripe0,
#if CONFIG_LOOPFILTERING_ACROSS_TILES
#if CONFIG_LOOPFILTERING_ACROSS_TILES_EXT
ctxt->cm->loop_filter_across_tiles_v_enabled,
......@@ -1529,7 +1504,6 @@ static void filter_frame_on_unit(const RestorationTileLimits *limits,
ctxt->cm->loop_filter_across_tiles_enabled,
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES_EXT
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES
#endif // CONFIG_STRIPED_LOOP_RESTORATION
ctxt->ss_x, ctxt->ss_y, ctxt->highbd, ctxt->bit_depth, ctxt->data8,
ctxt->data_stride, ctxt->dst8, ctxt->dst_stride, ctxt->tmpbuf);
}
......@@ -1553,9 +1527,7 @@ void av1_loop_restoration_filter_frame(YV12_BUFFER_CONFIG *frame,
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
"Failed to allocate restoration dst buffer");
#if CONFIG_STRIPED_LOOP_RESTORATION
RestorationLineBuffers rlbs;
#endif // CONFIG_STRIPED_LOOP_RESTORATION
const int bit_depth = cm->bit_depth;
const int highbd = cm->use_highbitdepth;
......@@ -1577,10 +1549,8 @@ void av1_loop_restoration_filter_frame(YV12_BUFFER_CONFIG *frame,
FilterFrameCtxt ctxt;
ctxt.rsi = rsi;
#if CONFIG_STRIPED_LOOP_RESTORATION
ctxt.rlbs = &rlbs;
ctxt.cm = cm;
#endif // CONFIG_STRIPED_LOOP_RESTORATION
ctxt.ss_x = is_uv && cm->subsampling_x;
ctxt.ss_y = is_uv && cm->subsampling_y;
ctxt.highbd = highbd;
......@@ -1623,14 +1593,10 @@ static void foreach_rest_unit_in_tile(const AV1PixelRect *tile_rect,
limits.v_start = tile_rect->top + y0;
limits.v_end = tile_rect->top + y0 + h;
assert(limits.v_end <= tile_rect->bottom);
#if CONFIG_STRIPED_LOOP_RESTORATION
// Offset the tile upwards to align with the restoration processing stripe
const int voffset = RESTORATION_TILE_OFFSET >> ss_y;
limits.v_start = AOMMAX(tile_rect->top, limits.v_start - voffset);
if (limits.v_end < tile_rect->bottom) limits.v_end -= voffset;
#else
(void)ss_y;
#endif // CONFIG_STRIPED_LOOP_RESTORATION
int x0 = 0, j = 0;
while (x0 < tile_w) {
......@@ -1801,7 +1767,6 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
return *rcol0 < *rcol1 && *rrow0 < *rrow1;
}
#if CONFIG_STRIPED_LOOP_RESTORATION
// Extend to left and right
static void extend_lines(uint8_t *buf, int width, int height, int stride,
int extend, int use_highbitdepth) {
......@@ -2035,4 +2000,3 @@ void av1_loop_restoration_save_boundary_lines(const YV12_BUFFER_CONFIG *frame,
}
}
}
#endif // CONFIG_STRIPED_LOOP_RESTORATION
......@@ -27,23 +27,13 @@ extern "C" {
#define RESTORATION_PROC_UNIT_SIZE 64
#if CONFIG_STRIPED_LOOP_RESTORATION
// Filter tile grid offset upwards compared to the superblock grid
#define RESTORATION_TILE_OFFSET 8
#endif // CONFIG_STRIPED_LOOP_RESTORATION
#if CONFIG_STRIPED_LOOP_RESTORATION
#define SGRPROJ_BORDER_VERT 3 // Vertical border used for Sgr
#else
#define SGRPROJ_BORDER_VERT 3 // Vertical border used for Sgr
#endif // CONFIG_STRIPED_LOOP_RESTORATION
#define SGRPROJ_BORDER_HORZ 3 // Horizontal border used for Sgr
#if CONFIG_STRIPED_LOOP_RESTORATION
#define WIENER_BORDER_VERT 2 // Vertical border used for Wiener
#else
#define WIENER_BORDER_VERT 3 // Vertical border used for Wiener
#endif // CONFIG_STRIPED_LOOP_RESTORATION
#define WIENER_HALFWIN 3
#define WIENER_BORDER_HORZ (WIENER_HALFWIN) // Horizontal border for Wiener
......@@ -65,7 +55,6 @@ extern "C" {
// How many border pixels do we need for each processing unit?
#define RESTORATION_BORDER 3
#if CONFIG_STRIPED_LOOP_RESTORATION
// How many rows of deblocked pixels do we save above/below each processing
// stripe?
#define RESTORATION_CTX_VERT 2
......@@ -73,7 +62,6 @@ extern "C" {
// Additional pixels to the left and right in above/below buffers
// It is RESTORATION_BORDER_HORZ rounded up to get nicer buffer alignment
#define RESTORATION_EXTRA_HORZ 4
#endif // CONFIG_STRIPED_LOOP_RESTORATION
// Pad up to 20 more (may be much less is needed)
#define RESTORATION_PADDING 20
......@@ -84,7 +72,6 @@ extern "C" {
RESTORATION_PADDING))
#define RESTORATION_TILESIZE_MAX 256
#if CONFIG_STRIPED_LOOP_RESTORATION
#define RESTORATION_TILEPELS_HORZ_MAX \
(RESTORATION_TILESIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_HORZ + 16)
#define RESTORATION_TILEPELS_VERT_MAX \
......@@ -92,11 +79,6 @@ extern "C" {
RESTORATION_TILE_OFFSET))
#define RESTORATION_TILEPELS_MAX \
(RESTORATION_TILEPELS_HORZ_MAX * RESTORATION_TILEPELS_VERT_MAX)
#else
#define RESTORATION_TILEPELS_MAX \
((RESTORATION_TILESIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_HORZ + 16) * \
(RESTORATION_TILESIZE_MAX * 3 / 2 + 2 * RESTORATION_BORDER_VERT))
#endif // CONFIG_STRIPED_LOOP_RESTORATION
// Two 32-bit buffers needed for the restored versions from two filters
// TODO(debargha, rupert): Refactor to not need the large tilesize to be stored
......@@ -207,7 +189,6 @@ typedef struct {
SgrprojInfo sgrproj_info;
} RestorationUnitInfo;
#if CONFIG_STRIPED_LOOP_RESTORATION
// A restoration line buffer needs space for two lines plus a horizontal filter
// margin of RESTORATION_EXTRA_HORZ on each side.
#define RESTORATION_LINEBUFFER_WIDTH \
......@@ -241,7 +222,6 @@ typedef struct {
uint8_t *stripe_boundary_below;
int stripe_boundary_stride;
} RestorationStripeBoundaries;
#endif // CONFIG_STRIPED_LOOP_RESTORATION
typedef struct {
RestorationType frame_restoration_type;
......@@ -258,9 +238,7 @@ typedef struct {
int units_per_tile;
int vert_units_per_tile, horz_units_per_tile;
RestorationUnitInfo *unit_info;
#if CONFIG_STRIPED_LOOP_RESTORATION
RestorationStripeBoundaries boundaries;
#endif // CONFIG_STRIPED_LOOP_RESTORATION
} RestorationInfo;
static INLINE void set_default_sgrproj(SgrprojInfo *sgrproj_info) {
......@@ -316,7 +294,6 @@ void decode_xq(const int *xqd, int *xq);
// be at least SGRPROJ_TMPBUF_SIZE big.
void av1_loop_restoration_filter_unit(
const RestorationTileLimits *limits, const RestorationUnitInfo *rui,
#if CONFIG_STRIPED_LOOP_RESTORATION
const RestorationStripeBoundaries *rsb, RestorationLineBuffers *rlbs,
const AV1PixelRect *tile_rect, int tile_stripe0,
#if CONFIG_LOOPFILTERING_ACROSS_TILES
......@@ -327,7 +304,6 @@ void av1_loop_restoration_filter_unit(
int loop_filter_across_tiles_enabled,
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES_EXT
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES
#endif // CONFIG_STRIPED_LOOP_RESTORATION
int ss_x, int ss_y, int highbd, int bit_depth, uint8_t *data8, int stride,
uint8_t *dst8, int dst_stride, int32_t *tmpbuf);
......
......@@ -69,10 +69,6 @@
#include "av1/common/cfl.h"
#endif
#if CONFIG_STRIPED_LOOP_RESTORATION && !CONFIG_LOOP_RESTORATION
#error "striped_loop_restoration requires loop_restoration"
#endif
#if CONFIG_LOOP_RESTORATION
static void loop_restoration_read_sb_coeffs(const AV1_COMMON *const cm,
MACROBLOCKD *xd,
......@@ -3572,13 +3568,11 @@ void av1_decode_tg_tiles_and_wrapup(AV1Decoder *pbi, const uint8_t *data,
return;
}
#if CONFIG_STRIPED_LOOP_RESTORATION
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) {
av1_loop_restoration_save_boundary_lines(&pbi->cur_buf->buf, cm, 0);
}
#endif // CONFIG_STRIPED_LOOP_RESTORATION
if (!cm->skip_loop_filter &&
#if CONFIG_INTRABC
......@@ -3597,9 +3591,7 @@ void av1_decode_tg_tiles_and_wrapup(AV1Decoder *pbi, const uint8_t *data,
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) {
#if CONFIG_STRIPED_LOOP_RESTORATION
av1_loop_restoration_save_boundary_lines(&pbi->cur_buf->buf, cm, 1);
#endif
av1_loop_restoration_filter_frame((YV12_BUFFER_CONFIG *)xd->cur_buf, cm);
}
#endif // CONFIG_LOOP_RESTORATION
......
......@@ -5227,10 +5227,8 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
#endif // CONFIG_LOOPFILTER_LEVEL
}
#if CONFIG_STRIPED_LOOP_RESTORATION
if (!no_restoration)
av1_loop_restoration_save_boundary_lines(cm->frame_to_show, cm, 0);
#endif // CONFIG_STRIPED_LOOP_RESTORATION
if (no_cdef) {
cm->cdef_bits = 0;
......@@ -5256,9 +5254,7 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
cm->rst_info[1].frame_restoration_type = RESTORE_NONE;
cm->rst_info[2].frame_restoration_type = RESTORE_NONE;
} else {
#if CONFIG_STRIPED_LOOP_RESTORATION
av1_loop_restoration_save_boundary_lines(cm->frame_to_show, cm, 1);
#endif
av1_pick_filter_restoration(cpi->source, cpi);
if (cm->rst_info[0].frame_restoration_type != RESTORE_NONE ||
cm->rst_info[1].frame_restoration_type != RESTORE_NONE ||
......
......@@ -98,10 +98,7 @@ typedef struct {
// sse and bits are initialised by reset_rsc in search_rest_type
int64_t sse;
int64_t bits;
#if CONFIG_STRIPED_LOOP_RESTORATION
int tile_y0, tile_stripe0;
#endif
// sgrproj and wiener are initialised by rsc_on_tile when starting the first
// tile in the frame.
......@@ -116,12 +113,8 @@ static void rsc_on_tile(int tile_row, int tile_col, void *priv) {
set_default_sgrproj(&rsc->sgrproj);
set_default_wiener(&rsc->wiener);
#if CONFIG_STRIPED_LOOP_RESTORATION
rsc->tile_stripe0 =
(tile_row == 0) ? 0 : rsc->cm->rst_end_stripe[tile_row - 1];
#else
(void)tile_row;
#endif
}
static void reset_rsc(RestSearchCtxt *rsc) {
......@@ -158,21 +151,15 @@ static int64_t try_restoration_tile(const RestSearchCtxt *rsc,
const AV1_COMMON *const cm = rsc->cm;
const int plane = rsc->plane;
const int is_uv = plane > 0;
#if CONFIG_STRIPED_LOOP_RESTORATION
const RestorationInfo *rsi = &cm->rst_info[plane];
RestorationLineBuffers rlbs;
#else
(void)tile_rect;
#endif
const int bit_depth = cm->bit_depth;
const int highbd = cm->use_highbitdepth;
const YV12_BUFFER_CONFIG *fts = cm->frame_to_show;
av1_loop_restoration_filter_unit(
limits, rui,
#if CONFIG_STRIPED_LOOP_RESTORATION
&rsi->boundaries, &rlbs, tile_rect, rsc->tile_stripe0,
limits, rui, &rsi->boundaries, &rlbs, tile_rect, rsc->tile_stripe0,
#if CONFIG_LOOPFILTERING_ACROSS_TILES
#if CONFIG_LOOPFILTERING_ACROSS_TILES_EXT
cm->loop_filter_across_tiles_v_enabled,
......@@ -181,7 +168,6 @@ static int64_t try_restoration_tile(const RestSearchCtxt *rsc,
cm->loop_filter_across_tiles_enabled,
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES_EXT
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES
#endif // CONFIG_STRIPED_LOOP_RESTORATION
is_uv && cm->subsampling_x, is_uv && cm->subsampling_y, highbd, bit_depth,
fts->buffers[plane], fts->strides[is_uv], rsc->dst->buffers[plane],
rsc->dst->strides[is_uv], cm->rst_tmpbuf);
......
......@@ -153,7 +153,6 @@ set(CONFIG_SEGMENT_PRED_LAST 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SHORT_FILTER 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SIMPLIFY_TX_MODE 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SPATIAL_SEGMENTATION 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_STRIPED_LOOP_RESTORATION 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_TEMPMV_SIGNALING 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_TILE_INFO_FIRST 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_TIMING_INFO_IN_SEQ_HEADERS 0 CACHE NUMBER "AV1 experiment flag.")
......
......@@ -77,12 +77,6 @@ macro (fix_experiment_configs)
endif ()
endif ()
if (CONFIG_STRIPED_LOOP_RESTORATION)
if (NOT CONFIG_LOOP_RESTORATION)
change_config_and_warn(CONFIG_LOOP_RESTORATION 1 CONFIG_STRIPED_LOOP_RESTORATION)
endif ()
endif ()
if (CONFIG_TXK_SEL)
if (NOT CONFIG_LV_MAP)
change_config_and_warn(CONFIG_LV_MAP 1 CONFIG_TXK_SEL)
......
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