Various refactoring on cdef search interface
Change-Id: I90fd48b76085550e60bb9e7ab761606ab69d6f99
diff --git a/av1/av1.cmake b/av1/av1.cmake
index 73814e7..5bf342c 100644
--- a/av1/av1.cmake
+++ b/av1/av1.cmake
@@ -193,6 +193,7 @@
"${AOM_ROOT}/av1/encoder/pass2_strategy.h"
"${AOM_ROOT}/av1/encoder/pass2_strategy.c"
"${AOM_ROOT}/av1/encoder/pickcdef.c"
+ "${AOM_ROOT}/av1/encoder/pickcdef.h"
"${AOM_ROOT}/av1/encoder/picklpf.c"
"${AOM_ROOT}/av1/encoder/picklpf.h"
"${AOM_ROOT}/av1/encoder/pickrst.c"
diff --git a/av1/common/cdef.h b/av1/common/cdef.h
index e5a9f94..14d58c4 100644
--- a/av1/common/cdef.h
+++ b/av1/common/cdef.h
@@ -42,42 +42,6 @@
BLOCK_SIZE bsize);
void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd);
-/*!\brief AV1 CDEF parameter search
- *
- * \ingroup in_loop_cdef
- *
- * Searches for optimal CDEF parameters for frame
- *
- * \param[in] frame Compressed frame buffer
- * \param[in] ref Source frame buffer
- * \param[in,out] cm Pointer to top level common structure
- * \param[in] xd Pointer to common current coding block structure
- * \param[in] pick_method The method used to select params
- * \param[in] rdmult rd multiplier to use in making param choices
- *
- * \par pick_method includes:
- * \arg \c CDEF_FULL_SEARCH: Do full search
- * \arg \c CDEF_FAST_SEARCH_LVL1: Search among a subset of all possible filters.
- * \arg \c CDEF_FAST_SEARCH_LVL2: Search reduced subset of filters than Level 1.
- * \arg \c CDEF_FAST_SEARCH_LVL3: Search reduced subset of secondary filters
- * than Level 2.
- * \arg \c CDEF_PICK_FROM_Q: Estimate filter strength based on quantizer.
- *
- * \return Nothing is returned. Instead, optimal CDEF parameters are stored
- * in the \c cdef_info structure inside \c cm:
- * \arg \c cdef_bits: Bits of strength parameters
- * \arg \c nb_cdef_strengths: Number of strength parameters
- * \arg \c cdef_strengths: list of \c nb_cdef_strengths strength parameters
- * for the luma plane.
- * \arg \c uv_cdef_strengths: list of \c nb_cdef_strengths strength parameters
- * for the chroma planes.
- *
- */
-// TODO(any): convert type of pick_method to CDEF_PICK_METHOD
-void av1_cdef_search(const YV12_BUFFER_CONFIG *frame,
- const YV12_BUFFER_CONFIG *ref, AV1_COMMON *cm,
- MACROBLOCKD *xd, int pick_method, int rdmult);
-
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/av1/encoder/encodemb.h b/av1/encoder/encodemb.h
index fea51f0..b74c5ea 100644
--- a/av1/encoder/encodemb.h
+++ b/av1/encoder/encodemb.h
@@ -16,6 +16,7 @@
#include "av1/common/av1_common_int.h"
#include "av1/common/txb_common.h"
+#include "av1/encoder/av1_quantize.h"
#include "av1/encoder/block.h"
#include "av1/encoder/tokenize.h"
#ifdef __cplusplus
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 69a8ea0..b843118 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -39,7 +39,6 @@
#endif // CONFIG_BITSTREAM_DEBUG
#include "av1/common/alloccommon.h"
-#include "av1/common/cdef.h"
#include "av1/common/filter.h"
#include "av1/common/idct.h"
#include "av1/common/reconinter.h"
@@ -66,6 +65,7 @@
#include "av1/encoder/intra_mode_search.h"
#include "av1/encoder/mv_prec.h"
#include "av1/encoder/pass2_strategy.h"
+#include "av1/encoder/pickcdef.h"
#include "av1/encoder/picklpf.h"
#include "av1/encoder/pickrst.h"
#include "av1/encoder/random.h"
diff --git a/av1/encoder/pickcdef.c b/av1/encoder/pickcdef.c
index ef65671..25232e1 100644
--- a/av1/encoder/pickcdef.c
+++ b/av1/encoder/pickcdef.c
@@ -18,9 +18,9 @@
#include "aom/aom_integer.h"
#include "aom_ports/system_state.h"
#include "av1/common/av1_common_int.h"
-#include "av1/common/cdef.h"
#include "av1/common/reconinter.h"
#include "av1/encoder/encoder.h"
+#include "av1/encoder/pickcdef.h"
#define REDUCED_PRI_STRENGTHS_LVL1 8
#define REDUCED_PRI_STRENGTHS_LVL2 5
@@ -380,7 +380,8 @@
void av1_cdef_search(const YV12_BUFFER_CONFIG *frame,
const YV12_BUFFER_CONFIG *ref, AV1_COMMON *cm,
- MACROBLOCKD *xd, int pick_method, int rdmult) {
+ MACROBLOCKD *xd, CDEF_PICK_METHOD pick_method,
+ int rdmult) {
if (pick_method == CDEF_PICK_FROM_Q) {
pick_cdef_from_qp(cm);
return;
diff --git a/av1/encoder/pickcdef.h b/av1/encoder/pickcdef.h
new file mode 100644
index 0000000..eaa3e95
--- /dev/null
+++ b/av1/encoder/pickcdef.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+#ifndef AOM_AV1_ENCODER_PICKCDEF_H_
+#define AOM_AV1_ENCODER_PICKCDEF_H_
+
+#include "av1/common/cdef.h"
+#include "av1/encoder/speed_features.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!\brief AV1 CDEF parameter search
+ *
+ * \ingroup in_loop_cdef
+ *
+ * Searches for optimal CDEF parameters for frame
+ *
+ * \param[in] frame Compressed frame buffer
+ * \param[in] ref Source frame buffer
+ * \param[in,out] cm Pointer to top level common structure
+ * \param[in] xd Pointer to common current coding block structure
+ * \param[in] pick_method The method used to select params
+ * \param[in] rdmult rd multiplier to use in making param choices
+ *
+ * \return Nothing is returned. Instead, optimal CDEF parameters are stored
+ * in the \c cdef_info structure inside \c cm:
+ * \arg \c cdef_bits: Bits of strength parameters
+ * \arg \c nb_cdef_strengths: Number of strength parameters
+ * \arg \c cdef_strengths: list of \c nb_cdef_strengths strength parameters
+ * for the luma plane.
+ * \arg \c uv_cdef_strengths: list of \c nb_cdef_strengths strength parameters
+ * for the chroma planes.
+ *
+ */
+void av1_cdef_search(const YV12_BUFFER_CONFIG *frame,
+ const YV12_BUFFER_CONFIG *ref, AV1_COMMON *cm,
+ MACROBLOCKD *xd, CDEF_PICK_METHOD pick_method, int rdmult);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+#endif // AOM_AV1_ENCODER_PICKCDEF_H_
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 5608d53..25f856f 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -13,11 +13,18 @@
#define AOM_AV1_ENCODER_SPEED_FEATURES_H_
#include "av1/common/enums.h"
+#include "av1/encoder/enc_enums.h"
+#include "av1/encoder/mcomp.h"
+#include "av1/encoder/encodemb.h"
#ifdef __cplusplus
extern "C" {
#endif
+/*! @file */
+
+/*!\cond */
+
#define MAX_MESH_STEP 4
typedef struct MESH_PATTERN {
@@ -142,17 +149,22 @@
// Pick 0 to disable LPF if LPF was enabled last frame
LPF_PICK_MINIMAL_LPF
} UENUM1BYTE(LPF_PICK_METHOD);
+/*!\endcond */
-enum {
- CDEF_FULL_SEARCH,
- CDEF_FAST_SEARCH_LVL1, // Search among a subset of all possible filters.
- CDEF_FAST_SEARCH_LVL2, // Search reduced subset of filters than Level 1.
- CDEF_FAST_SEARCH_LVL3, // Search reduced subset of secondary filters than
- // Level 2.
- CDEF_PICK_FROM_Q, // Estimate filter strength based on quantizer.
+/*!\enum CDEF_PICK_METHOD
+ * \brief This enumeration defines a variety of CDEF pick methods
+ */
+typedef enum {
+ CDEF_FULL_SEARCH, /**< Full search */
+ CDEF_FAST_SEARCH_LVL1, /**< Search among a subset of all possible filters. */
+ CDEF_FAST_SEARCH_LVL2, /**< Search reduced subset of filters than Level 1. */
+ CDEF_FAST_SEARCH_LVL3, /**< Search reduced subset of secondary filters than
+ Level 2. */
+ CDEF_PICK_FROM_Q, /**< Estimate filter strength based on quantizer. */
CDEF_PICK_METHODS
-} UENUM1BYTE(CDEF_PICK_METHOD);
+} CDEF_PICK_METHOD;
+/*!\cond */
enum {
// Terminate search early based on distortion so far compared to
// qp step, distortion in the neighborhood of the frame, etc.
@@ -1039,6 +1051,8 @@
int speed);
void av1_set_speed_features_qindex_dependent(struct AV1_COMP *cpi, int speed);
+/*!\endcond */
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/docs.cmake b/docs.cmake
index 2466ca4..39938b3 100644
--- a/docs.cmake
+++ b/docs.cmake
@@ -125,10 +125,12 @@
"${AOM_ROOT}/av1/encoder/lookahead.h"
"${AOM_ROOT}/av1/encoder/palette.h"
"${AOM_ROOT}/av1/encoder/palette.c"
+ "${AOM_ROOT}/av1/encoder/pickcdef.h"
"${AOM_ROOT}/av1/encoder/picklpf.h"
"${AOM_ROOT}/av1/encoder/pickrst.h"
"${AOM_ROOT}/av1/encoder/rdopt.h"
"${AOM_ROOT}/av1/encoder/rdopt.c"
+ "${AOM_ROOT}/av1/encoder/speed_features.h"
"${AOM_ROOT}/av1/encoder/tx_search.h")
endif()