Remove experimental flag of CDEF

This experiment has been adopted, we can simplify the code
by dropping the associated preprocessor conditionals.

Change-Id: I17bd46ebad7796d04fb4065fb36da0e1c4eeaf9b
diff --git a/aomenc.c b/aomenc.c
index 0128490..b665ac1 100644
--- a/aomenc.c
+++ b/aomenc.c
@@ -435,12 +435,10 @@
 #endif  // CONFIG_LOOPFILTERING_ACROSS_TILES
 static const arg_def_t lossless =
     ARG_DEF(NULL, "lossless", 1, "Lossless mode (0: false (default), 1: true)");
-#if CONFIG_CDEF
 static const arg_def_t enable_cdef =
     ARG_DEF(NULL, "enable-cdef", 1,
             "Enable the constrained directional enhancement filter (0: false, "
             "1: true (default))");
-#endif
 #if CONFIG_AOM_QM
 static const arg_def_t enable_qm =
     ARG_DEF(NULL, "enable-qm", 1,
@@ -580,9 +578,7 @@
                                        &max_inter_rate_pct,
                                        &gf_cbr_boost_pct,
                                        &lossless,
-#if CONFIG_CDEF
                                        &enable_cdef,
-#endif
 #if CONFIG_AOM_QM
                                        &enable_qm,
                                        &qm_min,
@@ -640,9 +636,7 @@
                                         AV1E_SET_MAX_INTER_BITRATE_PCT,
                                         AV1E_SET_GF_CBR_BOOST_PCT,
                                         AV1E_SET_LOSSLESS,
-#if CONFIG_CDEF
                                         AV1E_SET_ENABLE_CDEF,
-#endif
 #if CONFIG_AOM_QM
                                         AV1E_SET_ENABLE_QM,
                                         AV1E_SET_QM_MIN,
diff --git a/av1/av1.cmake b/av1/av1.cmake
index daae009..f930b6e 100644
--- a/av1/av1.cmake
+++ b/av1/av1.cmake
@@ -227,61 +227,59 @@
       "${AOM_ROOT}/av1/encoder/arm/neon/error_neon.c")
 endif ()
 
-if (CONFIG_CDEF)
+set(AOM_AV1_COMMON_SOURCES
+    ${AOM_AV1_COMMON_SOURCES}
+    "${AOM_ROOT}/av1/common/cdef.c"
+    "${AOM_ROOT}/av1/common/cdef.h"
+    "${AOM_ROOT}/av1/common/cdef_block.c"
+    "${AOM_ROOT}/av1/common/cdef_block.h")
+
+set(AOM_AV1_ENCODER_SOURCES
+    ${AOM_AV1_ENCODER_SOURCES}
+    "${AOM_ROOT}/av1/encoder/pickcdef.c")
+
+set(AOM_AV1_COMMON_INTRIN_SSE2
+    ${AOM_AV1_COMMON_INTRIN_SSE2}
+    "${AOM_ROOT}/av1/common/cdef_block_sse2.c")
+
+set(AOM_AV1_COMMON_INTRIN_SSSE3
+    ${AOM_AV1_COMMON_INTRIN_SSSE3}
+    "${AOM_ROOT}/av1/common/cdef_block_ssse3.c")
+
+set(AOM_AV1_COMMON_INTRIN_SSE4_1
+    ${AOM_AV1_COMMON_INTRIN_SSE4_1}
+    "${AOM_ROOT}/av1/common/cdef_block_sse4.c")
+
+set(AOM_AV1_COMMON_INTRIN_AVX2
+    ${AOM_AV1_COMMON_INTRIN_AVX2}
+    "${AOM_ROOT}/av1/common/cdef_block_avx2.c")
+
+set(AOM_AV1_COMMON_INTRIN_NEON
+    ${AOM_AV1_COMMON_INTRIN_NEON}
+    "${AOM_ROOT}/av1/common/cdef_block_neon.c")
+
+if (NOT CONFIG_CDEF_SINGLEPASS)
   set(AOM_AV1_COMMON_SOURCES
       ${AOM_AV1_COMMON_SOURCES}
-      "${AOM_ROOT}/av1/common/cdef.c"
-      "${AOM_ROOT}/av1/common/cdef.h"
-      "${AOM_ROOT}/av1/common/cdef_block.c"
-      "${AOM_ROOT}/av1/common/cdef_block.h")
-
-  set(AOM_AV1_ENCODER_SOURCES
-      ${AOM_AV1_ENCODER_SOURCES}
-      "${AOM_ROOT}/av1/encoder/pickcdef.c")
+      "${AOM_ROOT}/av1/common/clpf.c"
+      "${AOM_ROOT}/av1/common/clpf_simd.h"
+      "${AOM_ROOT}/av1/common/cdef_block_simd.h")
 
   set(AOM_AV1_COMMON_INTRIN_SSE2
       ${AOM_AV1_COMMON_INTRIN_SSE2}
-      "${AOM_ROOT}/av1/common/cdef_block_sse2.c")
+      "${AOM_ROOT}/av1/common/clpf_sse2.c")
 
   set(AOM_AV1_COMMON_INTRIN_SSSE3
       ${AOM_AV1_COMMON_INTRIN_SSSE3}
-      "${AOM_ROOT}/av1/common/cdef_block_ssse3.c")
+      "${AOM_ROOT}/av1/common/clpf_ssse3.c")
 
   set(AOM_AV1_COMMON_INTRIN_SSE4_1
       ${AOM_AV1_COMMON_INTRIN_SSE4_1}
-      "${AOM_ROOT}/av1/common/cdef_block_sse4.c")
-
-  set(AOM_AV1_COMMON_INTRIN_AVX2
-      ${AOM_AV1_COMMON_INTRIN_AVX2}
-      "${AOM_ROOT}/av1/common/cdef_block_avx2.c")
+      "${AOM_ROOT}/av1/common/clpf_sse4.c")
 
   set(AOM_AV1_COMMON_INTRIN_NEON
       ${AOM_AV1_COMMON_INTRIN_NEON}
-      "${AOM_ROOT}/av1/common/cdef_block_neon.c")
-
-  if (NOT CONFIG_CDEF_SINGLEPASS)
-    set(AOM_AV1_COMMON_SOURCES
-        ${AOM_AV1_COMMON_SOURCES}
-        "${AOM_ROOT}/av1/common/clpf.c"
-        "${AOM_ROOT}/av1/common/clpf_simd.h"
-        "${AOM_ROOT}/av1/common/cdef_block_simd.h")
-
-    set(AOM_AV1_COMMON_INTRIN_SSE2
-        ${AOM_AV1_COMMON_INTRIN_SSE2}
-        "${AOM_ROOT}/av1/common/clpf_sse2.c")
-
-    set(AOM_AV1_COMMON_INTRIN_SSSE3
-        ${AOM_AV1_COMMON_INTRIN_SSSE3}
-        "${AOM_ROOT}/av1/common/clpf_ssse3.c")
-
-    set(AOM_AV1_COMMON_INTRIN_SSE4_1
-        ${AOM_AV1_COMMON_INTRIN_SSE4_1}
-        "${AOM_ROOT}/av1/common/clpf_sse4.c")
-
-    set(AOM_AV1_COMMON_INTRIN_NEON
-        ${AOM_AV1_COMMON_INTRIN_NEON}
-        "${AOM_ROOT}/av1/common/clpf_neon.c")
-  endif ()
+      "${AOM_ROOT}/av1/common/clpf_neon.c")
 endif ()
 
 if (CONFIG_CONVOLVE_ROUND)
diff --git a/av1/av1_common.mk b/av1/av1_common.mk
index 326e678..5965814 100644
--- a/av1/av1_common.mk
+++ b/av1/av1_common.mk
@@ -93,7 +93,6 @@
 endif
 AV1_COMMON_SRCS-yes += common/warped_motion.h
 AV1_COMMON_SRCS-yes += common/warped_motion.c
-ifeq ($(CONFIG_CDEF),yes)
 ifeq ($(CONFIG_CDEF_SINGLEPASS),yes)
 AV1_COMMON_SRCS-$(HAVE_AVX2) += common/cdef_block_avx2.c
 else
@@ -113,7 +112,6 @@
 AV1_COMMON_SRCS-yes += common/cdef_block_simd.h
 AV1_COMMON_SRCS-yes += common/cdef.c
 AV1_COMMON_SRCS-yes += common/cdef.h
-endif
 AV1_COMMON_SRCS-yes += common/odintrin.c
 AV1_COMMON_SRCS-yes += common/odintrin.h
 
diff --git a/av1/av1_cx.mk b/av1/av1_cx.mk
index 792db29..9c53be6 100644
--- a/av1/av1_cx.mk
+++ b/av1/av1_cx.mk
@@ -115,9 +115,7 @@
 AV1_CX_SRCS-yes += encoder/hash_motion.c
 AV1_CX_SRCS-yes += encoder/hash_motion.h
 endif
-ifeq ($(CONFIG_CDEF),yes)
 AV1_CX_SRCS-yes += encoder/pickcdef.c
-endif
 
 AV1_CX_SRCS-$(HAVE_SSE2) += encoder/x86/av1_quantize_sse2.c
 AV1_CX_SRCS-$(HAVE_AVX2) += encoder/x86/av1_quantize_avx2.c
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 925077f..6344ea5 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -54,9 +54,7 @@
   unsigned int rc_max_inter_bitrate_pct;
   unsigned int gf_cbr_boost_pct;
   unsigned int lossless;
-#if CONFIG_CDEF
   unsigned int enable_cdef;
-#endif
 #if CONFIG_AOM_QM
   unsigned int enable_qm;
   unsigned int qm_min;
@@ -120,9 +118,7 @@
   0,              // rc_max_inter_bitrate_pct
   0,              // gf_cbr_boost_pct
   0,              // lossless
-#if CONFIG_CDEF
-  1,  // enable_cdef
-#endif
+  1,              // enable_cdef
 #if CONFIG_AOM_QM
   0,                 // enable_qm
   DEFAULT_QM_FIRST,  // qm_min
@@ -504,9 +500,7 @@
   oxcf->cq_level = av1_quantizer_to_qindex(extra_cfg->cq_level);
   oxcf->fixed_q = -1;
 
-#if CONFIG_CDEF
   oxcf->using_cdef = extra_cfg->enable_cdef;
-#endif
 #if CONFIG_AOM_QM
   oxcf->using_qm = extra_cfg->enable_qm;
   oxcf->qm_minlevel = extra_cfg->qm_min;
@@ -879,14 +873,12 @@
   return update_extra_cfg(ctx, &extra_cfg);
 }
 
-#if CONFIG_CDEF
 static aom_codec_err_t ctrl_set_enable_cdef(aom_codec_alg_priv_t *ctx,
                                             va_list args) {
   struct av1_extracfg extra_cfg = ctx->extra_cfg;
   extra_cfg.enable_cdef = CAST(AV1E_SET_ENABLE_CDEF, args);
   return update_extra_cfg(ctx, &extra_cfg);
 }
-#endif
 
 #if CONFIG_AOM_QM
 static aom_codec_err_t ctrl_set_enable_qm(aom_codec_alg_priv_t *ctx,
@@ -1613,9 +1605,7 @@
   { AV1E_SET_MAX_INTER_BITRATE_PCT, ctrl_set_rc_max_inter_bitrate_pct },
   { AV1E_SET_GF_CBR_BOOST_PCT, ctrl_set_rc_gf_cbr_boost_pct },
   { AV1E_SET_LOSSLESS, ctrl_set_lossless },
-#if CONFIG_CDEF
   { AV1E_SET_ENABLE_CDEF, ctrl_set_enable_cdef },
-#endif
 #if CONFIG_AOM_QM
   { AV1E_SET_ENABLE_QM, ctrl_set_enable_qm },
   { AV1E_SET_QM_MIN, ctrl_set_qm_min },
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl
index 4246210..ea10213 100755
--- a/av1/common/av1_rtcd_defs.pl
+++ b/av1/common/av1_rtcd_defs.pl
@@ -452,52 +452,50 @@
 
 # Deringing Functions
 
-if (aom_config("CONFIG_CDEF") eq "yes") {
-  add_proto qw/int cdef_find_dir/, "const uint16_t *img, int stride, int32_t *var, int coeff_shift";
-  if (aom_config("CONFIG_CDEF_SINGLEPASS") ne "yes") {
-    add_proto qw/void aom_clpf_block_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
-    add_proto qw/void aom_clpf_hblock_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
-    add_proto qw/void aom_clpf_block/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
-    add_proto qw/void aom_clpf_hblock/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
-    add_proto qw/void cdef_direction_4x4/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping";
-    add_proto qw/void cdef_direction_8x8/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping";
-    add_proto qw/void copy_8x8_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride";
-    add_proto qw/void copy_4x4_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride";
-    add_proto qw/void copy_8x8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
-    add_proto qw/void copy_4x4_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
+add_proto qw/int cdef_find_dir/, "const uint16_t *img, int stride, int32_t *var, int coeff_shift";
+if (aom_config("CONFIG_CDEF_SINGLEPASS") ne "yes") {
+  add_proto qw/void aom_clpf_block_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
+  add_proto qw/void aom_clpf_hblock_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
+  add_proto qw/void aom_clpf_block/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
+  add_proto qw/void aom_clpf_hblock/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
+  add_proto qw/void cdef_direction_4x4/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping";
+  add_proto qw/void cdef_direction_8x8/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping";
+  add_proto qw/void copy_8x8_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride";
+  add_proto qw/void copy_4x4_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride";
+  add_proto qw/void copy_8x8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
+  add_proto qw/void copy_4x4_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
+} else {
+  add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int max, int coeff_shift";
+}
+
+add_proto qw/void copy_rect8_8bit_to_16bit/, "uint16_t *dst, int dstride, const uint8_t *src, int sstride, int v, int h";
+add_proto qw/void copy_rect8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride, int v, int h";
+
+# VS compiling for 32 bit targets does not support vector types in
+# structs as arguments, which makes the v256 type of the intrinsics
+# hard to support, so optimizations for this target are disabled.
+if ($opts{config} !~ /libs-x86-win32-vs.*/) {
+  if (aom_config("CONFIG_CDEF_SINGLEPASS") eq "yes") {
+    specialize qw/cdef_find_dir sse2 ssse3 sse4_1 avx2 neon/;
+    specialize qw/cdef_filter_block sse2 ssse3 sse4_1 avx2 neon/;
+    specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/;
+    specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/;
   } else {
-    add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int max, int coeff_shift";
-  }
+    specialize qw/cdef_find_dir sse2 ssse3 sse4_1 neon/;
+    specialize qw/aom_clpf_block_hbd sse2 ssse3 sse4_1 neon/;
+    specialize qw/aom_clpf_hblock_hbd sse2 ssse3 sse4_1 neon/;
+    specialize qw/aom_clpf_block sse2 ssse3 sse4_1 neon/;
+    specialize qw/aom_clpf_hblock sse2 ssse3 sse4_1 neon/;
+    specialize qw/cdef_find_dir sse2 ssse3 sse4_1 neon/;
+    specialize qw/cdef_direction_4x4 sse2 ssse3 sse4_1 neon/;
+    specialize qw/cdef_direction_8x8 sse2 ssse3 sse4_1 neon/;
 
-  add_proto qw/void copy_rect8_8bit_to_16bit/, "uint16_t *dst, int dstride, const uint8_t *src, int sstride, int v, int h";
-  add_proto qw/void copy_rect8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride, int v, int h";
-
-  # VS compiling for 32 bit targets does not support vector types in
-  # structs as arguments, which makes the v256 type of the intrinsics
-  # hard to support, so optimizations for this target are disabled.
-  if ($opts{config} !~ /libs-x86-win32-vs.*/) {
-    if (aom_config("CONFIG_CDEF_SINGLEPASS") eq "yes") {
-      specialize qw/cdef_find_dir sse2 ssse3 sse4_1 avx2 neon/;
-      specialize qw/cdef_filter_block sse2 ssse3 sse4_1 avx2 neon/;
-      specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/;
-      specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 avx2 neon/;
-    } else {
-      specialize qw/cdef_find_dir sse2 ssse3 sse4_1 neon/;
-      specialize qw/aom_clpf_block_hbd sse2 ssse3 sse4_1 neon/;
-      specialize qw/aom_clpf_hblock_hbd sse2 ssse3 sse4_1 neon/;
-      specialize qw/aom_clpf_block sse2 ssse3 sse4_1 neon/;
-      specialize qw/aom_clpf_hblock sse2 ssse3 sse4_1 neon/;
-      specialize qw/cdef_find_dir sse2 ssse3 sse4_1 neon/;
-      specialize qw/cdef_direction_4x4 sse2 ssse3 sse4_1 neon/;
-      specialize qw/cdef_direction_8x8 sse2 ssse3 sse4_1 neon/;
-
-      specialize qw/copy_8x8_16bit_to_8bit sse2 ssse3 sse4_1 neon/;
-      specialize qw/copy_4x4_16bit_to_8bit sse2 ssse3 sse4_1 neon/;
-      specialize qw/copy_8x8_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
-      specialize qw/copy_4x4_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
-      specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 neon/;
-      specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
-    }
+    specialize qw/copy_8x8_16bit_to_8bit sse2 ssse3 sse4_1 neon/;
+    specialize qw/copy_4x4_16bit_to_8bit sse2 ssse3 sse4_1 neon/;
+    specialize qw/copy_8x8_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
+    specialize qw/copy_4x4_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
+    specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 neon/;
+    specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
   }
 }
 
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 0aff79c..761db5b 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -526,14 +526,12 @@
   BLOCK_SIZE sb_size;  // Size of the superblock used for this frame
   int mib_size;        // Size of the superblock in units of MI blocks
   int mib_size_log2;   // Log 2 of above.
-#if CONFIG_CDEF
   int cdef_pri_damping;
   int cdef_sec_damping;
   int nb_cdef_strengths;
   int cdef_strengths[CDEF_MAX_STRENGTHS];
   int cdef_uv_strengths[CDEF_MAX_STRENGTHS];
   int cdef_bits;
-#endif
 
   int delta_q_present_flag;
   // Resolution of delta quant
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index e8734c1..3cd10f4 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -33,9 +33,7 @@
 #endif  // CONFIG_BITSTREAM_DEBUG
 
 #include "av1/common/alloccommon.h"
-#if CONFIG_CDEF
 #include "av1/common/cdef.h"
-#endif
 #if CONFIG_INSPECTION
 #include "av1/decoder/inspection.h"
 #endif
@@ -1004,7 +1002,6 @@
   }
 #endif
 
-#if CONFIG_CDEF
   if (bsize == cm->sb_size) {
     int width_step = mi_size_wide[BLOCK_64X64];
     int height_step = mi_size_wide[BLOCK_64X64];
@@ -1023,7 +1020,6 @@
       }
     }
   }
-#endif  // CONFIG_CDEF
 #if CONFIG_LOOP_RESTORATION
   for (int plane = 0; plane < MAX_MB_PLANE; ++plane) {
     int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
@@ -1351,7 +1347,6 @@
   }
 }
 
-#if CONFIG_CDEF
 static void setup_cdef(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
 #if CONFIG_INTRABC
   if (cm->allow_intrabc && NO_FILTER_FOR_IBC) return;
@@ -1372,7 +1367,6 @@
                                    : 0;
   }
 }
-#endif  // CONFIG_CDEF
 
 static INLINE int read_delta_q(struct aom_read_bit_buffer *rb) {
   return aom_rb_read_bit(rb) ? aom_rb_read_inv_signed_literal(rb, 6) : 0;
@@ -1801,20 +1795,15 @@
 #else
     const int no_loopfilter = !lf->filter_level;
 #endif
-#if CONFIG_CDEF
     const int no_cdef = cm->cdef_bits == 0 && cm->cdef_strengths[0] == 0 &&
                         cm->nb_cdef_strengths == 1;
-#endif
 #if CONFIG_LOOP_RESTORATION
     const int no_restoration =
         cm->rst_info[0].frame_restoration_type == RESTORE_NONE &&
         cm->rst_info[1].frame_restoration_type == RESTORE_NONE &&
         cm->rst_info[2].frame_restoration_type == RESTORE_NONE;
 #endif
-    cm->single_tile_decoding = no_loopfilter
-#if CONFIG_CDEF
-                               && no_cdef
-#endif
+    cm->single_tile_decoding = no_loopfilter && no_cdef
 #if CONFIG_LOOP_RESTORATION
                                && no_restoration
 #endif
@@ -3202,11 +3191,9 @@
 #else
     lf->filter_level = 0;
 #endif
-#if CONFIG_CDEF
     cm->cdef_bits = 0;
     cm->cdef_strengths[0] = 0;
     cm->nb_cdef_strengths = 1;
-#endif  // CONFIG_CDEF
 #if CONFIG_LOOP_RESTORATION
     cm->rst_info[0].frame_restoration_type = RESTORE_NONE;
     cm->rst_info[1].frame_restoration_type = RESTORE_NONE;
@@ -3305,11 +3292,9 @@
   }
   cm->all_lossless = all_lossless(cm, xd);
   setup_segmentation_dequant(cm);
-#if CONFIG_CDEF
   if (!cm->all_lossless) {
     setup_cdef(cm, rb);
   }
-#endif
 #if CONFIG_LOOP_RESTORATION
   decode_restoration_mode(cm, rb);
 #endif  // CONFIG_LOOP_RESTORATION
@@ -3842,7 +3827,6 @@
   }
 #endif
 
-#if CONFIG_CDEF
   if (!cm->skip_loop_filter &&
 #if CONFIG_INTRABC
       !(cm->allow_intrabc && NO_FILTER_FOR_IBC) &&
@@ -3850,7 +3834,6 @@
       !cm->all_lossless) {
     av1_cdef_frame(&pbi->cur_buf->buf, cm, &pbi->mb);
   }
-#endif  // CONFIG_CDEF
 
 #if CONFIG_FRAME_SUPERRES
   superres_post_decode(pbi);
diff --git a/av1/decoder/inspection.c b/av1/decoder/inspection.c
index e3457e8..ef6dcf3 100644
--- a/av1/decoder/inspection.c
+++ b/av1/decoder/inspection.c
@@ -11,9 +11,7 @@
 #include "av1/decoder/decoder.h"
 #include "av1/decoder/inspection.h"
 #include "av1/common/enums.h"
-#if CONFIG_CDEF
 #include "av1/common/cdef.h"
-#endif
 #if CONFIG_CFL
 #include "av1/common/cfl.h"
 #endif
@@ -55,9 +53,7 @@
 #if CONFIG_ACCOUNTING
   fd->accounting = &pbi->accounting;
 #endif
-#if CONFIG_CDEF
-// TODO(negge): copy per frame CDEF data
-#endif
+  // TODO(negge): copy per frame CDEF data
   int i, j;
   for (i = 0; i < MAX_SEGMENTS; i++) {
     for (j = 0; j < 2; j++) {
@@ -104,13 +100,11 @@
       mi->tx_type = mbmi->tx_type;
       mi->tx_size = mbmi->tx_size;
 
-#if CONFIG_CDEF
       mi->cdef_level =
           cm->cdef_strengths[mbmi->cdef_strength] / CDEF_SEC_STRENGTHS;
       mi->cdef_strength =
           cm->cdef_strengths[mbmi->cdef_strength] % CDEF_SEC_STRENGTHS;
       mi->cdef_strength += mi->cdef_strength == 3;
-#endif
 #if CONFIG_CFL
       if (mbmi->uv_mode == UV_CFL_PRED) {
         mi->cfl_alpha_idx = mbmi->cfl_alpha_idx;
diff --git a/av1/decoder/inspection.h b/av1/decoder/inspection.h
index 8d19fcc..e80a79b 100644
--- a/av1/decoder/inspection.h
+++ b/av1/decoder/inspection.h
@@ -49,10 +49,8 @@
 #endif
   int16_t tx_type;
   int16_t tx_size;
-#if CONFIG_CDEF
   int16_t cdef_level;
   int16_t cdef_strength;
-#endif
 #if CONFIG_CFL
   int16_t cfl_alpha_idx;
   int16_t cfl_alpha_sign;
@@ -77,9 +75,7 @@
   int16_t y_dequant[MAX_SEGMENTS][2];
   int16_t u_dequant[MAX_SEGMENTS][2];
   int16_t v_dequant[MAX_SEGMENTS][2];
-#if CONFIG_CDEF
-// TODO(negge): add per frame CDEF data
-#endif
+  // TODO(negge): add per frame CDEF data
   int delta_q_present_flag;
   int delta_q_res;
 };
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 8d8a664..9f7e314 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -24,9 +24,7 @@
 #include "aom_util/debug_util.h"
 #endif  // CONFIG_BITSTREAM_DEBUG
 
-#if CONFIG_CDEF
 #include "av1/common/cdef.h"
-#endif  // CONFIG_CDEF
 #include "av1/common/entropy.h"
 #include "av1/common/entropymode.h"
 #include "av1/common/entropymv.h"
@@ -2443,7 +2441,6 @@
   }
 #endif
 
-#if CONFIG_CDEF
   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];
@@ -2464,7 +2461,6 @@
       }
     }
   }
-#endif
 #if CONFIG_LOOP_RESTORATION
   for (int plane = 0; plane < MAX_MB_PLANE; ++plane) {
     int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
@@ -2747,7 +2743,6 @@
   }
 }
 
-#if CONFIG_CDEF
 static void encode_cdef(const AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
 #if CONFIG_INTRABC
   if (cm->allow_intrabc && NO_FILTER_FOR_IBC) return;
@@ -2767,7 +2762,6 @@
       aom_wb_write_literal(wb, cm->cdef_uv_strengths[i], CDEF_STRENGTH_BITS);
   }
 }
-#endif
 
 static void write_delta_q(struct aom_write_bit_buffer *wb, int delta_q) {
   if (delta_q != 0) {
@@ -4093,11 +4087,9 @@
       }
     }
   }
-#if CONFIG_CDEF
   if (!cm->all_lossless) {
     encode_cdef(cm, wb);
   }
-#endif
 #if CONFIG_LOOP_RESTORATION
   encode_restoration_mode(cm, wb);
 #endif  // CONFIG_LOOP_RESTORATION
@@ -4454,11 +4446,9 @@
       }
     }
   }
-#if CONFIG_CDEF
   if (!cm->all_lossless) {
     encode_cdef(cm, wb);
   }
-#endif
 #if CONFIG_LOOP_RESTORATION
   encode_restoration_mode(cm, wb);
 #endif  // CONFIG_LOOP_RESTORATION
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 807b706..0d074ac 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -16,9 +16,7 @@
 #include "./aom_config.h"
 
 #include "av1/common/alloccommon.h"
-#if CONFIG_CDEF
 #include "av1/common/cdef.h"
-#endif  // CONFIG_CDEF
 #include "av1/common/filter.h"
 #include "av1/common/idct.h"
 #include "av1/common/reconinter.h"
@@ -4610,9 +4608,7 @@
   MACROBLOCKD *xd = &cpi->td.mb.e_mbd;
   struct loopfilter *lf = &cm->lf;
   int no_loopfilter = 0;
-#if CONFIG_CDEF
   int no_cdef = 0;
-#endif
 #if CONFIG_LOOP_RESTORATION
   int no_restoration = 0;
   if (is_lossless_requested(&cpi->oxcf)
@@ -4628,7 +4624,6 @@
   }
 #endif
 
-#if CONFIG_CDEF
   if (is_lossless_requested(&cpi->oxcf) || !cpi->oxcf.using_cdef
 #if CONFIG_EXT_TILE
       || cm->single_tile_decoding
@@ -4636,7 +4631,6 @@
       ) {
     no_cdef = 1;
   }
-#endif
 
   if (no_loopfilter) {
 #if CONFIG_LOOPFILTER_LEVEL
@@ -4692,7 +4686,6 @@
     av1_loop_restoration_save_boundary_lines(cm->frame_to_show, cm, 0);
 #endif
 
-#if CONFIG_CDEF
   if (no_cdef) {
     cm->cdef_bits = 0;
     cm->cdef_strengths[0] = 0;
@@ -4705,7 +4698,6 @@
     // Apply the filter
     av1_cdef_frame(cm->frame_to_show, cm, xd);
   }
-#endif
 
 #if CONFIG_FRAME_SUPERRES
   superres_post_encode(cpi);
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index d288701..dfb0b2e 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -196,9 +196,7 @@
 #if CONFIG_EXT_DELTA_Q
   DELTAQ_MODE deltaq_mode;
 #endif
-#if CONFIG_CDEF
   int using_cdef;
-#endif
 #if CONFIG_AOM_QM
   int using_qm;
   int qm_minlevel;
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 4804299..8c1f31b 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -156,9 +156,7 @@
     } else {
       sf->use_square_partition_only = !frame_is_intra_only(cm);
     }
-#if CONFIG_CDEF
     sf->fast_cdef_search = 1;
-#endif  // CONFIG_CDEF
 
     sf->less_rectangular_check = 1;
 
@@ -450,9 +448,7 @@
 #if CONFIG_EXT_PARTITION_TYPES
   sf->prune_ext_partition_types_search = 0;
 #endif  // CONFIG_EXT_PARTITION_TYPES
-#if CONFIG_CDEF
   sf->fast_cdef_search = 0;
-#endif  // CONFIG_CDEF
 
   // Set this at the appropriate speed levels
   sf->use_transform_domain_distortion = 0;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 93434b8..4ab8807 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -338,9 +338,7 @@
   int prune_ext_partition_types_search;
 #endif  // CONFIG_EXT_PARTITION_TYPES
 
-#if CONFIG_CDEF
   int fast_cdef_search;
-#endif  // CONFIG_CDEF
 
   // Skip rectangular partition test when partition type none gives better
   // rd than partition type split.
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 151e0b6..6da62f4 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -111,7 +111,6 @@
 set(CONFIG_ANS 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_AOM_QM 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_BGSPRITE 0 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_CDEF 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_CDEF_SINGLEPASS 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_CFL 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_COLORSPACE_HEADERS 0 CACHE NUMBER "AV1 experiment flag.")
diff --git a/configure b/configure
index a5f96db..0bab2a6 100755
--- a/configure
+++ b/configure
@@ -247,7 +247,6 @@
 "
 EXPERIMENT_LIST="
     fp_mb_stats
-    cdef
     cdef_singlepass
     rect_tx_ext
     tpl_mv
@@ -495,7 +494,6 @@
     # Enable adopted experiments by default
     soft_enable adopted_experiments
     if enabled adopted_experiments; then
-      soft_enable cdef
       soft_enable cdef_singlepass
       soft_enable ext_intra
       soft_enable intra_edge
@@ -546,7 +544,6 @@
     enabled compound_round && soft_enable convolve_round
     enabled ext_intra_mod && enable_feature intra_edge
     enabled intra_edge && enable_feature ext_intra
-    enabled cdef_singlepass && enable_feature cdef
     enabled mfmv && enable_feature frame_marker
     enabled jnt_comp && enable_feature frame_marker
     enabled frame_refs && enable_feature frame_marker
diff --git a/examples/inspect.c b/examples/inspect.c
index ea3976a..894cacb 100644
--- a/examples/inspect.c
+++ b/examples/inspect.c
@@ -119,9 +119,7 @@
                                         &dump_uv_mode_arg,
                                         &dump_skip_arg,
                                         &dump_filter_arg,
-#if CONFIG_CDEF
                                         &dump_cdef_arg,
-#endif
 #if CONFIG_DUAL_FILTER
                                         &dump_dual_filter_type_arg,
 #endif
@@ -570,14 +568,12 @@
         put_block_info(buf, NULL, "filter", offsetof(insp_mi_data, filter), 0);
 #endif
   }
-#if CONFIG_CDEF
   if (layers & CDEF_LAYER) {
     buf += put_block_info(buf, NULL, "cdef_level",
                           offsetof(insp_mi_data, cdef_level), 0);
     buf += put_block_info(buf, NULL, "cdef_strength",
                           offsetof(insp_mi_data, cdef_strength), 0);
   }
-#endif
 #if CONFIG_CFL
   if (layers & CFL_LAYER) {
     buf += put_block_info(buf, NULL, "cfl_alpha_idx",
@@ -734,10 +730,8 @@
       layers |= SKIP_LAYER;
     else if (arg_match(&arg, &dump_filter_arg, argi))
       layers |= FILTER_LAYER;
-#if CONFIG_CDEF
     else if (arg_match(&arg, &dump_cdef_arg, argi))
       layers |= CDEF_LAYER;
-#endif
 #if CONFIG_CFL
     else if (arg_match(&arg, &dump_cfl_arg, argi))
       layers |= CFL_LAYER;
diff --git a/test/test.cmake b/test/test.cmake
index e9b2d6a..df6ed85 100644
--- a/test/test.cmake
+++ b/test/test.cmake
@@ -138,17 +138,15 @@
         ${AOM_UNIT_TEST_ENCODER_SOURCES}
         "${AOM_ROOT}/test/motion_vector_test.cc")
 
-    if (CONFIG_CDEF)
-      if (CONFIG_CDEF_SINGLEPASS)
-        set(AOM_UNIT_TEST_COMMON_SOURCES
-            ${AOM_UNIT_TEST_COMMON_SOURCES}
-            "${AOM_ROOT}/test/cdef_test.cc")
-      else ()
-        set(AOM_UNIT_TEST_COMMON_SOURCES
-            ${AOM_UNIT_TEST_COMMON_SOURCES}
-            "${AOM_ROOT}/test/clpf_test.cc"
-            "${AOM_ROOT}/test/dering_test.cc")
-      endif ()
+    if (CONFIG_CDEF_SINGLEPASS)
+      set(AOM_UNIT_TEST_COMMON_SOURCES
+          ${AOM_UNIT_TEST_COMMON_SOURCES}
+          "${AOM_ROOT}/test/cdef_test.cc")
+    else ()
+      set(AOM_UNIT_TEST_COMMON_SOURCES
+          ${AOM_UNIT_TEST_COMMON_SOURCES}
+          "${AOM_ROOT}/test/clpf_test.cc"
+          "${AOM_ROOT}/test/dering_test.cc")
     endif ()
 
     if (CONFIG_INTRABC)
diff --git a/test/test.mk b/test/test.mk
index f315d96..17bdb81 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -136,10 +136,10 @@
 LIBAOM_TEST_SRCS-yes                   += convolve_test.cc
 LIBAOM_TEST_SRCS-yes                   += lpf_8_test.cc
 ifeq ($(CONFIG_CDEF_SINGLEPASS),yes)
-LIBAOM_TEST_SRCS-$(CONFIG_CDEF)        += cdef_test.cc
+LIBAOM_TEST_SRCS-yes                   += cdef_test.cc
 else
-LIBAOM_TEST_SRCS-$(CONFIG_CDEF)        += dering_test.cc
-LIBAOM_TEST_SRCS-$(CONFIG_CDEF)        += clpf_test.cc
+LIBAOM_TEST_SRCS-yes                   += dering_test.cc
+LIBAOM_TEST_SRCS-yes                   += clpf_test.cc
 endif
 LIBAOM_TEST_SRCS-yes                   += simd_cmp_impl.h
 LIBAOM_TEST_SRCS-$(HAVE_SSE2)          += simd_cmp_sse2.cc