Commit 5c207296 authored by Yushin Cho's avatar Yushin Cho
Browse files

Remove PVQ_CHROMA_RD codes

Which was a workaround to balance the quality between
luma and chroma when PVQ is enabled, by
1) skipping PVQ DC RDO for chroma and
2) using smaller lambda value (x0.5) for intra prediction of chroma,
intended to spend more bits and thus improve quality for chroma.

The change in metric for 5 frames of objective-1-fast is:
PSNR  PSNR-HVS  SSIM  CIEDE-2000  PSNR Cb PSNR Cr  MS-SSIM
-1.45 -1.54     -1.46 4.62        13.71   14.87     -1.47

For still images (subset1)
PSNR  PSNR-HVS  SSIM  CIEDE-2000  PSNR Cb PSNR Cr  MS-SSIM VMAF
-1.52 -1.54     -1.60 2.56        11.92   12.17     -1.52  -1.66

Change-Id: I31c4d7a7de2939f6004c112649f7303f0e944156
parent d9ad054e
...@@ -1155,9 +1155,6 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper( ...@@ -1155,9 +1155,6 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(
int has_dc_skip = 1; int has_dc_skip = 1;
int i; int i;
int off = od_qm_offset(tx_size, plane ? 1 : 0); int off = od_qm_offset(tx_size, plane ? 1 : 0);
#if PVQ_CHROMA_RD
double save_pvq_lambda;
#endif
DECLARE_ALIGNED(16, tran_low_t, coeff_pvq[OD_TXSIZE_MAX * OD_TXSIZE_MAX]); DECLARE_ALIGNED(16, tran_low_t, coeff_pvq[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
DECLARE_ALIGNED(16, tran_low_t, ref_coeff_pvq[OD_TXSIZE_MAX * OD_TXSIZE_MAX]); DECLARE_ALIGNED(16, tran_low_t, ref_coeff_pvq[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
...@@ -1198,12 +1195,6 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper( ...@@ -1198,12 +1195,6 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(
in_int32[i] = coeff_pvq[i] << (OD_COEFF_SHIFT - coeff_shift); in_int32[i] = coeff_pvq[i] << (OD_COEFF_SHIFT - coeff_shift);
} }
#if PVQ_CHROMA_RD
if (plane != 0) {
save_pvq_lambda = daala_enc->pvq_norm_lambda;
daala_enc->pvq_norm_lambda *= 0.8;
}
#endif
if (abs(in_int32[0] - ref_int32[0]) < pvq_dc_quant * 141 / 256) { /* 0.55 */ if (abs(in_int32[0] - ref_int32[0]) < pvq_dc_quant * 141 / 256) { /* 0.55 */
out_int32[0] = 0; out_int32[0] = 0;
} else { } else {
...@@ -1260,9 +1251,7 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper( ...@@ -1260,9 +1251,7 @@ PVQ_SKIP_TYPE av1_pvq_encode_helper(
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC." #error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif #endif
assert(*rate >= 0); assert(*rate >= 0);
#if PVQ_CHROMA_RD
if (plane != 0) daala_enc->pvq_norm_lambda = save_pvq_lambda;
#endif
return ac_dc_coded; return ac_dc_coded;
} }
......
...@@ -892,11 +892,7 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc, ...@@ -892,11 +892,7 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
n = OD_DIV_R0(abs(in[0] - ref[0]), dc_quant); n = OD_DIV_R0(abs(in[0] - ref[0]), dc_quant);
if (n == 0) { if (n == 0) {
out[0] = 0; out[0] = 0;
#if PVQ_CHROMA_RD
} else if (pli == 0) {
#else
} else { } else {
#endif
int tell2; int tell2;
od_rollback_buffer dc_buf; od_rollback_buffer dc_buf;
...@@ -1010,11 +1006,7 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc, ...@@ -1010,11 +1006,7 @@ PVQ_SKIP_TYPE od_pvq_encode(daala_enc_ctx *enc,
n = OD_DIV_R0(abs(in[0] - ref[0]), dc_quant); n = OD_DIV_R0(abs(in[0] - ref[0]), dc_quant);
if (n == 0) { if (n == 0) {
out[0] = 0; out[0] = 0;
#if PVQ_CHROMA_RD
} else if (pli == 0) {
#else
} else { } else {
#endif
int tell2; int tell2;
od_rollback_buffer dc_buf; od_rollback_buffer dc_buf;
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
# include "av1/common/pvq.h" # include "av1/common/pvq.h"
# include "av1/encoder/encint.h" # include "av1/encoder/encint.h"
#define PVQ_CHROMA_RD 1
void aom_encode_band_pvq_splits(aom_writer *w, od_pvq_codeword_ctx *adapt, void aom_encode_band_pvq_splits(aom_writer *w, od_pvq_codeword_ctx *adapt,
const int *y, int n, int k, int level); const int *y, int n, int k, int level);
......
...@@ -4768,20 +4768,9 @@ static int64_t rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x, ...@@ -4768,20 +4768,9 @@ static int64_t rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
#endif // CONFIG_PALETTE #endif // CONFIG_PALETTE
#if CONFIG_PVQ #if CONFIG_PVQ
// For chroma channels, multiply lambda by 0.5 when doing intra prediction
// NOTE: Chroma intra prediction itself has a separate RDO,
// though final chroma intra mode's D and R is simply added to
// those of luma then global RDO is performed to decide the modes of SB.
// Also, for chroma, the RDO cannot decide tx_size (follow luma's decision)
// or tx_type (DCT only), then only the intra prediction is
// chroma's own mode decision based on separate RDO.
// TODO(yushin) : Seek for more reasonable solution than this.
this_rd = RDCOST(x->rdmult >> (1 * PVQ_CHROMA_RD), x->rddiv, this_rate,
tokenonly_rd_stats.dist);
od_encode_rollback(&x->daala_enc, &buf); od_encode_rollback(&x->daala_enc, &buf);
#else
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, tokenonly_rd_stats.dist);
#endif #endif
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, tokenonly_rd_stats.dist);
if (this_rd < best_rd) { if (this_rd < best_rd) {
best_mbmi = *mbmi; best_mbmi = *mbmi;
......
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