Move dering strength mapping to od_dering()
This patch also makes it easier to tune the mapping later. Change-Id: I69f49b9dd1fddb306931599a354526abe0232eb8
This commit is contained in:
Родитель
f47f6ff7fe
Коммит
233ef94776
|
@ -20,10 +20,6 @@
|
|||
#include "av1/common/onyxc_int.h"
|
||||
#include "av1/common/reconinter.h"
|
||||
|
||||
int dering_level_table[DERING_STRENGTHS] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 20, 24, 28, 33, 39, 46, 54, 63
|
||||
};
|
||||
|
||||
int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) {
|
||||
int r, c;
|
||||
int maxc, maxr;
|
||||
|
@ -171,12 +167,11 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
if (!dering_left) cstart = -OD_FILT_HBORDER;
|
||||
nhb = AOMMIN(MAX_MIB_SIZE, cm->mi_cols - MAX_MIB_SIZE * sbc);
|
||||
nvb = AOMMIN(MAX_MIB_SIZE, cm->mi_rows - MAX_MIB_SIZE * sbr);
|
||||
level = dering_level_table
|
||||
[cm->cdef_strengths[cm->mi_grid_visible[MAX_MIB_SIZE * sbr *
|
||||
cm->mi_stride +
|
||||
MAX_MIB_SIZE * sbc]
|
||||
->mbmi.cdef_strength] /
|
||||
CLPF_STRENGTHS];
|
||||
level = cm->cdef_strengths[cm->mi_grid_visible[MAX_MIB_SIZE * sbr *
|
||||
cm->mi_stride +
|
||||
MAX_MIB_SIZE * sbc]
|
||||
->mbmi.cdef_strength] /
|
||||
CLPF_STRENGTHS;
|
||||
clpf_strength =
|
||||
cm->cdef_strengths[cm->mi_grid_visible[MAX_MIB_SIZE * sbr *
|
||||
cm->mi_stride +
|
||||
|
@ -184,12 +179,11 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
->mbmi.cdef_strength] %
|
||||
CLPF_STRENGTHS;
|
||||
clpf_strength += clpf_strength == 3;
|
||||
uv_level = dering_level_table
|
||||
[cm->cdef_uv_strengths[cm->mi_grid_visible[MAX_MIB_SIZE * sbr *
|
||||
cm->mi_stride +
|
||||
MAX_MIB_SIZE * sbc]
|
||||
->mbmi.cdef_strength] /
|
||||
CLPF_STRENGTHS];
|
||||
uv_level = cm->cdef_uv_strengths[cm->mi_grid_visible[MAX_MIB_SIZE * sbr *
|
||||
cm->mi_stride +
|
||||
MAX_MIB_SIZE * sbc]
|
||||
->mbmi.cdef_strength] /
|
||||
CLPF_STRENGTHS;
|
||||
uv_clpf_strength =
|
||||
cm->cdef_uv_strengths[cm->mi_grid_visible[MAX_MIB_SIZE * sbr *
|
||||
cm->mi_stride +
|
||||
|
@ -209,7 +203,6 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
curr_row_dering[sbc] = 1;
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
uint16_t dst[OD_BSIZE_MAX * OD_BSIZE_MAX];
|
||||
int threshold;
|
||||
int coffset;
|
||||
int rend, cend;
|
||||
int clpf_damping = 3 - (pli != AOM_PLANE_Y) + (cm->base_qindex >> 6);
|
||||
|
@ -344,8 +337,7 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
coffset, xd->plane[pli].dst.stride, OD_FILT_VBORDER,
|
||||
(nhb << bsize[pli]));
|
||||
|
||||
threshold = level << coeff_shift;
|
||||
if (threshold == 0 && clpf_strength == 0) continue;
|
||||
if (level == 0 && clpf_strength == 0) continue;
|
||||
#if CONFIG_AOM_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
od_dering((uint8_t *)&CONVERT_TO_SHORTPTR(
|
||||
|
@ -355,8 +347,8 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
(sbc * MAX_MIB_SIZE << bsize[pli])],
|
||||
xd->plane[pli].dst.stride, dst,
|
||||
&src[OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER],
|
||||
dec[pli], dir, NULL, var, pli, dlist, dering_count,
|
||||
threshold, clpf_strength, clpf_damping, coeff_shift, 0, 1);
|
||||
dec[pli], dir, NULL, var, pli, dlist, dering_count, level,
|
||||
clpf_strength, clpf_damping, coeff_shift, 0, 1);
|
||||
} else {
|
||||
#endif
|
||||
od_dering(
|
||||
|
@ -365,7 +357,7 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
|||
(sbc * MAX_MIB_SIZE << bsize[pli])],
|
||||
xd->plane[pli].dst.stride, dst,
|
||||
&src[OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER],
|
||||
dec[pli], dir, NULL, var, pli, dlist, dering_count, threshold,
|
||||
dec[pli], dir, NULL, var, pli, dlist, dering_count, level,
|
||||
clpf_strength, clpf_damping, coeff_shift, 0, 0);
|
||||
|
||||
#if CONFIG_AOM_HIGHBITDEPTH
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int dering_level_table[DERING_STRENGTHS];
|
||||
|
||||
int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col);
|
||||
int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
|
||||
dering_list *dlist);
|
||||
|
|
|
@ -280,13 +280,28 @@ static void copy_dering_16bit_to_8bit(uint8_t *dst, int dstride, uint16_t *src,
|
|||
void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
|
||||
int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], int *dirinit,
|
||||
int var[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], int pli,
|
||||
dering_list *dlist, int dering_count, int threshold,
|
||||
dering_list *dlist, int dering_count, int level,
|
||||
int clpf_strength, int clpf_damping, int coeff_shift,
|
||||
int skip_dering, int hbd) {
|
||||
int bi;
|
||||
int bx;
|
||||
int by;
|
||||
int bsize;
|
||||
|
||||
// TODO(stemidts): We might be good with fewer strengths and different
|
||||
// strengths for chroma. Perhaps reduce CDEF_STRENGTH_BITS to 5 and
|
||||
// DERING_STRENGTHS to 8 and use the following tables:
|
||||
// static int level_table[DERING_STRENGTHS] = {0, 1, 3, 7, 14, 24, 39, 63};
|
||||
// static int level_table_uv[DERING_STRENGTHS] = {0, 1, 2, 5, 8, 12, 18, 25};
|
||||
// For now, use 21 strengths and the same for luma and chroma.
|
||||
static int level_table[DERING_STRENGTHS] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 20, 24, 28, 33, 39, 46, 54, 63
|
||||
};
|
||||
static int level_table_uv[DERING_STRENGTHS] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 20, 24, 28, 33, 39, 46, 54, 63
|
||||
};
|
||||
|
||||
int threshold = (pli ? level_table_uv : level_table)[level] << coeff_shift;
|
||||
od_filter_dering_direction_func filter_dering_direction[OD_DERINGSIZES] = {
|
||||
od_filter_dering_direction_4x4, od_filter_dering_direction_8x8
|
||||
};
|
||||
|
|
|
@ -49,7 +49,7 @@ void copy_dering_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
|
|||
void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
|
||||
int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], int *dirinit,
|
||||
int var[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS], int pli,
|
||||
dering_list *dlist, int dering_count, int threshold,
|
||||
dering_list *dlist, int dering_count, int level,
|
||||
int clpf_strength, int clpf_damping, int coeff_shift,
|
||||
int skip_dering, int hbd);
|
||||
int od_filter_dering_direction_4x4_c(uint16_t *y, int ystride,
|
||||
|
|
|
@ -153,7 +153,6 @@ void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
|
|||
int bsize[3];
|
||||
int dec[3];
|
||||
int pli;
|
||||
int level;
|
||||
int dering_count;
|
||||
int coeff_shift = AOMMAX(cm->bit_depth - 8, 0);
|
||||
uint64_t best_tot_mse = (uint64_t)1 << 63;
|
||||
|
@ -244,8 +243,7 @@ void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
|
|||
for (gi = 0; gi < TOTAL_STRENGTHS; gi++) {
|
||||
int threshold;
|
||||
int clpf_strength;
|
||||
level = dering_level_table[gi / CLPF_STRENGTHS];
|
||||
threshold = level << coeff_shift;
|
||||
threshold = gi / CLPF_STRENGTHS;
|
||||
if (pli > 0 && !chroma_dering) threshold = 0;
|
||||
/* We avoid filtering the pixels for which some of the pixels to
|
||||
average
|
||||
|
|
Загрузка…
Ссылка в новой задаче