Commit 4bfd72ee authored by Debargha Mukherjee's avatar Debargha Mukherjee

Clean up unused code in loop-restoration

Removes domain transform recursive filters and non-approximate
guided filter code.

Change-Id: Ib7ae7a6b6526a0908b3dc1787ab3561442da4e2d
parent 625bc26c
......@@ -1059,17 +1059,6 @@ static const aom_prob default_tx_size_prob[MAX_TX_DEPTH][TX_SIZE_CONTEXTS]
};
#if CONFIG_LOOP_RESTORATION
#if USE_DOMAINTXFMRF
const aom_tree_index av1_switchable_restore_tree[TREE_SIZE(
RESTORE_SWITCHABLE_TYPES)] = {
-RESTORE_NONE, 2, -RESTORE_WIENER, 4, -RESTORE_SGRPROJ, -RESTORE_DOMAINTXFMRF,
};
static const aom_prob
default_switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1] = {
32, 128, 128,
};
#else
const aom_tree_index
av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)] = {
-RESTORE_NONE, 2, -RESTORE_WIENER, -RESTORE_SGRPROJ,
......@@ -1079,7 +1068,6 @@ static const aom_prob
default_switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1] = {
32, 128,
};
#endif // USE_DOMAINTXFMRF
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_PALETTE
......
......@@ -504,14 +504,10 @@ typedef uint8_t TXFM_CONTEXT;
#endif // CONFIG_SUPERTX
#if CONFIG_LOOP_RESTORATION
#define USE_DOMAINTXFMRF 0
typedef enum {
RESTORE_NONE = 0,
RESTORE_WIENER = 1,
RESTORE_SGRPROJ = 2,
#if USE_DOMAINTXFMRF
RESTORE_DOMAINTXFMRF = 3,
#endif // USE_DOMAINTXFMRF
RESTORE_SWITCHABLE,
RESTORE_SWITCHABLE_TYPES = RESTORE_SWITCHABLE,
RESTORE_TYPES,
......
This diff is collapsed.
......@@ -28,29 +28,6 @@ extern "C" {
#define RESTORATION_TILEPELS_MAX \
(RESTORATION_TILESIZE_MAX * RESTORATION_TILESIZE_MAX * 9 / 4)
#if USE_DOMAINTXFMRF
#define DOMAINTXFMRF_PARAMS_BITS 6
#define DOMAINTXFMRF_PARAMS (1 << DOMAINTXFMRF_PARAMS_BITS)
#define DOMAINTXFMRF_SIGMA_SCALEBITS 4
#define DOMAINTXFMRF_SIGMA_SCALE (1 << DOMAINTXFMRF_SIGMA_SCALEBITS)
#define DOMAINTXFMRF_ITERS 3
#define DOMAINTXFMRF_VTABLE_PRECBITS 8
#define DOMAINTXFMRF_VTABLE_PREC (1 << DOMAINTXFMRF_VTABLE_PRECBITS)
#define DOMAINTXFMRF_MULT \
sqrt(((1 << (DOMAINTXFMRF_ITERS * 2)) - 1) * 2.0 / 3.0)
// 1 32-bit and 2 8-bit buffers needed for the filter
#define DOMAINTXFMRF_TMPBUF_SIZE \
(RESTORATION_TILEPELS_MAX * (sizeof(int32_t) + 2 * sizeof(uint8_t)))
// One extra buffer needed in encoder, which is either 8-bit or 16-bit
// depending on the video bit depth.
#if CONFIG_AOM_HIGHBITDEPTH
#define DOMAINTXFMRF_EXTBUF_SIZE (RESTORATION_TILEPELS_MAX * sizeof(uint16_t))
#else
#define DOMAINTXFMRF_EXTBUF_SIZE (RESTORATION_TILEPELS_MAX * sizeof(uint8_t))
#endif
#define DOMAINTXFMRF_BITS (DOMAINTXFMRF_PARAMS_BITS)
#endif // USE_DOMAINTXFMRF
// 4 32-bit buffers needed for the filter:
// 2 for the restored versions of the frame and
// 2 for each restoration operation
......@@ -123,12 +100,8 @@ extern "C" {
// Max of SGRPROJ_TMPBUF_SIZE, DOMAINTXFMRF_TMPBUF_SIZE, WIENER_TMPBUF_SIZE
#define RESTORATION_TMPBUF_SIZE (SGRPROJ_TMPBUF_SIZE)
#if USE_DOMAINTXFMRF
// Max of SGRPROJ_EXTBUF_SIZE, DOMAINTXFMRF_EXTBUF_SIZE, WIENER_EXTBUF_SIZE
#define RESTORATION_EXTBUF_SIZE (DOMAINTXFMRF_EXTBUF_SIZE)
#else
// Max of SGRPROJ_EXTBUF_SIZE, WIENER_EXTBUF_SIZE
#define RESTORATION_EXTBUF_SIZE (WIENER_EXTBUF_SIZE)
#endif // USE_DOMAINTXFMRF
// Check the assumptions of the existing code
#if SUBPEL_TAPS != WIENER_WIN + 1
......@@ -154,10 +127,6 @@ typedef struct {
int xqd[2];
} SgrprojInfo;
#if USE_DOMAINTXFMRF
typedef struct { int sigma_r; } DomaintxfmrfInfo;
#endif // USE_DOMAINTXFMRF
typedef struct {
int restoration_tilesize;
RestorationType frame_restoration_type;
......@@ -166,10 +135,6 @@ typedef struct {
WienerInfo *wiener_info;
// Selfguided proj filter
SgrprojInfo *sgrproj_info;
#if USE_DOMAINTXFMRF
// Domain transform filter
DomaintxfmrfInfo *domaintxfmrf_info;
#endif // USE_DOMAINTXFMRF
} RestorationInfo;
typedef struct {
......@@ -241,19 +206,8 @@ int av1_alloc_restoration_struct(struct AV1Common *cm,
void av1_free_restoration_struct(RestorationInfo *rst_info);
void extend_frame(uint8_t *data, int width, int height, int stride);
#if USE_DOMAINTXFMRF
void av1_domaintxfmrf_restoration(uint8_t *dgd, int width, int height,
int stride, int param, uint8_t *dst,
int dst_stride, int32_t *tmpbuf);
#endif // USE_DOMAINTXFMRF
#if CONFIG_AOM_HIGHBITDEPTH
void extend_frame_highbd(uint16_t *data, int width, int height, int stride);
#if USE_DOMAINTXFMRF
void av1_domaintxfmrf_restoration_highbd(uint16_t *dgd, int width, int height,
int stride, int param, int bit_depth,
uint16_t *dst, int dst_stride,
int32_t *tmpbuf);
#endif // USE_DOMAINTXFMRF
#endif // CONFIG_AOM_HIGHBITDEPTH
void decode_xq(int *xqd, int *xq);
void av1_loop_restoration_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm,
......
......@@ -2542,16 +2542,8 @@ static void decode_restoration_mode(AV1_COMMON *cm,
int p;
RestorationInfo *rsi = &cm->rst_info[0];
if (aom_rb_read_bit(rb)) {
#if USE_DOMAINTXFMRF
if (aom_rb_read_bit(rb))
rsi->frame_restoration_type =
(aom_rb_read_bit(rb) ? RESTORE_DOMAINTXFMRF : RESTORE_SGRPROJ);
else
rsi->frame_restoration_type = RESTORE_WIENER;
#else
rsi->frame_restoration_type =
aom_rb_read_bit(rb) ? RESTORE_SGRPROJ : RESTORE_WIENER;
#endif // USE_DOMAINTXFMRF
} else {
rsi->frame_restoration_type =
aom_rb_read_bit(rb) ? RESTORE_SWITCHABLE : RESTORE_NONE;
......@@ -2615,14 +2607,6 @@ static void read_sgrproj_filter(SgrprojInfo *sgrproj_info, aom_reader *rb) {
aom_read_literal(rb, SGRPROJ_PRJ_BITS, ACCT_STR) + SGRPROJ_PRJ_MIN1;
}
#if USE_DOMAINTXFMRF
static void read_domaintxfmrf_filter(DomaintxfmrfInfo *domaintxfmrf_info,
aom_reader *rb) {
domaintxfmrf_info->sigma_r =
aom_read_literal(rb, DOMAINTXFMRF_PARAMS_BITS, ACCT_STR);
}
#endif // USE_DOMAINTXFMRF
static void decode_restoration(AV1_COMMON *cm, aom_reader *rb) {
int i, p;
const int ntiles = av1_get_rest_ntiles(cm->width, cm->height,
......@@ -2643,10 +2627,6 @@ static void decode_restoration(AV1_COMMON *cm, aom_reader *rb) {
read_wiener_filter(&rsi->wiener_info[i], rb);
} else if (rsi->restoration_type[i] == RESTORE_SGRPROJ) {
read_sgrproj_filter(&rsi->sgrproj_info[i], rb);
#if USE_DOMAINTXFMRF
} else if (rsi->restoration_type[i] == RESTORE_DOMAINTXFMRF) {
read_domaintxfmrf_filter(&rsi->domaintxfmrf_info[i], rb);
#endif // USE_DOMAINTXFMRF
}
}
} else if (rsi->frame_restoration_type == RESTORE_WIENER) {
......@@ -2667,17 +2647,6 @@ static void decode_restoration(AV1_COMMON *cm, aom_reader *rb) {
rsi->restoration_type[i] = RESTORE_NONE;
}
}
#if USE_DOMAINTXFMRF
} else if (rsi->frame_restoration_type == RESTORE_DOMAINTXFMRF) {
for (i = 0; i < ntiles; ++i) {
if (aom_read(rb, RESTORE_NONE_DOMAINTXFMRF_PROB, ACCT_STR)) {
rsi->restoration_type[i] = RESTORE_DOMAINTXFMRF;
read_domaintxfmrf_filter(&rsi->domaintxfmrf_info[i], rb);
} else {
rsi->restoration_type[i] = RESTORE_NONE;
}
}
#endif // USE_DOMAINTXFMRF
}
}
for (p = 1; p < MAX_MB_PLANE; ++p) {
......
......@@ -3371,23 +3371,10 @@ static void encode_restoration_mode(AV1_COMMON *cm,
aom_wb_write_bit(wb, 1);
aom_wb_write_bit(wb, 0);
break;
#if USE_DOMAINTXFMRF
case RESTORE_SGRPROJ:
aom_wb_write_bit(wb, 1);
aom_wb_write_bit(wb, 1);
aom_wb_write_bit(wb, 0);
break;
case RESTORE_DOMAINTXFMRF:
aom_wb_write_bit(wb, 1);
aom_wb_write_bit(wb, 1);
aom_wb_write_bit(wb, 1);
break;
#else
case RESTORE_SGRPROJ:
aom_wb_write_bit(wb, 1);
aom_wb_write_bit(wb, 1);
break;
#endif // USE_DOMAINTXFMRF
case RESTORE_SWITCHABLE:
aom_wb_write_bit(wb, 0);
aom_wb_write_bit(wb, 1);
......@@ -3440,13 +3427,6 @@ static void write_sgrproj_filter(SgrprojInfo *sgrproj_info, aom_writer *wb) {
SGRPROJ_PRJ_BITS);
}
#if USE_DOMAINTXFMRF
static void write_domaintxfmrf_filter(DomaintxfmrfInfo *domaintxfmrf_info,
aom_writer *wb) {
aom_write_literal(wb, domaintxfmrf_info->sigma_r, DOMAINTXFMRF_PARAMS_BITS);
}
#endif // USE_DOMAINTXFMRF
static void encode_restoration(AV1_COMMON *cm, aom_writer *wb) {
int i, p;
const int ntiles = av1_get_rest_ntiles(cm->width, cm->height,
......@@ -3468,10 +3448,6 @@ static void encode_restoration(AV1_COMMON *cm, aom_writer *wb) {
write_wiener_filter(&rsi->wiener_info[i], wb);
} else if (rsi->restoration_type[i] == RESTORE_SGRPROJ) {
write_sgrproj_filter(&rsi->sgrproj_info[i], wb);
#if USE_DOMAINTXFMRF
} else if (rsi->restoration_type[i] == RESTORE_DOMAINTXFMRF) {
write_domaintxfmrf_filter(&rsi->domaintxfmrf_info[i], wb);
#endif // USE_DOMAINTXFMRF
}
}
} else if (rsi->frame_restoration_type == RESTORE_WIENER) {
......@@ -3490,16 +3466,6 @@ static void encode_restoration(AV1_COMMON *cm, aom_writer *wb) {
write_sgrproj_filter(&rsi->sgrproj_info[i], wb);
}
}
#if USE_DOMAINTXFMRF
} else if (rsi->frame_restoration_type == RESTORE_DOMAINTXFMRF) {
for (i = 0; i < ntiles; ++i) {
aom_write(wb, rsi->restoration_type[i] != RESTORE_NONE,
RESTORE_NONE_DOMAINTXFMRF_PROB);
if (rsi->restoration_type[i] != RESTORE_NONE) {
write_domaintxfmrf_filter(&rsi->domaintxfmrf_info[i], wb);
}
}
#endif // USE_DOMAINTXFMRF
}
}
for (p = 1; p < MAX_MB_PLANE; ++p) {
......
This diff is collapsed.
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