Make CDEF work with EXT_PARTITION

Make CDEF select filter strength every 64x64 block when block size
could be larger than 64x64.

With/without this patch, coding performances on AWCY and Google
test of lowres and midres are neutral.

BUG=aomedia:662

Change-Id: Ief82cc51be91fc08a7c6d7e87f6d13bcc4336476
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index dc46224..2e0abc1 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3097,11 +3097,24 @@
 #endif  // CONFIG_EXT_PARTITION_TYPES
 
 #if CONFIG_CDEF
-  if (bsize == cm->sb_size && !sb_all_skip(cm, mi_row, mi_col) &&
-      cm->cdef_bits != 0 && !cm->all_lossless) {
-    aom_write_literal(w, cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]
-                             ->mbmi.cdef_strength,
-                      cm->cdef_bits);
+  if (bsize == cm->sb_size && cm->cdef_bits != 0 && !cm->all_lossless) {
+    int width_step = mi_size_wide[BLOCK_64X64];
+    int height_step = mi_size_high[BLOCK_64X64];
+    int width, height;
+    for (height = 0; (height < mi_size_high[cm->sb_size]) &&
+                     (mi_row + height < cm->mi_rows);
+         height += height_step) {
+      for (width = 0; (width < mi_size_wide[cm->sb_size]) &&
+                      (mi_col + width < cm->mi_cols);
+           width += width_step) {
+        if (!sb_all_skip(cm, mi_row + height, mi_col + width))
+          aom_write_literal(
+              w, cm->mi_grid_visible[(mi_row + height) * cm->mi_stride +
+                                     (mi_col + width)]
+                     ->mbmi.cdef_strength,
+              cm->cdef_bits);
+      }
+    }
   }
 #endif
 }