Commit 5d56f4d6 authored by Steinar Midtskogen's avatar Steinar Midtskogen Committed by Yaowu Xu

Reverse order of CLPF and dering

Low latency:
PSNR YCbCr:     -0.15%      0.11%      0.12%
   PSNRHVS:     -0.25%
      SSIM:     -0.26%
    MSSSIM:     -0.26%
 CIEDE2000:     -0.03%

High latency:
PSNR YCbCr:     -0.18%      0.18%      0.07%
   PSNRHVS:     -0.20%
      SSIM:     -0.21%
    MSSSIM:     -0.21%
 CIEDE2000:     -0.03%

Change-Id: Ieb86d9ba353220de6454bdc15cea825944b6385b
parent efc7535b
......@@ -1808,6 +1808,18 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
dec_update_partition_context(xd, mi_row, mi_col, subsize, num_8x8_wh);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_DERING
if (bsize == BLOCK_64X64) {
if (cm->dering_level != 0 && !sb_all_skip(cm, mi_row, mi_col)) {
cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.dering_gain =
aom_read_literal(r, DERING_REFINEMENT_BITS, ACCT_STR);
} else {
cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.dering_gain =
0;
}
}
#endif
#if CONFIG_CLPF
if (bsize == BLOCK_64X64 && cm->clpf_strength_y &&
cm->clpf_size != CLPF_NOSIZE) {
......@@ -1844,18 +1856,6 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
}
}
#endif
#if CONFIG_DERING
if (bsize == BLOCK_64X64) {
if (cm->dering_level != 0 && !sb_all_skip(cm, mi_row, mi_col)) {
cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.dering_gain =
aom_read_literal(r, DERING_REFINEMENT_BITS, ACCT_STR);
} else {
cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.dering_gain =
0;
}
}
#endif
}
#if !CONFIG_ANS
......@@ -3531,12 +3531,12 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#endif // CONFIG_EXT_PARTITION
setup_loopfilter(cm, rb);
#if CONFIG_CLPF
setup_clpf(pbi, rb);
#endif
#if CONFIG_DERING
setup_dering(cm, rb);
#endif
#if CONFIG_CLPF
setup_clpf(pbi, rb);
#endif
#if CONFIG_LOOP_RESTORATION
decode_restoration_mode(cm, rb);
#endif // CONFIG_LOOP_RESTORATION
......@@ -4177,6 +4177,12 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
}
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_DERING
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;
......@@ -4198,11 +4204,6 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
}
if (cm->clpf_blocks) aom_free(cm->clpf_blocks);
#endif
#if CONFIG_DERING
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 (!xd->corrupted) {
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
......
......@@ -2092,6 +2092,16 @@ 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 (bsize == BLOCK_64X64 && cm->dering_level != 0 &&
!sb_all_skip(cm, mi_row, mi_col)) {
aom_write_literal(
w,
cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.dering_gain,
DERING_REFINEMENT_BITS);
}
#endif
#if CONFIG_CLPF
if (bsize == BLOCK_64X64 && cm->clpf_blocks && cm->clpf_strength_y &&
cm->clpf_size != CLPF_NOSIZE) {
......@@ -2122,16 +2132,6 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
aom_write_literal(w, cm->clpf_blocks[br], 1);
}
#endif
#if CONFIG_DERING
if (bsize == BLOCK_64X64 && cm->dering_level != 0 &&
!sb_all_skip(cm, mi_row, mi_col)) {
aom_write_literal(
w,
cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]->mbmi.dering_gain,
DERING_REFINEMENT_BITS);
}
#endif
}
static void write_modes(AV1_COMP *const cpi, const TileInfo *const tile,
......@@ -3570,12 +3570,12 @@ static void write_uncompressed_header(AV1_COMP *cpi,
#endif // CONFIG_EXT_PARTITION
encode_loopfilter(cm, wb);
#if CONFIG_CLPF
encode_clpf(cm, wb);
#endif
#if CONFIG_DERING
encode_dering(cm->dering_level, wb);
#endif // CONFIG_DERING
#if CONFIG_CLPF
encode_clpf(cm, wb);
#endif
#if CONFIG_LOOP_RESTORATION
encode_restoration_mode(cm, wb);
#endif // CONFIG_LOOP_RESTORATION
......
......@@ -3324,6 +3324,16 @@ 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 (is_lossless_requested(&cpi->oxcf)) {
cm->dering_level = 0;
} else {
cm->dering_level =
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;
......@@ -3372,15 +3382,6 @@ static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
}
}
#endif
#if CONFIG_DERING
if (is_lossless_requested(&cpi->oxcf)) {
cm->dering_level = 0;
} else {
cm->dering_level =
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_LOOP_RESTORATION
if (cm->rst_info.restoration_type != RESTORE_NONE) {
av1_loop_restoration_init(&cm->rst_internal, &cm->rst_info,
......
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