]> granicus.if.org Git - libvpx/commitdiff
Deringing support for 4:2:2 by not deringing chroma
authorJean-Marc Valin <jmvalin@mozilla.com>
Tue, 18 Oct 2016 21:39:03 +0000 (17:39 -0400)
committerYaowu Xu <yaowu@google.com>
Thu, 27 Oct 2016 19:37:52 +0000 (12:37 -0700)
No change in output for 4:2:0 and 4:4:4

Change-Id: Ic46753d23a5b5f90b611a3da1a4574870519957c

av1/common/dering.c

index fd5167af886f0829a826fc8304a001f4a44efaee..451903161e42d636efa40182ad914cf3c2c5d36b 100644 (file)
@@ -60,18 +60,24 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
   int dec_y[3];
   int pli;
   int coeff_shift = AOMMAX(cm->bit_depth - 8, 0);
+  int nplanes;
+  if (xd->plane[1].subsampling_x == xd->plane[1].subsampling_y &&
+      xd->plane[2].subsampling_x == xd->plane[2].subsampling_y)
+    nplanes = 3;
+  else
+    nplanes = 1;
   nvsb = (cm->mi_rows + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
   nhsb = (cm->mi_cols + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
   bskip = aom_malloc(sizeof(*bskip) * cm->mi_rows * cm->mi_cols);
   av1_setup_dst_planes(xd->plane, frame, 0, 0);
-  for (pli = 0; pli < 3; pli++) {
+  for (pli = 0; pli < nplanes; pli++) {
     dec_x[pli] = xd->plane[pli].subsampling_x;
     dec_y[pli] = xd->plane[pli].subsampling_y;
     bsize_x[pli] = 8 >> dec_x[pli];
     bsize_y[pli] = 8 >> dec_y[pli];
   }
   stride = bsize_x[0] * cm->mi_cols;
-  for (pli = 0; pli < 3; pli++) {
+  for (pli = 0; pli < nplanes; pli++) {
     src[pli] = aom_malloc(sizeof(*src) * cm->mi_rows * cm->mi_cols * 64);
     for (r = 0; r < bsize_y[pli] * cm->mi_rows; ++r) {
       for (c = 0; c < bsize_x[pli] * cm->mi_cols; ++c) {
@@ -108,7 +114,7 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
                             ->mbmi.dering_gain);
       if (level == 0 || sb_all_skip(cm, sbr * MAX_MIB_SIZE, sbc * MAX_MIB_SIZE))
         continue;
-      for (pli = 0; pli < 3; pli++) {
+      for (pli = 0; pli < nplanes; pli++) {
         int16_t dst[MAX_MIB_SIZE * MAX_MIB_SIZE * 8 * 8];
         int threshold;
         /* FIXME: This is a temporary hack that uses more conservative
@@ -149,7 +155,7 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
       }
     }
   }
-  for (pli = 0; pli < 3; pli++) {
+  for (pli = 0; pli < nplanes; pli++) {
     aom_free(src[pli]);
   }
   aom_free(bskip);