Skip to content

Commit

Permalink
CDEF: Remove filter_skip
Browse files Browse the repository at this point in the history
  • Loading branch information
stemidts authored and Thomas Davies committed Jan 17, 2018
1 parent b453c6e commit 9d7ca72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
9 changes: 2 additions & 7 deletions common/common_frame.c
Expand Up @@ -881,13 +881,8 @@ void TEMPLATE(cdef_frame)(const yuv_frame_t *frame, const yuv_frame_t *org, debl
cdef_strength *cdef = &deblock_data[index].cdef->plane[plane != 0];

int coeff_shift = bitdepth - 8;
int pri_strength = (cdef->level >> 1);
int filter_skip = cdef->level & 1;
int pri_strength = cdef->level;
int sec_strength = (cdef->sec_strength + (cdef->sec_strength == 3));
if (!pri_strength && !sec_strength && filter_skip) {
pri_strength = 19;
sec_strength = 7;
}
if (!allskip) {
// Iterate over all smaller blocks inside the filter block
for (int m = 0; m < ((h + bs - 1) >> (bslog + sub)); m++) {
Expand All @@ -902,7 +897,7 @@ void TEMPLATE(cdef_frame)(const yuv_frame_t *frame, const yuv_frame_t *org, debl
if (plane == 0)
deblock_data[index].cdef_dir = (use_simd ? TEMPLATE(cdef_find_dir_simd) : TEMPLATE(cdef_find_dir))(src_buffer + ypos * sstride + xpos, sstride, &deblock_data[index].cdef_var, coeff_shift);

if (filter_skip || deblock_data[index].mode != MODE_SKIP) {
if (deblock_data[index].mode != MODE_SKIP) {

// Temporary buffering needed for in-place filtering
if (cache_ptr[cache_idx]) {
Expand Down
4 changes: 2 additions & 2 deletions common/global.h
Expand Up @@ -105,7 +105,7 @@ static inline void fatalerror(char error_text[])
#define TEMP_INTERP_USE_CHROMA 0 // 444 not supported!

#if CDEF
#define CDEF_PRI_STRENGTHS 32
#define CDEF_PRI_STRENGTHS 16
#define CDEF_SEC_STRENGTHS 4
#define CDEF_BLOCKSIZE 64
#define CDEF_BLOCKSIZE_LOG2 6
Expand All @@ -116,7 +116,7 @@ static inline void fatalerror(char error_text[])
#define CDEF_VERY_LARGE 30000
#define CDEF_INBUF_SIZE (CDEF_BSTRIDE * (CDEF_BLOCKSIZE + 2 * CDEF_VBORDER))
#define CDEF_MAX_STRENGTHS 16
#define CDEF_STRENGTH_BITS 7
#define CDEF_STRENGTH_BITS 6
#define CDEF_FULL 0 // 1 = 7x7 filter, 0 = 5x5 filter
#endif

Expand Down
13 changes: 6 additions & 7 deletions enc/encode_frame.c
Expand Up @@ -47,9 +47,9 @@ int TEMPLATE(cdef_search)(yuv_frame_t *rec, yuv_frame_t *org, deblock_data_t *de

#define TOTAL_STRENGTHS (CDEF_PRI_STRENGTHS * CDEF_SEC_STRENGTHS)

static int priconv[3][CDEF_PRI_STRENGTHS] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 },
{ 0, 1, 2, 3, 4, 7, 12, 25 },
{ 0, 2, 6, 12 } };
static int priconv[3][CDEF_PRI_STRENGTHS] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
{ 0, 1, 2, 3, 5, 7, 10, 13 },
{ 0, 1, 3, 6 } };

static int pristrengths[3] = { CDEF_PRI_STRENGTHS * CDEF_SEC_STRENGTHS, 8 * CDEF_SEC_STRENGTHS, 4 * CDEF_SEC_STRENGTHS};

Expand Down Expand Up @@ -297,12 +297,11 @@ int TEMPLATE(cdef_search)(yuv_frame_t *rec, yuv_frame_t *org, deblock_data_t *de
TEMPLATE(cdef_prepare_input)(sizex, sizey, xpos, ypos, bt, padding, src16 + offset16, stride16, src_buffer, sstride);

for (int gi = 0; gi < total_strengths; gi++) {
int level, filter_skip;
int level;
int pri_strength, sec_strength;
level = gi / CDEF_SEC_STRENGTHS;
level = priconv[speed][level];
filter_skip = level & 1;
pri_strength = (level >> 1);
pri_strength = level;
sec_strength = (gi % CDEF_SEC_STRENGTHS);

if (plane < 2)
Expand All @@ -319,7 +318,7 @@ int TEMPLATE(cdef_search)(yuv_frame_t *rec, yuv_frame_t *org, deblock_data_t *de

if (plane == 0)
deblock_data[index].cdef_dir = (use_simd ? TEMPLATE(cdef_find_dir_simd) : TEMPLATE(cdef_find_dir))(src_buffer + ypos * sstride + xpos, sstride, &deblock_data[index].cdef_var, coeff_shift);
if (filter_skip || deblock_data[index].mode != MODE_SKIP) {
if (deblock_data[index].mode != MODE_SKIP) {

int adj_str = plane ? pri_strength : adjust_strength(pri_strength, deblock_data[index].cdef_var);
int adj_pri_damping = adj_str ? max(log2i(adj_str), pri_damping - !!plane) : pri_damping - !!plane;
Expand Down

0 comments on commit 9d7ca72

Please sign in to comment.