Add codec control to get CDEF strengths for LUMA
Manually tested with aomenc
Bug: b/283122279
Change-Id: I3045c5de257026879a8c14c28fa5d83a986d4fac
diff --git a/aom/aomcx.h b/aom/aomcx.h
index 8887e9a..783f56a 100644
--- a/aom/aomcx.h
+++ b/aom/aomcx.h
@@ -1513,6 +1513,11 @@
*/
AV1E_SET_RATE_DISTRIBUTION_INFO = 161,
+ /*!\brief Codec control to get the CDEF strength for Y / luma plane.
+ * Returns an array of CDEF_MAX_STRENGTHS.
+ */
+ AV1E_GET_LUMA_CDEF_STRENGTH = 162,
+
// Any new encoder control IDs should be added above.
// Maximum allowed encoder control ID is 229.
// No encoder control ID should be added below.
@@ -2152,6 +2157,9 @@
AOM_CTRL_USE_TYPE(AV1E_SET_RATE_DISTRIBUTION_INFO, const char *)
#define AOM_CTRL_AV1E_SET_RATE_DISTRIBUTION_INFO
+AOM_CTRL_USE_TYPE(AV1E_GET_LUMA_CDEF_STRENGTH, int *)
+#define AOM_CTRL_AV1E_GET_LUMA_CDEF_STRENGTH
+
/*!\endcond */
/*! @} - end defgroup aom_encoder */
#ifdef __cplusplus
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 3b62e00..c469ad5 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -4178,6 +4178,16 @@
return AOM_CODEC_OK;
}
+static aom_codec_err_t ctrl_get_luma_cdef_strength(aom_codec_alg_priv_t *ctx,
+ va_list args) {
+ int *arg = va_arg(args, int *);
+ AV1_COMMON const *cm = &ctx->ppi->cpi->common;
+ if (arg == NULL) return AOM_CODEC_INVALID_PARAM;
+ memcpy(arg, cm->cdef_info.cdef_strengths, CDEF_MAX_STRENGTHS * sizeof(*arg));
+
+ return AOM_CODEC_OK;
+}
+
static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ AV1_COPY_REFERENCE, ctrl_copy_reference },
{ AOME_USE_REFERENCE, ctrl_use_reference },
@@ -4336,6 +4346,7 @@
{ AV1E_GET_BASELINE_GF_INTERVAL, ctrl_get_baseline_gf_interval },
{ AV1E_GET_TARGET_SEQ_LEVEL_IDX, ctrl_get_target_seq_level_idx },
{ AV1E_GET_NUM_OPERATING_POINTS, ctrl_get_num_operating_points },
+ { AV1E_GET_LUMA_CDEF_STRENGTH, ctrl_get_luma_cdef_strength },
CTRL_MAP_END,
};