]> granicus.if.org Git - libvpx/commitdiff
Initialize errorperbit and sabperbit in ARNR filtering
authorRanjit Kumar Tulabandu <ranjit.tulabandu@ittiam.com>
Wed, 11 Jan 2017 13:29:11 +0000 (18:59 +0530)
committerYunqing Wang <yunqingwang@google.com>
Tue, 24 Jan 2017 16:58:17 +0000 (08:58 -0800)
(Yunqing)
This patch added the missing initialization in temporal filter.
Borg test BDRate results:
PSNR: -0.019%(lowres); -0.013%(hdres);
SSIM: -0.001%(lowres); -0.010%(hdres).
Other q values gave comparable but no better results.

Change-Id: I7ad0c18b39e6f558342688e2fe1e12fdb133ce9b

vp9/encoder/vp9_rd.c
vp9/encoder/vp9_rd.h
vp9/encoder/vp9_temporal_filter.c
vp9/encoder/vp9_temporal_filter.h

index 76c639a64743b235a24d76323371bd52f3ff934e..3bbfa1aac346fa6d648f3c88816d1d538b013469 100644 (file)
@@ -146,7 +146,7 @@ static const int rd_boost_factor[16] = { 64, 32, 32, 32, 24, 16, 12, 12,
 static const int rd_frame_type_factor[FRAME_UPDATE_TYPES] = { 128, 144, 128,
                                                               128, 144 };
 
-int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
+int64_t vp9_compute_rd_mult_based_on_qindex(const VP9_COMP *cpi, int qindex) {
   const int64_t q = vp9_dc_quant(qindex, 0, cpi->common.bit_depth);
 #if CONFIG_VP9_HIGHBITDEPTH
   int64_t rdmult = 0;
@@ -161,6 +161,12 @@ int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
 #else
   int64_t rdmult = 88 * q * q / 24;
 #endif  // CONFIG_VP9_HIGHBITDEPTH
+  return rdmult;
+}
+
+int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
+  int64_t rdmult = vp9_compute_rd_mult_based_on_qindex(cpi, qindex);
+
   if (cpi->oxcf.pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
     const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
     const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index];
index 05344b6cf035ad9fb3890a9d8250d042f4d485bb..1c6831358fe67fe543e22fea065d359792228231 100644 (file)
@@ -128,6 +128,9 @@ struct TileDataEnc;
 struct VP9_COMP;
 struct macroblock;
 
+int64_t vp9_compute_rd_mult_based_on_qindex(const struct VP9_COMP *cpi,
+                                            int qindex);
+
 int vp9_compute_rd_mult(const struct VP9_COMP *cpi, int qindex);
 
 void vp9_initialize_rd_consts(struct VP9_COMP *cpi);
index 344658483a15280fd71f8680ddb83ac7f22823f2..e2770281b302496aff5a26a643d7763e7b7dc6ed 100644 (file)
@@ -646,6 +646,7 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
   int frames_to_blur_forward;
   struct scale_factors sf;
   YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS] = { NULL };
+  int rdmult;
 
   // Apply context specific adjustments to the arnr filter parameters.
   adjust_arnr_filter(cpi, distance, rc->gfu_boost, &frames_to_blur, &strength);
@@ -719,6 +720,12 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
     }
   }
 
+  // Initialize errorperbit and sabperbit.
+  rdmult = (int)vp9_compute_rd_mult_based_on_qindex(cpi, ARNR_FILT_QINDEX);
+  if (rdmult < 1) rdmult = 1;
+  set_error_per_bit(&cpi->td.mb, rdmult);
+  vp9_initialize_me_consts(cpi, &cpi->td.mb, ARNR_FILT_QINDEX);
+
   temporal_filter_iterate_c(cpi, frames, frames_to_blur,
                             frames_to_blur_backward, strength, &sf);
 }
index f537b8870a695bd0978225965e35a16e9bc8d362..88ad8b45cb8e7579c865b9a60fc2653892c9c0c0 100644 (file)
@@ -15,6 +15,8 @@
 extern "C" {
 #endif
 
+#define ARNR_FILT_QINDEX 128
+
 void vp9_temporal_filter_init(void);
 void vp9_temporal_filter(VP9_COMP *cpi, int distance);