Introducing OD_DERING_SIZE_LOG2 constant (3)

Also cleans up the size of the deringing destination buffer.

No change in output.

Change-Id: I7fc50d862d3906ce809c1031bf0789acdf39cf34
diff --git a/av1/common/dering.c b/av1/common/dering.c
index 2b99ac8..bb7f565 100644
--- a/av1/common/dering.c
+++ b/av1/common/dering.c
@@ -171,7 +171,7 @@
   curr_row_dering = prev_row_dering + nhsb + 2;
   for (pli = 0; pli < nplanes; pli++) {
     dec[pli] = xd->plane[pli].subsampling_x;
-    bsize[pli] = 3 - dec[pli];
+    bsize[pli] = OD_DERING_SIZE_LOG2 - dec[pli];
   }
   stride = (cm->mi_cols << bsize[0]) + 2*OD_FILT_HBORDER;
   for (pli = 0; pli < nplanes; pli++) {
@@ -207,7 +207,7 @@
       }
       curr_row_dering[sbc] = 1;
       for (pli = 0; pli < nplanes; pli++) {
-        int16_t dst[MAX_MIB_SIZE * MAX_MIB_SIZE * 8 * 8];
+        int16_t dst[OD_BSIZE_MAX * OD_BSIZE_MAX];
         int threshold;
         int coffset;
         int rend, cend;
@@ -358,7 +358,7 @@
                                     (MAX_MIB_SIZE * sbr << bsize[pli]) +
                                     (sbc * MAX_MIB_SIZE << bsize[pli])],
               xd->plane[pli].dst.stride, dst, dlist,
-              dering_count, 3 - dec[pli]);
+              dering_count, bsize[pli]);
 #if CONFIG_AOM_HIGHBITDEPTH
         }
 #endif
diff --git a/av1/common/od_dering.c b/av1/common/od_dering.c
index 977faa0..454862a 100644
--- a/av1/common/od_dering.c
+++ b/av1/common/od_dering.c
@@ -311,7 +311,7 @@
   od_filter_dering_orthogonal_func filter_dering_orthogonal[OD_DERINGSIZES] = {
     od_filter_dering_orthogonal_4x4, od_filter_dering_orthogonal_8x8
   };
-  bsize = 3 - xdec;
+  bsize = OD_DERING_SIZE_LOG2 - xdec;
   if (pli == 0) {
     for (bi = 0; bi < dering_count; bi++) {
       int32_t var;
diff --git a/av1/common/od_dering.h b/av1/common/od_dering.h
index 48acf37..450f112 100644
--- a/av1/common/od_dering.h
+++ b/av1/common/od_dering.h
@@ -18,6 +18,8 @@
 
 #define OD_DERINGSIZES (2)
 
+#define OD_DERING_SIZE_LOG2 (3)
+
 #define OD_DERING_NBLOCKS (OD_BSIZE_MAX / 8)
 
 /* We need to buffer three vertical lines. */
diff --git a/av1/encoder/pickdering.c b/av1/encoder/pickdering.c
index a6b918c..c135451 100644
--- a/av1/encoder/pickdering.c
+++ b/av1/encoder/pickdering.c
@@ -58,7 +58,7 @@
   av1_setup_dst_planes(xd->plane, frame, 0, 0);
   for (pli = 0; pli < 3; pli++) {
     dec[pli] = xd->plane[pli].subsampling_x;
-    bsize[pli] = 3 - dec[pli];
+    bsize[pli] = OD_DERING_SIZE_LOG2 - dec[pli];
   }
   stride = cm->mi_cols << bsize[0];
   for (r = 0; r < cm->mi_rows << bsize[0]; ++r) {
@@ -139,7 +139,7 @@
         od_dering(tmp_dst, in, 0, dir, 0, dlist, dering_count, threshold,
             coeff_shift);
         copy_dering_16bit_to_16bit(dst, MAX_MIB_SIZE << bsize[0], tmp_dst, dlist,
-            dering_count, 3);
+            dering_count, bsize[0]);
         cur_mse = (int)compute_dist(
             dst, MAX_MIB_SIZE << bsize[0],
             &ref_coeff[(sbr * stride * MAX_MIB_SIZE << bsize[0]) +