Commit 01435130 authored by Jean-Marc Valin's avatar Jean-Marc Valin Committed by Jean-Marc Valin

Merging the dering and clpf experiments into a single experiment: CDEF

The result is identical to enabling both deringing and CLPF

Change-Id: I71db5ba9e21fcaf11ad87e94841eaf80be58c0a8
parent a0671722
......@@ -442,7 +442,7 @@ set(AOM_AV1_COMMON_SSSE3_INTRIN
set(AOM_AV1_COMMON_SSE4_1_INTRIN
# Requires CONFIG_FILTER_INTRA
#"${AOM_ROOT}/av1/common/x86/filterintra_sse4.c"
# Requires CONFIG_DERING
# Requires CONFIG_CDEF
#"${AOM_ROOT}/av1/common/x86/od_dering_sse4.c"
"${AOM_ROOT}/av1/common/x86/av1_fwd_txfm1d_sse4.c"
"${AOM_ROOT}/av1/common/x86/av1_fwd_txfm2d_sse4.c")
......@@ -611,7 +611,7 @@ if (CONFIG_ANS)
list(REMOVE_ITEM AOM_UNIT_TEST_SOURCES "${AOM_ROOT}/test/boolcoder_test.cc")
endif ()
if (CONFIG_CLPF)
if (CONFIG_CDEF)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
"${AOM_ROOT}/av1/common/clpf.c"
......
......@@ -851,7 +851,7 @@ specialize qw/aom_lpf_horizontal_4 sse2 neon dspr2 msa/;
add_proto qw/void aom_lpf_horizontal_4_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
specialize qw/aom_lpf_horizontal_4_dual sse2 neon dspr2 msa/;
if (aom_config("CONFIG_CLPF") eq "yes") {
if (aom_config("CONFIG_CDEF") eq "yes") {
if (aom_config("CONFIG_AOM_HIGHBITDEPTH") eq "yes") {
add_proto qw/void aom_clpf_block_hbd/, "const uint16_t *src, uint16_t *dst, int sstride, int dstride, int x0, int y0, int sizex, int sizey, unsigned int strength, BOUNDARY_TYPE bt, unsigned int bd";
add_proto qw/void aom_clpf_detect_hbd/, "const uint16_t *rec, const uint16_t *org, int rstride, int ostride, int x0, int y0, int width, int height, int *sum0, int *sum1, unsigned int strength, int size, unsigned int bd";
......
......@@ -81,7 +81,7 @@ ifeq (yes,$(filter $(CONFIG_GLOBAL_MOTION) $(CONFIG_WARPED_MOTION),yes))
AV1_COMMON_SRCS-yes += common/warped_motion.h
AV1_COMMON_SRCS-yes += common/warped_motion.c
endif
ifeq ($(CONFIG_CLPF),yes)
ifeq ($(CONFIG_CDEF),yes)
AV1_COMMON_SRCS-yes += common/clpf.c
AV1_COMMON_SRCS-yes += common/clpf.h
AV1_COMMON_SRCS-yes += common/clpf_simd.h
......@@ -90,8 +90,6 @@ AV1_COMMON_SRCS-$(HAVE_SSE2) += common/clpf_sse2.c
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/clpf_ssse3.c
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/clpf_sse4.c
AV1_COMMON_SRCS-$(HAVE_NEON) += common/clpf_neon.c
endif
ifeq ($(CONFIG_DERING),yes)
AV1_COMMON_SRCS-yes += common/od_dering.c
AV1_COMMON_SRCS-yes += common/od_dering.h
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/od_dering_sse4.c
......
......@@ -106,10 +106,8 @@ AV1_CX_SRCS-yes += encoder/temporal_filter.c
AV1_CX_SRCS-yes += encoder/temporal_filter.h
AV1_CX_SRCS-yes += encoder/mbgraph.c
AV1_CX_SRCS-yes += encoder/mbgraph.h
ifeq ($(CONFIG_DERING),yes)
ifeq ($(CONFIG_CDEF),yes)
AV1_CX_SRCS-yes += encoder/pickdering.c
endif
ifeq ($(CONFIG_CLPF),yes)
AV1_CX_SRCS-yes += encoder/clpf_rdo.c
AV1_CX_SRCS-yes += encoder/clpf_rdo.h
AV1_CX_SRCS-yes += encoder/clpf_rdo_simd.h
......
......@@ -749,7 +749,7 @@ if (aom_config("CONFIG_AOM_HIGHBITDEPTH") eq "yes") {
# Deringing Functions
if (aom_config("CONFIG_DERING") eq "yes") {
if (aom_config("CONFIG_CDEF") eq "yes") {
add_proto qw/int od_dir_find8/, "const od_dering_in *img, int stride, int32_t *var, int coeff_shift";
specialize qw/od_dir_find8 sse4_1/;
......@@ -758,12 +758,6 @@ if (aom_config("CONFIG_DERING") eq "yes") {
add_proto qw/int od_filter_dering_direction_8x8/, "int16_t *y, int ystride, const int16_t *in, int threshold, int dir";
specialize qw/od_filter_dering_direction_8x8 sse4_1/;
add_proto qw/void od_filter_dering_orthogonal_4x4/, "int16_t *y, int ystride, const int16_t *in, int threshold, int dir";
specialize qw/od_filter_dering_orthogonal_4x4 sse4_1/;
add_proto qw/void od_filter_dering_orthogonal_8x8/, "int16_t *y, int ystride, const int16_t *in, int threshold, int dir";
specialize qw/od_filter_dering_orthogonal_8x8 sse4_1/;
}
# WARPED_MOTION / GLOBAL_MOTION functions
......
......@@ -295,7 +295,7 @@ typedef enum {
} PALETTE_COLOR;
#endif // CONFIG_PALETTE
#ifdef CONFIG_CLPF
#ifdef CONFIG_CDEF
#define CLPF_NOFLAG -1
typedef enum {
CLPF_NOSIZE = 0,
......
......@@ -177,64 +177,6 @@ int od_filter_dering_direction_4x4_c(int16_t *y, int ystride, const int16_t *in,
return (total_abs + 2) >> 2;
}
/* Smooth in the direction orthogonal to what was detected. */
void od_filter_dering_orthogonal_8x8_c(int16_t *y, int ystride,
const int16_t *in, int threshold,
int dir) {
int i;
int j;
int offset;
if (dir > 0 && dir < 4)
offset = OD_FILT_BSTRIDE;
else
offset = 1;
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++) {
int16_t yy;
int16_t sum;
int16_t p;
yy = in[i * OD_FILT_BSTRIDE + j];
sum = 0;
p = in[i * OD_FILT_BSTRIDE + j + offset] - yy;
if (abs(p) < threshold) sum += p;
p = in[i * OD_FILT_BSTRIDE + j - offset] - yy;
if (abs(p) < threshold) sum += p;
p = in[i * OD_FILT_BSTRIDE + j + 2 * offset] - yy;
if (abs(p) < threshold) sum += p;
p = in[i * OD_FILT_BSTRIDE + j - 2 * offset] - yy;
if (abs(p) < threshold) sum += p;
y[i * ystride + j] = yy + ((3 * sum + 8) >> 4);
}
}
}
/* Smooth in the direction orthogonal to what was detected. */
void od_filter_dering_orthogonal_4x4_c(int16_t *y, int ystride,
const int16_t *in, int threshold,
int dir) {
int i;
int j;
int offset;
if (dir > 0 && dir < 4)
offset = OD_FILT_BSTRIDE;
else
offset = 1;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
int16_t yy;
int16_t sum;
int16_t p;
yy = in[i * OD_FILT_BSTRIDE + j];
sum = 0;
p = in[i * OD_FILT_BSTRIDE + j + offset] - yy;
if (abs(p) < threshold) sum += p;
p = in[i * OD_FILT_BSTRIDE + j - offset] - yy;
if (abs(p) < threshold) sum += p;
y[i * ystride + j] = yy + ((5 * sum + 8) >> 4);
}
}
}
/* This table approximates x^0.16 with the index being log2(x). It is clamped
to [-.5, 3]. The table is computed as:
round(256*min(3, max(.5, 1.08*(sqrt(2)*2.^([0:17]+8)/256/256).^.16))) */
......@@ -303,12 +245,6 @@ void od_dering(int16_t *y, int16_t *in, int xdec,
od_filter_dering_direction_func filter_dering_direction[OD_DERINGSIZES] = {
od_filter_dering_direction_4x4, od_filter_dering_direction_8x8
};
#ifndef CONFIG_CLPF
int filter2_thresh[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS];
od_filter_dering_orthogonal_func filter_dering_orthogonal[OD_DERINGSIZES] = {
od_filter_dering_orthogonal_4x4, od_filter_dering_orthogonal_8x8
};
#endif
bsize = OD_DERING_SIZE_LOG2 - xdec;
if (pli == 0) {
for (bi = 0; bi < dering_count; bi++) {
......@@ -317,46 +253,29 @@ void od_dering(int16_t *y, int16_t *in, int xdec,
bx = dlist[bi].bx;
dir[by][bx] = od_dir_find8(&in[8 * by * OD_FILT_BSTRIDE + 8 * bx],
OD_FILT_BSTRIDE, &var, coeff_shift);
/* Deringing orthogonal to the direction uses a tighter threshold
because we want to be conservative. We've presumably already
achieved some deringing, so the amount of change is expected
to be low. Also, since we might be filtering across an edge, we
want to make sure not to blur it. That being said, we might want
to be a little bit more aggressive on pure horizontal/vertical
since the ringing there tends to be directional, so it doesn't
get removed by the directional filtering. */
#ifndef CONFIG_CLPF
filter2_thresh[by][bx] =
#endif
(filter_dering_direction[bsize - OD_LOG_BSIZE0])(
&y[bi << 2 * bsize], 1 << bsize,
&in[(by * OD_FILT_BSTRIDE << bsize) + (bx << bsize)],
od_adjust_thresh(threshold, var), dir[by][bx]);
/* Deringing orthogonal to the direction uses a tighter threshold
because we want to be conservative. We've presumably already
achieved some deringing, so the amount of change is expected
to be low. Also, since we might be filtering across an edge, we
want to make sure not to blur it. That being said, we might want
to be a little bit more aggressive on pure horizontal/vertical
since the ringing there tends to be directional, so it doesn't
get removed by the directional filtering. */
(filter_dering_direction[bsize - OD_LOG_BSIZE0])(
&y[bi << 2 * bsize], 1 << bsize,
&in[(by * OD_FILT_BSTRIDE << bsize) + (bx << bsize)],
od_adjust_thresh(threshold, var), dir[by][bx]);
}
} else {
for (bi = 0; bi < dering_count; bi++) {
by = dlist[bi].by;
bx = dlist[bi].bx;
#ifndef CONFIG_CLPF
filter2_thresh[by][bx] =
#endif
(filter_dering_direction[bsize - OD_LOG_BSIZE0])(
&y[bi << 2 * bsize], 1 << bsize,
&in[(by * OD_FILT_BSTRIDE << bsize) + (bx << bsize)], threshold,
dir[by][bx]);
(filter_dering_direction[bsize - OD_LOG_BSIZE0])(
&y[bi << 2 * bsize], 1 << bsize,
&in[(by * OD_FILT_BSTRIDE << bsize) + (bx << bsize)], threshold,
dir[by][bx]);
}
}
copy_dering_16bit_to_16bit(in, OD_FILT_BSTRIDE, y, dlist, dering_count,
bsize);
#ifndef CONFIG_CLPF
for (bi = 0; bi < dering_count; bi++) {
by = dlist[bi].by;
bx = dlist[bi].bx;
if (filter2_thresh[by][bx] == 0) continue;
(filter_dering_orthogonal[bsize - OD_LOG_BSIZE0])(
&y[bi << 2 * bsize], 1 << bsize,
&in[(by * OD_FILT_BSTRIDE << bsize) + (bx << bsize)],
filter2_thresh[by][bx], dir[by][bx]);
}
#endif
}
......@@ -41,9 +41,6 @@ typedef struct {
typedef int (*od_filter_dering_direction_func)(int16_t *y, int ystride,
const int16_t *in, int threshold,
int dir);
typedef void (*od_filter_dering_orthogonal_func)(int16_t *y, int ystride,
const int16_t *in,
int threshold, int dir);
void copy_dering_16bit_to_16bit(int16_t *dst, int dstride, int16_t *src,
dering_list *dlist, int dering_count,
int bsize);
......@@ -56,10 +53,4 @@ int od_filter_dering_direction_4x4_c(int16_t *y, int ystride, const int16_t *in,
int threshold, int dir);
int od_filter_dering_direction_8x8_c(int16_t *y, int ystride, const int16_t *in,
int threshold, int dir);
void od_filter_dering_orthogonal_4x4_c(int16_t *y, int ystride,
const int16_t *in, int threshold,
int dir);
void od_filter_dering_orthogonal_8x8_c(int16_t *y, int ystride,
const int16_t *in, int threshold,
int dir);
#endif
......@@ -166,7 +166,7 @@ typedef struct AV1Common {
// Marks if we need to use 16bit frame buffers (1: yes, 0: no).
int use_highbitdepth;
#endif
#if CONFIG_CLPF
#if CONFIG_CDEF
// Two bits are used to signal the strength for all blocks and the
// valid values are:
// 0: no filtering
......@@ -408,7 +408,7 @@ typedef struct AV1Common {
BLOCK_SIZE sb_size; // Size of the superblock used for this frame
int mib_size; // Size of the superblock in units of MI blocks
int mib_size_log2; // Log 2 of above.
#if CONFIG_DERING
#if CONFIG_CDEF
int dering_level;
#endif
......
......@@ -385,115 +385,3 @@ int od_filter_dering_direction_8x8_sse4_1(int16_t *y, int ystride,
}
return (hsum_epi16(total_abs) + 8) >> 4;
}
void od_filter_dering_orthogonal_4x4_sse4_1(int16_t *y, int ystride,
const int16_t *in, int threshold,
int dir) {
int i;
int offset;
__m128i res;
__m128i p;
__m128i cmp;
__m128i row;
__m128i sum;
__m128i tmp;
__m128i thresh;
thresh = _mm_set1_epi16(threshold);
if (dir > 0 && dir < 4)
offset = OD_FILT_BSTRIDE;
else
offset = 1;
for (i = 0; i < 4; i += 2) {
sum = _mm_set1_epi16(0);
row = _mm_unpacklo_epi64(
_mm_loadl_epi64((__m128i *)&in[i * OD_FILT_BSTRIDE]),
_mm_loadl_epi64((__m128i *)&in[(i + 1) * OD_FILT_BSTRIDE]));
/*p = in[i*OD_FILT_BSTRIDE + k*offset] - row*/
tmp = _mm_unpacklo_epi64(
_mm_loadl_epi64((__m128i *)&in[i * OD_FILT_BSTRIDE + offset]),
_mm_loadl_epi64((__m128i *)&in[(i + 1) * OD_FILT_BSTRIDE + offset]));
p = _mm_sub_epi16(tmp, row);
/*if (abs(p) < threshold) sum += p*/
cmp = od_cmplt_abs_epi16(p, thresh);
p = _mm_and_si128(p, cmp);
sum = _mm_add_epi16(sum, p);
/*p = in[i*OD_FILT_BSTRIDE - k*offset] - row*/
tmp = _mm_unpacklo_epi64(
_mm_loadl_epi64((__m128i *)&in[i * OD_FILT_BSTRIDE - offset]),
_mm_loadl_epi64((__m128i *)&in[(i + 1) * OD_FILT_BSTRIDE - offset]));
p = _mm_sub_epi16(tmp, row);
/*if (abs(p) < threshold) sum += p*/
cmp = od_cmplt_abs_epi16(p, thresh);
p = _mm_and_si128(p, cmp);
sum = _mm_add_epi16(sum, p);
/*row + ((5*sum + 8) >> 4)*/
res = _mm_mullo_epi16(sum, _mm_set1_epi16(5));
res = _mm_add_epi16(res, _mm_set1_epi16(8));
res = _mm_srai_epi16(res, 4);
res = _mm_add_epi16(res, row);
_mm_storel_epi64((__m128i *)&y[i * ystride], res);
_mm_storel_epi64((__m128i *)&y[(i + 1) * ystride],
_mm_unpackhi_epi64(res, res));
}
}
void od_filter_dering_orthogonal_8x8_sse4_1(int16_t *y, int ystride,
const int16_t *in, int threshold,
int dir) {
int i;
int offset;
__m128i res;
__m128i p;
__m128i cmp;
__m128i row;
__m128i sum;
__m128i thresh;
thresh = _mm_set1_epi16(threshold);
if (dir > 0 && dir < 4)
offset = OD_FILT_BSTRIDE;
else
offset = 1;
for (i = 0; i < 8; i++) {
sum = _mm_set1_epi16(0);
row = _mm_loadu_si128((__m128i *)&in[i * OD_FILT_BSTRIDE]);
/*p = in[i*OD_FILT_BSTRIDE + k*offset] - row*/
p = _mm_sub_epi16(
_mm_loadu_si128((__m128i *)&in[i * OD_FILT_BSTRIDE + 1 * offset]), row);
/*if (abs(p) < thresh) sum += p*/
cmp = od_cmplt_abs_epi16(p, thresh);
p = _mm_and_si128(p, cmp);
sum = _mm_add_epi16(sum, p);
/*p = in[i*OD_FILT_BSTRIDE - k*offset] - row*/
p = _mm_sub_epi16(
_mm_loadu_si128((__m128i *)&in[i * OD_FILT_BSTRIDE - 1 * offset]), row);
/*if (abs(p) < threshold) sum += p*/
cmp = od_cmplt_abs_epi16(p, thresh);
p = _mm_and_si128(p, cmp);
sum = _mm_add_epi16(sum, p);
/*p = in[i*OD_FILT_BSTRIDE + k*offset] - row*/
p = _mm_sub_epi16(
_mm_loadu_si128((__m128i *)&in[i * OD_FILT_BSTRIDE + 2 * offset]), row);
/*if (abs(p) < threshold) sum += p*/
cmp = od_cmplt_abs_epi16(p, thresh);
p = _mm_and_si128(p, cmp);
sum = _mm_add_epi16(sum, p);
/*p = in[i*OD_FILT_BSTRIDE - k*offset] - row*/
p = _mm_sub_epi16(
_mm_loadu_si128((__m128i *)&in[i * OD_FILT_BSTRIDE - 2 * offset]), row);
/*if (abs(p) < threshold) sum += p*/
cmp = od_cmplt_abs_epi16(p, thresh);
p = _mm_and_si128(p, cmp);
sum = _mm_add_epi16(sum, p);
/*row + ((3*sum + 8) >> 4)*/
res = _mm_mullo_epi16(sum, _mm_set1_epi16(3));
res = _mm_add_epi16(res, _mm_set1_epi16(8));
res = _mm_srai_epi16(res, 4);
res = _mm_add_epi16(res, row);
_mm_storeu_si128((__m128i *)&y[i * ystride], res);
}
}
......@@ -28,14 +28,12 @@
#include "aom_util/aom_thread.h"
#include "av1/common/alloccommon.h"
#if CONFIG_CLPF
#if CONFIG_CDEF
#include "aom/aom_image.h"
#include "av1/common/clpf.h"
#include "av1/common/dering.h"
#endif
#include "av1/common/common.h"
#if CONFIG_DERING
#include "av1/common/dering.h"
#endif // CONFIG_DERING
#include "av1/common/entropy.h"
#include "av1/common/entropymode.h"
#include "av1/common/entropymv.h"
......@@ -1949,7 +1947,7 @@ static int read_skip(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id,
}
}
#endif // CONFIG_SUPERTX
#if CONFIG_CLPF
#if CONFIG_CDEF
static int clpf_all_skip(const AV1_COMMON *cm, int mi_col, int mi_row,
int size) {
int r, c;
......@@ -2318,7 +2316,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
update_partition_context(xd, mi_row, mi_col, subsize, bsize);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_DERING
#if CONFIG_CDEF
#if CONFIG_EXT_PARTITION
if (cm->sb_size == BLOCK_128X128 && bsize == BLOCK_128X128) {
if (cm->dering_level != 0 && !sb_all_skip(cm, mi_row, mi_col)) {
......@@ -2340,9 +2338,6 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
0;
}
}
#endif
#if CONFIG_CLPF
#if CONFIG_EXT_PARTITION
if (cm->sb_size == BLOCK_128X128 && bsize == BLOCK_128X128 &&
cm->clpf_strength_y && cm->clpf_size != CLPF_NOSIZE) {
......@@ -2420,7 +2415,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
cm->clpf_blocks[br] = aom_read_literal(r, 1, ACCT_STR);
}
}
#endif // CONFIG_CLPF
#endif // CONFIG_CDEF
}
static void setup_bool_decoder(const uint8_t *data, const uint8_t *data_end,
......@@ -2694,7 +2689,7 @@ static void setup_loopfilter(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
}
}
#if CONFIG_CLPF
#if CONFIG_CDEF
static void setup_clpf(AV1Decoder *pbi, struct aom_read_bit_buffer *rb) {
AV1_COMMON *const cm = &pbi->common;
const int width = pbi->cur_buf->buf.y_crop_width;
......@@ -2727,13 +2722,11 @@ static int clpf_bit(UNUSED int k, UNUSED int l,
UNUSED unsigned int fb_size_log2, int8_t *bit) {
return *bit;
}
#endif
#if CONFIG_DERING
static void setup_dering(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
cm->dering_level = aom_rb_read_literal(rb, DERING_LEVEL_BITS);
}
#endif // CONFIG_DERING
#endif // CONFIG_CDEF
static INLINE int read_delta_q(struct aom_read_bit_buffer *rb) {
return aom_rb_read_bit(rb) ? aom_rb_read_inv_signed_literal(rb, 6) : 0;
......@@ -4326,10 +4319,8 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#endif // CONFIG_EXT_PARTITION
setup_loopfilter(cm, rb);
#if CONFIG_DERING
#if CONFIG_CDEF
setup_dering(cm, rb);
#endif
#if CONFIG_CLPF
setup_clpf(pbi, rb);
#endif
#if CONFIG_LOOP_RESTORATION
......@@ -4957,13 +4948,10 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
}
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_DERING
#if CONFIG_CDEF
if (cm->dering_level && !cm->skip_loop_filter) {
av1_dering_frame(&pbi->cur_buf->buf, cm, &pbi->mb, cm->dering_level);
}
#endif // CONFIG_DERING
#if CONFIG_CLPF
if (!cm->skip_loop_filter) {
const YV12_BUFFER_CONFIG *const frame = &pbi->cur_buf->buf;
if (cm->clpf_strength_y) {
......
......@@ -23,12 +23,10 @@
#include "aom_util/debug_util.h"
#endif // CONFIG_BITSTREAM_DEBUG
#if CONFIG_CLPF
#if CONFIG_CDEF
#include "av1/common/clpf.h"
#endif
#if CONFIG_DERING
#include "av1/common/dering.h"
#endif // CONFIG_DERING
#endif // CONFIG_CDEF
#include "av1/common/entropy.h"
#include "av1/common/entropymode.h"
#include "av1/common/entropymv.h"
......@@ -2672,7 +2670,7 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
update_partition_context(xd, mi_row, mi_col, subsize, bsize);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_DERING
#if CONFIG_CDEF
#if CONFIG_EXT_PARTITION
if (cm->sb_size == BLOCK_128X128 && bsize == BLOCK_128X128 &&
cm->dering_level != 0 && !sb_all_skip(cm, mi_row, mi_col)) {
......@@ -2692,7 +2690,7 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
}
#endif
#if CONFIG_CLPF
#if CONFIG_CDEF
#if CONFIG_EXT_PARTITION
if (cm->sb_size == BLOCK_128X128 && bsize == BLOCK_128X128 &&
cm->clpf_blocks && cm->clpf_strength_y && cm->clpf_size != CLPF_NOSIZE) {
......@@ -2763,7 +2761,7 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
cm->clpf_blocks[br] != CLPF_NOFLAG)
aom_write_literal(w, cm->clpf_blocks[br], 1);
}
#endif // CONFIG_CLPF
#endif // CONFIG_CDEF
}
static void write_modes(AV1_COMP *const cpi, const TileInfo *const tile,
......@@ -3491,7 +3489,7 @@ static void encode_loopfilter(AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
}
}
#if CONFIG_CLPF
#if CONFIG_CDEF
static void encode_clpf(const AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
aom_wb_write_literal(wb, cm->clpf_strength_y, 2);
aom_wb_write_literal(wb, cm->clpf_strength_u, 2);
......@@ -3502,11 +3500,11 @@ static void encode_clpf(const AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
}
#endif
#if CONFIG_DERING
#if CONFIG_CDEF
static void encode_dering(int level, struct aom_write_bit_buffer *wb) {
aom_wb_write_literal(wb, level, DERING_LEVEL_BITS);
}
#endif // CONFIG_DERING
#endif // CONFIG_CDEF
static void write_delta_q(struct aom_write_bit_buffer *wb, int delta_q) {
if (delta_q != 0) {
......@@ -4443,10 +4441,8 @@ static void write_uncompressed_header(AV1_COMP *cpi,
#endif // CONFIG_EXT_PARTITION
encode_loopfilter(cm, wb);
#if CONFIG_DERING
#if CONFIG_CDEF
encode_dering(cm->dering_level, wb);
#endif // CONFIG_DERING
#if CONFIG_CLPF
encode_clpf(cm, wb);
#endif
#if CONFIG_LOOP_RESTORATION
......
......@@ -16,14 +16,12 @@
#include "./aom_config.h"
#include "av1/common/alloccommon.h"
#if CONFIG_CLPF
#if CONFIG_CDEF
#include "aom/aom_image.h"
#include "av1/common/clpf.h"
#include "av1/encoder/clpf_rdo.h"
#endif
#if CONFIG_DERING
#include "av1/common/dering.h"
#endif // CONFIG_DERING
#endif // CONFIG_CDEF
#include "av1/common/filter.h"
#include "av1/common/idct.h"
#include "av1/common/reconinter.h"
......@@ -3491,7 +3489,7 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0);
#endif
}
#if CONFIG_DERING
#if CONFIG_CDEF
if (is_lossless_requested(&cpi->oxcf)) {
cm->dering_level = 0;
} else {
......@@ -3499,9 +3497,6 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
av1_dering_search(cm->frame_to_show, cpi->Source, cm, xd);
av1_dering_frame(cm->frame_to_show, cm, xd, cm->dering_level);
}
#endif // CONFIG_DERING
#if CONFIG_CLPF
cm->clpf_strength_y = cm->clpf_strength_u = cm->clpf_strength_v = 0;
cm->clpf_size = CLPF_64X64;
......@@ -4909,7 +4904,7 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
if (cm->show_frame) dump_filtered_recon_frames(cpi);
#endif // DUMP_RECON_FRAMES
#if CONFIG_CLPF
#if CONFIG_CDEF
aom_free(cm->clpf_blocks);
cm->clpf_blocks = 0;
#endif
......
......@@ -75,8 +75,7 @@ CONFIG_SIZE_LIMIT equ ${CONFIG_SIZE_LIMIT}
CONFIG_AOM_QM equ ${CONFIG_AOM_QM}
CONFIG_FP_MB_STATS equ ${CONFIG_FP_MB_STATS}
CONFIG_EMULATE_HARDWARE equ ${CONFIG_EMULATE_HARDWARE}
CONFIG_CLPF equ ${CONFIG_CLPF}
CONFIG_DERING equ ${CONFIG_DERING}
CONFIG_CDEF equ ${CONFIG_CDEF}
CONFIG_VAR_TX equ ${CONFIG_VAR_TX}
CONFIG_RECT_TX equ ${CONFIG_RECT_TX}
CONFIG_REF_MV equ ${CONFIG_REF_MV}
......
......@@ -92,8 +92,7 @@
#define CONFIG_AOM_QM ${CONFIG_AOM_QM}
#define CONFIG_FP_MB_STATS ${CONFIG_FP_MB_STATS}
#define CONFIG_EMULATE_HARDWARE ${CONFIG_EMULATE_HARDWARE}
#define CONFIG_CLPF ${CONFIG_CLPF}
#define CONFIG_DERING ${CONFIG_DERING}
#define CONFIG_CDEF ${CONFIG_CDEF}
#define CONFIG_VAR_TX ${CONFIG_VAR_TX}
#define CONFIG_RECT_TX ${CONFIG_RECT_TX}
#define CONFIG_REF_MV ${CONFIG_REF_MV}
......
......@@ -92,8 +92,7 @@ set(CONFIG_SIZE_LIMIT 0 CACHE BOOL "Internal flag.")
set(CONFIG_AOM_QM 0 CACHE BOOL "Internal flag.")
set(CONFIG_FP_MB_STATS 0 CACHE BOOL "Internal flag.")
set(CONFIG_EMULATE_HARDWARE 0 CACHE BOOL "Internal flag.")
set(CONFIG_CLPF 0 CACHE BOOL "Internal flag.")
set(CONFIG_DERING 0 CACHE BOOL "Internal flag.")
set(CONFIG_CDEF 0 CACHE BOOL "Internal flag.")
set(CONFIG_VAR_TX 0 CACHE BOOL "Internal flag.")
set(CONFIG_RECT_TX 0 CACHE BOOL "Internal flag.")
set(CONFIG_REF_MV 0 CACHE BOOL "Internal flag.")
......
......@@ -33,8 +33,8 @@ set(RTCD_CONFIG_RUNTIME_CPU_DETECT "yes")
if (CONFIG_AOM_HIGHBITDEPTH)
set(RTCD_CONFIG_AOM_HIGHBITDEPTH "yes")
endif ()
if (CONFIG_CLPF)
set(RTCD_CONFIG_CLPF "yes")
if (CONFIG_CDEF)
set(RTCD_CONFIG_CDEF "yes")
endif ()
if (CONFIG_EXT_INTER)
set(RTCD_CONFIG_EXT_INTER "yes")
......
......@@ -25,6 +25,6 @@ CONFIG_STATIC=${RTCD_CONFIG_STATIC}
CONFIG_OS_SUPPORT=${RTCD_CONFIG_OS_SUPPORT}
CONFIG_TEMPORAL_DENOISING=${RTCD_CONFIG_TEMPORAL_DENOISING}
CONFIG_AOM_HIGHBITDEPTH=${RTCD_CONFIG_AOM_HIGHBITDEPTH}
CONFIG_CLPF=${RTCD_CONFIG_CLPF}
CONFIG_CDEF=${RTCD_CONFIG_CDEF}
CONFIG_EXT_INTER=${RTCD_CONFIG_EXT_INTER}
CONFIG_INTERNAL_STATS=${RTCD_CONFIG_INTERNAL_STATS}
......@@ -36,7 +36,7 @@ CONFIG_OS_SUPPORT=${RTCD_CONFIG_OS_SUPPORT}
CONFIG_TEMPORAL_DENOISING=${RTCD_CONFIG_TEMPORAL_DENOISING}
CONFIG_RUNTIME_CPU_DETECT=${RTCD_CONFIG_RUNTIME_CPU_DETECT}
CONFIG_AOM_HIGHBITDEPTH=${RTCD_CONFIG_AOM_HIGHBITDEPTH}
CONFIG_CLPF=${RTCD_CONFIG_CLPF}
CONFIG_CDEF=${RTCD_CONFIG_CDEF}
CONFIG_EXT_INTER=${RTCD_CONFIG_EXT_INTER}
CONFIG_INTERNAL_STATS=${RTCD_CONFIG_INTERNAL_STATS}
CONFIG_MOTION_VAR=${RTCD_CONFIG_MOTION_VAR}
......@@ -36,7 +36,7 @@ CONFIG_OS_SUPPORT=${RTCD_CONFIG_OS_SUPPORT}
CONFIG_TEMPORAL_DENOISING=${RTCD_CONFIG_TEMPORAL_DENOISING}
CONFIG_RUNTIME_CPU_DETECT=${RTCD_CONFIG_RUNTIME_CPU_DETECT}
CONFIG_AOM_HIGHBITDEPTH=${RTCD_CONFIG_AOM_HIGHBITDEPTH}
CONFIG_CLPF=${RTCD_CONFIG_CLPF}
CONFIG_CDEF=${RTCD_CONFIG_CDEF}
CONFIG_EXT_INTER=${RTCD_CONFIG_EXT_INTER}
CONFIG_INTERNAL_STATS=${RTCD_CONFIG_INTERNAL_STATS}
CONFIG_MOTION_VAR=${RTCD_CONFIG_MOTION_VAR}
......@@ -55,8 +55,8 @@ set(RTCD_CONFIG_RUNTIME_CPU_DETECT "yes")
if (CONFIG_AOM_HIGHBITDEPTH)
set(RTCD_CONFIG_AOM_HIGHBITDEPTH "yes")
endif ()
if (CONFIG_CLPF)
set(RTCD_CONFIG_CLPF "yes")
if (CONFIG_CDEF)
set(RTCD_CONFIG_CDEF "yes")
endif ()
if (CONFIG_EXT_INTER)
set(RTCD_CONFIG_EXT_INTER "yes")
......
......@@ -55,8 +55,8 @@ set(RTCD_CONFIG_RUNTIME_CPU_DETECT "yes")
if (CONFIG_AOM_HIGHBITDEPTH)
set(RTCD_CONFIG_AOM_HIGHBITDEPTH "yes")
endif ()
if (CONFIG_CLPF)
set(RTCD_CONFIG_CLPF "yes")
if (CONFIG_CDEF)
set(RTCD_CONFIG_CDEF "yes")
endif ()
if (CONFIG_EXT_INTER)
set(RTCD_CONFIG_EXT_INTER "yes")
......
......@@ -250,8 +250,7 @@ HAVE_LIST="
EXPERIMENT_LIST="
fp_mb_stats
emulate_hardware
clpf
dering
cdef