summaryrefslogtreecommitdiff
path: root/media/libaom/src/aom
diff options
context:
space:
mode:
Diffstat (limited to 'media/libaom/src/aom')
-rw-r--r--media/libaom/src/aom/aom.h86
-rw-r--r--media/libaom/src/aom/aom_codec.h149
-rw-r--r--media/libaom/src/aom/aom_decoder.h137
-rw-r--r--media/libaom/src/aom/aom_encoder.h259
-rw-r--r--media/libaom/src/aom/aom_frame_buffer.h6
-rw-r--r--media/libaom/src/aom/aom_image.h145
-rw-r--r--media/libaom/src/aom/aom_integer.h3
-rw-r--r--media/libaom/src/aom/aomcx.h1472
-rw-r--r--media/libaom/src/aom/aomdx.h235
-rw-r--r--media/libaom/src/aom/exports_com11
-rw-r--r--media/libaom/src/aom/exports_dec2
-rw-r--r--media/libaom/src/aom/exports_enc1
-rw-r--r--media/libaom/src/aom/exports_test2
-rw-r--r--media/libaom/src/aom/internal/aom_codec_internal.h82
-rw-r--r--media/libaom/src/aom/internal/aom_image_internal.h93
-rw-r--r--media/libaom/src/aom/src/aom_codec.c2
-rw-r--r--media/libaom/src/aom/src/aom_decoder.c51
-rw-r--r--media/libaom/src/aom/src/aom_encoder.c136
-rw-r--r--media/libaom/src/aom/src/aom_image.c188
19 files changed, 1910 insertions, 1150 deletions
diff --git a/media/libaom/src/aom/aom.h b/media/libaom/src/aom/aom.h
index b1cc1ecceb..c591dc9a43 100644
--- a/media/libaom/src/aom/aom.h
+++ b/media/libaom/src/aom/aom.h
@@ -43,64 +43,27 @@ extern "C" {
* The set of macros define the control functions of AOM interface
*/
enum aom_com_control_id {
- /*!\brief pass in an external frame into decoder to be used as reference frame
+ /* TODO(https://crbug.com/aomedia/2671): The encoder overlaps the range of
+ * these values for its control ids, see the NOTEs in aom/aomcx.h. These
+ * should be migrated to something like the AOM_DECODER_CTRL_ID_START range
+ * next time we're ready to break the ABI.
*/
- AOM_SET_POSTPROC = 3, /**< set the decoder's post processing settings */
- AOM_SET_DBG_COLOR_REF_FRAME =
- 4, /**< set the reference frames to color for each macroblock */
- AOM_SET_DBG_COLOR_MB_MODES = 5, /**< set which macro block modes to color */
- AOM_SET_DBG_COLOR_B_MODES = 6, /**< set which blocks modes to color */
- AOM_SET_DBG_DISPLAY_MV = 7, /**< set which motion vector modes to draw */
-
- /* TODO(jkoleszar): The encoder incorrectly reuses some of these values (5+)
- * for its control ids. These should be migrated to something like the
- * AOM_DECODER_CTRL_ID_START range next time we're ready to break the ABI.
- */
- AV1_GET_REFERENCE = 128, /**< get a pointer to a reference frame */
- AV1_SET_REFERENCE = 129, /**< write a frame into a reference buffer */
- AV1_COPY_REFERENCE =
- 130, /**< get a copy of reference frame from the decoder */
+ AV1_GET_REFERENCE = 128, /**< get a pointer to a reference frame,
+ av1_ref_frame_t* parameter */
+ AV1_SET_REFERENCE = 129, /**< write a frame into a reference buffer,
+ av1_ref_frame_t* parameter */
+ AV1_COPY_REFERENCE = 130, /**< get a copy of reference frame from the decoderm
+ av1_ref_frame_t* parameter */
AOM_COMMON_CTRL_ID_MAX,
- AV1_GET_NEW_FRAME_IMAGE = 192, /**< get a pointer to the new frame */
- AV1_COPY_NEW_FRAME_IMAGE =
- 193, /**< copy the new frame to an external buffer */
+ AV1_GET_NEW_FRAME_IMAGE =
+ 192, /**< get a pointer to the new frame, aom_image_t* parameter */
+ AV1_COPY_NEW_FRAME_IMAGE = 193, /**< copy the new frame to an external buffer,
+ aom_image_t* parameter */
AOM_DECODER_CTRL_ID_START = 256
};
-/*!\brief post process flags
- *
- * The set of macros define AOM decoder post processing flags
- */
-enum aom_postproc_level {
- AOM_NOFILTERING = 0,
- AOM_DEBLOCK = 1 << 0,
- AOM_DEMACROBLOCK = 1 << 1,
- AOM_ADDNOISE = 1 << 2,
- AOM_DEBUG_TXT_FRAME_INFO = 1 << 3, /**< print frame information */
- AOM_DEBUG_TXT_MBLK_MODES =
- 1 << 4, /**< print macro block modes over each macro block */
- AOM_DEBUG_TXT_DC_DIFF = 1 << 5, /**< print dc diff for each macro block */
- AOM_DEBUG_TXT_RATE_INFO = 1 << 6, /**< print video rate info (encoder only) */
- AOM_MFQE = 1 << 10
-};
-
-/*!\brief post process flags
- *
- * This define a structure that describe the post processing settings. For
- * the best objective measure (using the PSNR metric) set post_proc_flag
- * to AOM_DEBLOCK and deblocking_level to 1.
- */
-
-typedef struct aom_postproc_cfg {
- /*!\brief the types of post processing to be done, should be combination of
- * "aom_postproc_level" */
- int post_proc_flag;
- int deblocking_level; /**< the strength of deblocking, valid range [0, 16] */
- int noise_level; /**< the strength of additive noise, valid range [0, 16] */
-} aom_postproc_cfg_t;
-
/*!\brief AV1 specific reference frame data struct
*
* Define the data struct to access av1 reference frames.
@@ -114,26 +77,25 @@ typedef struct av1_ref_frame {
/*!\cond */
/*!\brief aom decoder control function parameter type
*
- * defines the data type for each of AOM decoder control function requires
+ * Defines the data type for each of AOM decoder control function requires.
+ *
+ * \note For each control ID "X", a macro-define of
+ * AOM_CTRL_X is provided. It is used at compile time to determine
+ * if the control ID is supported by the libaom library available,
+ * when the libaom version cannot be controlled.
*/
-AOM_CTRL_USE_TYPE(AOM_SET_POSTPROC, aom_postproc_cfg_t *)
-#define AOM_CTRL_AOM_SET_POSTPROC
-AOM_CTRL_USE_TYPE(AOM_SET_DBG_COLOR_REF_FRAME, int)
-#define AOM_CTRL_AOM_SET_DBG_COLOR_REF_FRAME
-AOM_CTRL_USE_TYPE(AOM_SET_DBG_COLOR_MB_MODES, int)
-#define AOM_CTRL_AOM_SET_DBG_COLOR_MB_MODES
-AOM_CTRL_USE_TYPE(AOM_SET_DBG_COLOR_B_MODES, int)
-#define AOM_CTRL_AOM_SET_DBG_COLOR_B_MODES
-AOM_CTRL_USE_TYPE(AOM_SET_DBG_DISPLAY_MV, int)
-#define AOM_CTRL_AOM_SET_DBG_DISPLAY_MV
AOM_CTRL_USE_TYPE(AV1_GET_REFERENCE, av1_ref_frame_t *)
#define AOM_CTRL_AV1_GET_REFERENCE
+
AOM_CTRL_USE_TYPE(AV1_SET_REFERENCE, av1_ref_frame_t *)
#define AOM_CTRL_AV1_SET_REFERENCE
+
AOM_CTRL_USE_TYPE(AV1_COPY_REFERENCE, av1_ref_frame_t *)
#define AOM_CTRL_AV1_COPY_REFERENCE
+
AOM_CTRL_USE_TYPE(AV1_GET_NEW_FRAME_IMAGE, aom_image_t *)
#define AOM_CTRL_AV1_GET_NEW_FRAME_IMAGE
+
AOM_CTRL_USE_TYPE(AV1_COPY_NEW_FRAME_IMAGE, aom_image_t *)
#define AOM_CTRL_AV1_COPY_NEW_FRAME_IMAGE
diff --git a/media/libaom/src/aom/aom_codec.h b/media/libaom/src/aom/aom_codec.h
index fc0df5b9eb..75f6a1af22 100644
--- a/media/libaom/src/aom/aom_codec.h
+++ b/media/libaom/src/aom/aom_codec.h
@@ -95,7 +95,7 @@ extern "C" {
* types, removing or reassigning enums, adding/removing/rearranging
* fields to structures
*/
-#define AOM_CODEC_ABI_VERSION (3 + AOM_IMAGE_ABI_VERSION) /**<\hideinitializer*/
+#define AOM_CODEC_ABI_VERSION (5 + AOM_IMAGE_ABI_VERSION) /**<\hideinitializer*/
/*!\brief Algorithm return codes */
typedef enum {
@@ -173,10 +173,25 @@ typedef long aom_codec_caps_t;
*/
typedef long aom_codec_flags_t;
+/*!\brief Time Stamp Type
+ *
+ * An integer, which when multiplied by the stream's time base, provides
+ * the absolute time of a sample.
+ */
+typedef int64_t aom_codec_pts_t;
+
/*!\brief Codec interface structure.
*
* Contains function pointers and other data private to the codec
- * implementation. This structure is opaque to the application.
+ * implementation. This structure is opaque to the application. Common
+ * functions used with this structure:
+ * - aom_codec_iface_name: get the name of the codec
+ * - aom_codec_get_caps: returns the capabilities of the codec (see
+ * aom_encoder.h for more details)
+ * - aom_codec_enc_config_default: generate the default config to use
+ * when initializing the encoder
+ * - aom_codec_dec_init, aom_codec_enc_init: initialize the codec context
+ * structure (see documentation on aom_codec_ctx for more information).
*/
typedef const struct aom_codec_iface aom_codec_iface_t;
@@ -370,19 +385,24 @@ aom_codec_err_t aom_codec_destroy(aom_codec_ctx_t *ctx);
*/
aom_codec_caps_t aom_codec_get_caps(aom_codec_iface_t *iface);
-/*!\brief Control algorithm
+/*!\name Codec Control
*
- * This function is used to exchange algorithm specific data with the codec
- * instance. This can be used to implement features specific to a particular
- * algorithm.
+ * The aom_codec_control function exchanges algorithm specific data with the
+ * codec instance. Additionally, the macro AOM_CODEC_CONTROL_TYPECHECKED is
+ * provided, which will type-check the parameter against the control ID before
+ * calling aom_codec_control - note that this macro requires the control ID
+ * to be directly encoded in it, e.g.,
+ * AOM_CODEC_CONTROL_TYPECHECKED(&ctx, AOME_SET_CPUUSED, 8).
*
- * This wrapper function dispatches the request to the helper function
- * associated with the given ctrl_id. It tries to call this function
- * transparently, but will return #AOM_CODEC_ERROR if the request could not
- * be dispatched.
+ * The codec control IDs can be found in aom.h, aomcx.h, and aomdx.h
+ * (defined as aom_com_control_id, aome_enc_control_id, and aom_dec_control_id).
+ * @{
+ */
+/*!\brief Algorithm Control
*
- * Note that this function should not be used directly. Call the
- * #aom_codec_control wrapper macro instead.
+ * aom_codec_control takes a context, a control ID, and a third parameter
+ * (with varying type). If the context is non-null and an error occurs,
+ * ctx->err will be set to the same value as the return value.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] ctrl_id Algorithm specific control identifier
@@ -394,85 +414,33 @@ aom_codec_caps_t aom_codec_get_caps(aom_codec_iface_t *iface);
* \retval #AOM_CODEC_INVALID_PARAM
* The data was not valid.
*/
-aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...);
-#if defined(AOM_DISABLE_CTRL_TYPECHECKS) && AOM_DISABLE_CTRL_TYPECHECKS
-#define aom_codec_control(ctx, id, data) aom_codec_control_(ctx, id, data)
-#define AOM_CTRL_USE_TYPE(id, typ)
-#define AOM_CTRL_USE_TYPE_DEPRECATED(id, typ)
-#define AOM_CTRL_VOID(id, typ)
+aom_codec_err_t aom_codec_control(aom_codec_ctx_t *ctx, int ctrl_id, ...);
-#else
-/*!\brief aom_codec_control wrapper macro
+/*!\brief aom_codec_control wrapper macro (adds type-checking, less flexible)
*
* This macro allows for type safe conversions across the variadic parameter
- * to aom_codec_control_().
- *
- * \internal
- * It works by dispatching the call to the control function through a wrapper
- * function named with the id parameter.
- */
-#define aom_codec_control(ctx, id, data) \
- aom_codec_control_##id(ctx, id, data) /**<\hideinitializer*/
-
-/*!\brief aom_codec_control type definition macro
- *
- * This macro allows for type safe conversions across the variadic parameter
- * to aom_codec_control_(). It defines the type of the argument for a given
- * control identifier.
- *
- * \internal
- * It defines a static function with
- * the correctly typed arguments as a wrapper to the type-unsafe internal
- * function.
+ * to aom_codec_control(). However, it requires the explicit control ID
+ * be passed in (it cannot be passed in via a variable) -- otherwise a compiler
+ * error will occur. After the type checking, it calls aom_codec_control.
*/
-#define AOM_CTRL_USE_TYPE(id, typ) \
- static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *, int, typ) \
- AOM_UNUSED; \
- \
- static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *ctx, \
- int ctrl_id, typ data) { \
- return aom_codec_control_(ctx, ctrl_id, data); \
- } /**<\hideinitializer*/
+#define AOM_CODEC_CONTROL_TYPECHECKED(ctx, id, data) \
+ aom_codec_control_typechecked_##id(ctx, id, data) /**<\hideinitializer*/
-/*!\brief aom_codec_control deprecated type definition macro
+/*!\brief Creates typechecking mechanisms for aom_codec_control
*
- * Like #AOM_CTRL_USE_TYPE, but indicates that the specified control is
- * deprecated and should not be used. Consult the documentation for your
- * codec for more information.
- *
- * \internal
- * It defines a static function with the correctly typed arguments as a
- * wrapper to the type-unsafe internal function.
- */
-#define AOM_CTRL_USE_TYPE_DEPRECATED(id, typ) \
- AOM_DECLSPEC_DEPRECATED static aom_codec_err_t aom_codec_control_##id( \
- aom_codec_ctx_t *, int, typ) AOM_DEPRECATED AOM_UNUSED; \
- \
- AOM_DECLSPEC_DEPRECATED static aom_codec_err_t aom_codec_control_##id( \
- aom_codec_ctx_t *ctx, int ctrl_id, typ data) { \
- return aom_codec_control_(ctx, ctrl_id, data); \
- } /**<\hideinitializer*/
-
-/*!\brief aom_codec_control void type definition macro
- *
- * This macro allows for type safe conversions across the variadic parameter
- * to aom_codec_control_(). It indicates that a given control identifier takes
- * no argument.
- *
- * \internal
- * It defines a static function without a data argument as a wrapper to the
- * type-unsafe internal function.
+ * It defines a static function with the correctly typed arguments as a wrapper
+ * to the type-unsafe aom_codec_control function. It also creates a typedef
+ * for each type.
*/
-#define AOM_CTRL_VOID(id) \
- static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *, int) \
- AOM_UNUSED; \
- \
- static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *ctx, \
- int ctrl_id) { \
- return aom_codec_control_(ctx, ctrl_id); \
- } /**<\hideinitializer*/
-
-#endif
+#define AOM_CTRL_USE_TYPE(id, typ) \
+ static aom_codec_err_t aom_codec_control_typechecked_##id( \
+ aom_codec_ctx_t *, int, typ) AOM_UNUSED; \
+ static aom_codec_err_t aom_codec_control_typechecked_##id( \
+ aom_codec_ctx_t *ctx, int ctrl, typ data) { \
+ return aom_codec_control(ctx, ctrl, data); \
+ } /**<\hideinitializer*/ \
+ typedef typ aom_codec_control_type_##id;
+/*!@} end Codec Control group */
/*!\brief OBU types. */
typedef enum ATTRIBUTE_PACKED {
@@ -503,19 +471,6 @@ typedef enum {
*/
const char *aom_obu_type_to_string(OBU_TYPE type);
-/*!\brief Config Options
- *
- * This type allows to enumerate and control options defined for control
- * via config file at runtime.
- */
-typedef struct cfg_options {
- /*!\brief Reflects if ext_partition should be enabled
- *
- * If this value is non-zero it enabled the feature
- */
- unsigned int ext_partition;
-} cfg_options_t;
-
/*!@} - end defgroup codec*/
#ifdef __cplusplus
}
diff --git a/media/libaom/src/aom/aom_decoder.h b/media/libaom/src/aom/aom_decoder.h
index 06c2dc5f7b..5ce7c7b103 100644
--- a/media/libaom/src/aom/aom_decoder.h
+++ b/media/libaom/src/aom/aom_decoder.h
@@ -42,7 +42,7 @@ extern "C" {
* fields to structures
*/
#define AOM_DECODER_ABI_VERSION \
- (3 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/
+ (6 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/
/*! \brief Decoder capabilities bitfield
*
@@ -52,11 +52,8 @@ extern "C" {
*
* The available flags are specified by AOM_CODEC_CAP_* defines.
*/
-#define AOM_CODEC_CAP_PUT_SLICE 0x10000 /**< Will issue put_slice callbacks */
-#define AOM_CODEC_CAP_PUT_FRAME 0x20000 /**< Will issue put_frame callbacks */
-#define AOM_CODEC_CAP_POSTPROC 0x40000 /**< Can postprocess decoded frame */
-/*!\brief Can receive encoded frames one fragment at a time */
-#define AOM_CODEC_CAP_INPUT_FRAGMENTS 0x100000
+/*!brief Can support external frame buffers */
+#define AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER 0x200000
/*! \brief Initialization-time Feature Enabling
*
@@ -65,15 +62,6 @@ extern "C" {
*
* The available flags are specified by AOM_CODEC_USE_* defines.
*/
-/*!\brief Can support frame-based multi-threading */
-#define AOM_CODEC_CAP_FRAME_THREADING 0x200000
-/*!brief Can support external frame buffers */
-#define AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER 0x400000
-
-#define AOM_CODEC_USE_POSTPROC 0x10000 /**< Postprocess decoded frame */
-/*!\brief The input frame should be passed to the decoder one fragment at a
- * time */
-#define AOM_CODEC_USE_INPUT_FRAGMENTS 0x40000
/*!\brief Stream properties
*
@@ -105,7 +93,6 @@ typedef struct aom_codec_dec_cfg {
unsigned int w; /**< Width */
unsigned int h; /**< Height */
unsigned int allow_lowbitdepth; /**< Allow use of low-bitdepth coding path */
- cfg_options_t cfg; /**< Options defined per config attributes */
} aom_codec_dec_cfg_t; /**< alias for struct aom_codec_dec_cfg */
/*!\brief Initialize a decoder instance
@@ -115,8 +102,8 @@ typedef struct aom_codec_dec_cfg {
* function directly, to ensure that the ABI version number parameter
* is properly initialized.
*
- * If the library was configured with --disable-multithread, this call
- * is not thread safe and should be guarded with a lock if being used
+ * If the library was configured with cmake -DCONFIG_MULTITHREAD=0, this
+ * call is not thread safe and should be guarded with a lock if being used
* in a multithreaded context.
*
* \param[in] ctx Pointer to this instance's context.
@@ -186,23 +173,12 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
/*!\brief Decode data
*
- * Processes a buffer of coded data. If the processing results in a new
- * decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be
- * generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
- * time stamp) order. Frames produced will always be in PTS (presentation
- * time stamp) order.
- * If the decoder is configured with AOM_CODEC_USE_INPUT_FRAGMENTS enabled,
- * data and data_sz can contain a fragment of the encoded frame. Fragment
- * \#n must contain at least partition \#n, but can also contain subsequent
- * partitions (\#n+1 - \#n+i), and if so, fragments \#n+1, .., \#n+i must
- * be empty. When no more data is available, this function should be called
- * with NULL as data and 0 as data_sz. The memory passed to this function
- * must be available until the frame has been decoded.
+ * Processes a buffer of coded data. Encoded data \ref MUST be passed in DTS
+ * (decode time stamp) order. Frames produced will always be in PTS
+ * (presentation time stamp) order.
*
* \param[in] ctx Pointer to this instance's context
- * \param[in] data Pointer to this block of new coded data. If
- * NULL, a AOM_CODEC_CB_PUT_FRAME event is posted
- * for the previously decoded frame.
+ * \param[in] data Pointer to this block of new coded data.
* \param[in] data_sz Size of the coded data, in bytes.
* \param[in] user_priv Application specific data to associate with
* this frame.
@@ -233,95 +209,12 @@ aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data,
*/
aom_image_t *aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter);
-/*!\defgroup cap_put_frame Frame-Based Decoding Functions
- *
- * The following functions are required to be implemented for all decoders
- * that advertise the AOM_CODEC_CAP_PUT_FRAME capability. Calling these
- * functions
- * for codecs that don't advertise this capability will result in an error
- * code being returned, usually AOM_CODEC_ERROR
- * @{
- */
-
-/*!\brief put frame callback prototype
- *
- * This callback is invoked by the decoder to notify the application of
- * the availability of decoded image data.
- */
-typedef void (*aom_codec_put_frame_cb_fn_t)(void *user_priv,
- const aom_image_t *img);
-
-/*!\brief Register for notification of frame completion.
- *
- * Registers a given function to be called when a decoded frame is
- * available.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] cb Pointer to the callback function
- * \param[in] user_priv User's private data
- *
- * \retval #AOM_CODEC_OK
- * Callback successfully registered.
- * \retval #AOM_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * posting slice completion.
- */
-aom_codec_err_t aom_codec_register_put_frame_cb(aom_codec_ctx_t *ctx,
- aom_codec_put_frame_cb_fn_t cb,
- void *user_priv);
-
-/*!@} - end defgroup cap_put_frame */
-
-/*!\defgroup cap_put_slice Slice-Based Decoding Functions
- *
- * The following functions are required to be implemented for all decoders
- * that advertise the AOM_CODEC_CAP_PUT_SLICE capability. Calling these
- * functions
- * for codecs that don't advertise this capability will result in an error
- * code being returned, usually AOM_CODEC_ERROR
- * @{
- */
-
-/*!\brief put slice callback prototype
- *
- * This callback is invoked by the decoder to notify the application of
- * the availability of partially decoded image data. The
- */
-typedef void (*aom_codec_put_slice_cb_fn_t)(void *user_priv,
- const aom_image_t *img,
- const aom_image_rect_t *valid,
- const aom_image_rect_t *update);
-
-/*!\brief Register for notification of slice completion.
- *
- * Registers a given function to be called when a decoded slice is
- * available.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] cb Pointer to the callback function
- * \param[in] user_priv User's private data
- *
- * \retval #AOM_CODEC_OK
- * Callback successfully registered.
- * \retval #AOM_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * posting slice completion.
- */
-aom_codec_err_t aom_codec_register_put_slice_cb(aom_codec_ctx_t *ctx,
- aom_codec_put_slice_cb_fn_t cb,
- void *user_priv);
-
-/*!@} - end defgroup cap_put_slice*/
-
/*!\defgroup cap_external_frame_buffer External Frame Buffer Functions
*
- * The following section is required to be implemented for all decoders
+ * The following function is required to be implemented for all decoders
* that advertise the AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER capability.
* Calling this function for codecs that don't advertise this capability
- * will result in an error code being returned, usually AOM_CODEC_ERROR.
- *
- * \note
- * Currently this only works with AV1.
+ * will result in an error code being returned, usually AOM_CODEC_INCAPABLE.
* @{
*/
@@ -343,13 +236,13 @@ aom_codec_err_t aom_codec_register_put_slice_cb(aom_codec_ctx_t *ctx,
* \retval #AOM_CODEC_INVALID_PARAM
* One or more of the callbacks were NULL.
* \retval #AOM_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * using external frame buffers.
+ * Decoder context not initialized.
+ * \retval #AOM_CODEC_INCAPABLE
+ * Algorithm not capable of using external frame buffers.
*
* \note
* When decoding AV1, the application may be required to pass in at least
- * #AOM_MAXIMUM_WORK_BUFFERS external frame
- * buffers.
+ * #AOM_MAXIMUM_WORK_BUFFERS external frame buffers.
*/
aom_codec_err_t aom_codec_set_frame_buffer_functions(
aom_codec_ctx_t *ctx, aom_get_frame_buffer_cb_fn_t cb_get,
diff --git a/media/libaom/src/aom/aom_encoder.h b/media/libaom/src/aom/aom_encoder.h
index 0894ca9e31..a494c17a49 100644
--- a/media/libaom/src/aom/aom_encoder.h
+++ b/media/libaom/src/aom/aom_encoder.h
@@ -41,7 +41,7 @@ extern "C" {
* fields to structures
*/
#define AOM_ENCODER_ABI_VERSION \
- (5 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/
+ (8 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/
/*! \brief Encoder capabilities bitfield
*
@@ -74,17 +74,10 @@ extern "C" {
* This structure is able to hold a reference to any fixed size buffer.
*/
typedef struct aom_fixed_buf {
- void *buf; /**< Pointer to the data */
+ void *buf; /**< Pointer to the data. Does NOT own the data! */
size_t sz; /**< Length of the buffer, in chars */
} aom_fixed_buf_t; /**< alias for struct aom_fixed_buf */
-/*!\brief Time Stamp Type
- *
- * An integer, which when multiplied by the stream's time base, provides
- * the absolute time of a sample.
- */
-typedef int64_t aom_codec_pts_t;
-
/*!\brief Compressed Frame Flags
*
* This type represents a bitfield containing information about a compressed
@@ -97,10 +90,14 @@ typedef uint32_t aom_codec_frame_flags_t;
/*!\brief frame can be dropped without affecting the stream (no future frame
* depends on this one) */
#define AOM_FRAME_IS_DROPPABLE 0x2
-/*!\brief frame should be decoded but will not be shown */
-#define AOM_FRAME_IS_INVISIBLE 0x4
-/*!\brief this is a fragment of the encoded frame */
-#define AOM_FRAME_IS_FRAGMENT 0x8
+/*!\brief this is an INTRA_ONLY frame */
+#define AOM_FRAME_IS_INTRAONLY 0x10
+/*!\brief this is an S-frame */
+#define AOM_FRAME_IS_SWITCH 0x20
+/*!\brief this is an error-resilient frame */
+#define AOM_FRAME_IS_ERROR_RESILIENT 0x40
+/*!\brief this is a key-frame dependent recovery-point frame */
+#define AOM_FRAME_IS_DELAYED_RANDOM_ACCESS_POINT 0x80
/*!\brief Error Resilient flags
*
@@ -205,6 +202,154 @@ enum aom_kf_mode {
AOM_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
};
+/*!\brief Encoder Config Options
+ *
+ * This type allows to enumerate and control flags defined for encoder control
+ * via config file at runtime.
+ */
+typedef struct cfg_options {
+ /*!\brief Indicate init by cfg file
+ * 0 or 1
+ */
+ unsigned int init_by_cfg_file;
+ /*!\brief Superblock size
+ * 0, 64 or 128
+ */
+ unsigned int super_block_size;
+ /*!\brief max partition size
+ * 8, 16, 32, 64, 128
+ */
+ unsigned int max_partition_size;
+ /*!\brief min partition size
+ * 8, 16, 32, 64, 128
+ */
+ unsigned int min_partition_size;
+ /*!\brief disable AB Shape partition type
+ *
+ */
+ unsigned int disable_ab_partition_type;
+ /*!\brief disable rectangular partition type
+ *
+ */
+ unsigned int disable_rect_partition_type;
+ /*!\brief disable 1:4/4:1 partition type
+ *
+ */
+ unsigned int disable_1to4_partition_type;
+ /*!\brief disable flip and identity transform type
+ *
+ */
+ unsigned int disable_flip_idtx;
+ /*!\brief disable CDEF filter
+ *
+ */
+ unsigned int disable_cdef;
+ /*!\brief disable Loop Restoration Filter
+ *
+ */
+ unsigned int disable_lr;
+ /*!\brief disable OBMC
+ *
+ */
+ unsigned int disable_obmc;
+ /*!\brief disable Warped Motion
+ *
+ */
+ unsigned int disable_warp_motion;
+ /*!\brief disable global motion
+ *
+ */
+ unsigned int disable_global_motion;
+ /*!\brief disable dist weighted compound
+ *
+ */
+ unsigned int disable_dist_wtd_comp;
+ /*!\brief disable diff weighted compound
+ *
+ */
+ unsigned int disable_diff_wtd_comp;
+ /*!\brief disable inter/intra compound
+ *
+ */
+ unsigned int disable_inter_intra_comp;
+ /*!\brief disable masked compound
+ *
+ */
+ unsigned int disable_masked_comp;
+ /*!\brief disable one sided compound
+ *
+ */
+ unsigned int disable_one_sided_comp;
+ /*!\brief disable Palette
+ *
+ */
+ unsigned int disable_palette;
+ /*!\brief disable Intra Block Copy
+ *
+ */
+ unsigned int disable_intrabc;
+ /*!\brief disable chroma from luma
+ *
+ */
+ unsigned int disable_cfl;
+ /*!\brief disable intra smooth mode
+ *
+ */
+ unsigned int disable_smooth_intra;
+ /*!\brief disable filter intra
+ *
+ */
+ unsigned int disable_filter_intra;
+ /*!\brief disable dual filter
+ *
+ */
+ unsigned int disable_dual_filter;
+ /*!\brief disable intra angle delta
+ *
+ */
+ unsigned int disable_intra_angle_delta;
+ /*!\brief disable intra edge filter
+ *
+ */
+ unsigned int disable_intra_edge_filter;
+ /*!\brief disable 64x64 transform
+ *
+ */
+ unsigned int disable_tx_64x64;
+ /*!\brief disable smooth inter/intra
+ *
+ */
+ unsigned int disable_smooth_inter_intra;
+ /*!\brief disable inter/inter wedge comp
+ *
+ */
+ unsigned int disable_inter_inter_wedge;
+ /*!\brief disable inter/intra wedge comp
+ *
+ */
+ unsigned int disable_inter_intra_wedge;
+ /*!\brief disable paeth intra
+ *
+ */
+ unsigned int disable_paeth_intra;
+ /*!\brief disable trellis quantization
+ *
+ */
+ unsigned int disable_trellis_quant;
+ /*!\brief disable ref frame MV
+ *
+ */
+ unsigned int disable_ref_frame_mv;
+ /*!\brief use reduced reference frame set
+ *
+ */
+ unsigned int reduced_reference_set;
+ /*!\brief use reduced transform type set
+ *
+ */
+ unsigned int reduced_tx_type_set;
+} cfg_options_t;
+
/*!\brief Encoded Frame Flags
*
* This type indicates a bitfield to be passed to aom_codec_encode(), defining
@@ -402,8 +547,7 @@ typedef struct aom_codec_enc_cfg {
* upscaling after the encode/decode process. Taking control of upscaling and
* using restoration filters should allow it to outperform normal resizing.
*
- * Mode 0 is SUPERRES_NONE, mode 1 is SUPERRES_FIXED, mode 2 is
- * SUPERRES_RANDOM and mode 3 is SUPERRES_QTHRESH.
+ * Valid values are 0 to 4 as defined in enum SUPERRES_MODE.
*/
unsigned int rc_superres_mode;
@@ -721,10 +865,46 @@ typedef struct aom_codec_enc_cfg {
*/
int tile_heights[MAX_TILE_HEIGHTS];
+ /*!\brief Whether encoder should use fixed QP offsets.
+ *
+ * If a value of 1 is provided, encoder will use fixed QP offsets for frames
+ * at different levels of the pyramid.
+ * - If 'fixed_qp_offsets' is also provided, encoder will use the given
+ * offsets
+ * - If not, encoder will select the fixed offsets based on the cq-level
+ * provided.
+ * If a value of 0 is provided and fixed_qp_offset are not provided, encoder
+ * will NOT use fixed QP offsets.
+ * Note: This option is only relevant for --end-usage=q.
+ */
+ unsigned int use_fixed_qp_offsets;
+
+/*!\brief Number of fixed QP offsets
+ *
+ * This defines the number of elements in the fixed_qp_offsets array.
+ */
+#define FIXED_QP_OFFSET_COUNT 5
+
+ /*!\brief Array of fixed QP offsets
+ *
+ * This array specifies fixed QP offsets (range: 0 to 63) for frames at
+ * different levels of the pyramid. It is a comma-separated list of 5 values:
+ * - QP offset for keyframe
+ * - QP offset for ALTREF frame
+ * - QP offset for 1st level internal ARF
+ * - QP offset for 2nd level internal ARF
+ * - QP offset for 3rd level internal ARF
+ * Notes:
+ * - QP offset for leaf level frames is not explicitly specified. These frames
+ * use the worst quality allowed (--cq-level).
+ * - This option is only relevant for --end-usage=q.
+ */
+ int fixed_qp_offsets[FIXED_QP_OFFSET_COUNT];
+
/*!\brief Options defined per config file
*
*/
- cfg_options_t cfg;
+ cfg_options_t encoder_cfg;
} aom_codec_enc_cfg_t; /**< alias for struct aom_codec_enc_cfg */
/*!\brief Initialize an encoder instance
@@ -761,41 +941,9 @@ aom_codec_err_t aom_codec_enc_init_ver(aom_codec_ctx_t *ctx,
#define aom_codec_enc_init(ctx, iface, cfg, flags) \
aom_codec_enc_init_ver(ctx, iface, cfg, flags, AOM_ENCODER_ABI_VERSION)
-/*!\brief Initialize multi-encoder instance
- *
- * Initializes multi-encoder context using the given interface.
- * Applications should call the aom_codec_enc_init_multi convenience macro
- * instead of this function directly, to ensure that the ABI version number
- * parameter is properly initialized.
- *
- * \param[in] ctx Pointer to this instance's context.
- * \param[in] iface Pointer to the algorithm interface to use.
- * \param[in] cfg Configuration to use, if known.
- * \param[in] num_enc Total number of encoders.
- * \param[in] flags Bitfield of AOM_CODEC_USE_* flags
- * \param[in] dsf Pointer to down-sampling factors.
- * \param[in] ver ABI version number. Must be set to
- * AOM_ENCODER_ABI_VERSION
- * \retval #AOM_CODEC_OK
- * The decoder algorithm initialized.
- * \retval #AOM_CODEC_MEM_ERROR
- * Memory allocation failed.
- */
-aom_codec_err_t aom_codec_enc_init_multi_ver(
- aom_codec_ctx_t *ctx, aom_codec_iface_t *iface, aom_codec_enc_cfg_t *cfg,
- int num_enc, aom_codec_flags_t flags, aom_rational_t *dsf, int ver);
-
-/*!\brief Convenience macro for aom_codec_enc_init_multi_ver()
- *
- * Ensures the ABI version parameter is properly set.
- */
-#define aom_codec_enc_init_multi(ctx, iface, cfg, num_enc, flags, dsf) \
- aom_codec_enc_init_multi_ver(ctx, iface, cfg, num_enc, flags, dsf, \
- AOM_ENCODER_ABI_VERSION)
-
-/*!\brief Get a default configuration
+/*!\brief Get the default configuration for a usage.
*
- * Initializes a encoder configuration structure with default values. Supports
+ * Initializes an encoder configuration structure with default values. Supports
* the notion of "usages" so that an algorithm may offer different default
* settings depending on the user's intended goal. This function \ref SHOULD
* be called by all applications to initialize the configuration structure
@@ -803,7 +951,9 @@ aom_codec_err_t aom_codec_enc_init_multi_ver(
*
* \param[in] iface Pointer to the algorithm interface to use.
* \param[out] cfg Configuration buffer to populate.
- * \param[in] reserved Must set to 0.
+ * \param[in] usage Algorithm specific usage value. For AV1, must be
+ * set to AOM_USAGE_GOOD_QUALITY (0) or
+ * AOM_USAGE_REALTIME (1).
*
* \retval #AOM_CODEC_OK
* The configuration was populated.
@@ -814,7 +964,7 @@ aom_codec_err_t aom_codec_enc_init_multi_ver(
*/
aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface,
aom_codec_enc_cfg_t *cfg,
- unsigned int reserved);
+ unsigned int usage);
/*!\brief Set or change configuration
*
@@ -858,6 +1008,11 @@ aom_codec_err_t aom_codec_enc_config_set(aom_codec_ctx_t *ctx,
*/
aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx);
+/*!\brief usage parameter analogous to AV1 GOOD QUALITY mode. */
+#define AOM_USAGE_GOOD_QUALITY (0)
+/*!\brief usage parameter analogous to AV1 REALTIME mode. */
+#define AOM_USAGE_REALTIME (1)
+
/*!\brief Encode a frame
*
* Encodes a video frame at the given "presentation time." The presentation
diff --git a/media/libaom/src/aom/aom_frame_buffer.h b/media/libaom/src/aom/aom_frame_buffer.h
index fba4322f85..a715645a7a 100644
--- a/media/libaom/src/aom/aom_frame_buffer.h
+++ b/media/libaom/src/aom/aom_frame_buffer.h
@@ -53,9 +53,9 @@ typedef struct aom_codec_frame_buffer {
* data. The callback is triggered when the decoder needs a frame buffer to
* decode a compressed image into. This function may be called more than once
* for every call to aom_codec_decode. The application may set fb->priv to
- * some data which will be passed back in the ximage and the release function
- * call. |fb| is guaranteed to not be NULL. On success the callback must
- * return 0. Any failure the callback must return a value less than 0.
+ * some data which will be passed back in the aom_image_t and the release
+ * function call. |fb| is guaranteed to not be NULL. On success the callback
+ * must return 0. Any failure the callback must return a value less than 0.
*
* \param[in] priv Callback's private data
* \param[in] new_size Size in bytes needed by the buffer
diff --git a/media/libaom/src/aom/aom_image.h b/media/libaom/src/aom/aom_image.h
index a960127f15..bb6973f9c3 100644
--- a/media/libaom/src/aom/aom_image.h
+++ b/media/libaom/src/aom/aom_image.h
@@ -30,11 +30,11 @@ extern "C" {
* types, removing or reassigning enums, adding/removing/rearranging
* fields to structures
*/
-#define AOM_IMAGE_ABI_VERSION (4) /**<\hideinitializer*/
+#define AOM_IMAGE_ABI_VERSION (9) /**<\hideinitializer*/
-#define AOM_IMG_FMT_PLANAR 0x100 /**< Image is a planar format. */
-#define AOM_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U in memory. */
-#define AOM_IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel. */
+#define AOM_IMG_FMT_PLANAR 0x100 /**< Image is a planar format. */
+#define AOM_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U in memory. */
+/** 0x400 used to signal alpha channel, skipping for backwards compatibility. */
#define AOM_IMG_FMT_HIGHBITDEPTH 0x800 /**< Image uses 16bit framebuffer. */
/*!\brief List of supported image formats */
@@ -48,8 +48,8 @@ typedef enum aom_img_fmt {
AOM_IMG_FMT_AOMI420 = AOM_IMG_FMT_PLANAR | 4,
AOM_IMG_FMT_I422 = AOM_IMG_FMT_PLANAR | 5,
AOM_IMG_FMT_I444 = AOM_IMG_FMT_PLANAR | 6,
- AOM_IMG_FMT_444A = AOM_IMG_FMT_PLANAR | AOM_IMG_FMT_HAS_ALPHA | 6,
AOM_IMG_FMT_I42016 = AOM_IMG_FMT_I420 | AOM_IMG_FMT_HIGHBITDEPTH,
+ AOM_IMG_FMT_YV1216 = AOM_IMG_FMT_YV12 | AOM_IMG_FMT_HIGHBITDEPTH,
AOM_IMG_FMT_I42216 = AOM_IMG_FMT_I422 | AOM_IMG_FMT_HIGHBITDEPTH,
AOM_IMG_FMT_I44416 = AOM_IMG_FMT_I444 | AOM_IMG_FMT_HIGHBITDEPTH,
} aom_img_fmt_t; /**< alias for enum aom_img_fmt */
@@ -137,6 +137,36 @@ typedef enum aom_chroma_sample_position {
AOM_CSP_RESERVED = 3 /**< Reserved value */
} aom_chroma_sample_position_t; /**< alias for enum aom_transfer_function */
+/*!\brief List of insert flags for Metadata
+ *
+ * These flags control how the library treats metadata during encode.
+ *
+ * While encoding, when metadata is added to an aom_image via
+ * aom_img_add_metadata(), the flag passed along with the metadata will
+ * determine where the metadata OBU will be placed in the encoded OBU stream.
+ * Metadata will be emitted into the output stream within the next temporal unit
+ * if it satisfies the specified insertion flag.
+ *
+ * During decoding, when the library encounters a metadata OBU, it is always
+ * flagged as AOM_MIF_ANY_FRAME and emitted with the next output aom_image.
+ */
+typedef enum aom_metadata_insert_flags {
+ AOM_MIF_NON_KEY_FRAME = 0, /**< Adds metadata if it's not keyframe */
+ AOM_MIF_KEY_FRAME = 1, /**< Adds metadata only if it's a keyframe */
+ AOM_MIF_ANY_FRAME = 2 /**< Adds metadata to any type of frame */
+} aom_metadata_insert_flags_t;
+
+/*!\brief Array of aom_metadata structs for an image. */
+typedef struct aom_metadata_array aom_metadata_array_t;
+
+/*!\brief Metadata payload. */
+typedef struct aom_metadata {
+ uint32_t type; /**< Metadata type */
+ uint8_t *payload; /**< Metadata payload data */
+ size_t sz; /**< Metadata payload size */
+ aom_metadata_insert_flags_t insert_flag; /**< Metadata insertion flag */
+} aom_metadata_t;
+
/**\brief Image Descriptor */
typedef struct aom_image {
aom_img_fmt_t fmt; /**< Image Format */
@@ -169,9 +199,8 @@ typedef struct aom_image {
#define AOM_PLANE_Y 0 /**< Y (Luminance) plane */
#define AOM_PLANE_U 1 /**< U (Chroma) plane */
#define AOM_PLANE_V 2 /**< V (Chroma) plane */
-#define AOM_PLANE_ALPHA 3 /**< A (Transparency) plane */
- unsigned char *planes[4]; /**< pointer to the top left pixel for each plane */
- int stride[4]; /**< stride between rows for each plane */
+ unsigned char *planes[3]; /**< pointer to the top left pixel for each plane */
+ int stride[3]; /**< stride between rows for each plane */
size_t sz; /**< data size */
int bps; /**< bits per sample (for packed formats) */
@@ -189,21 +218,16 @@ typedef struct aom_image {
int img_data_owner; /**< private */
int self_allocd; /**< private */
+ aom_metadata_array_t
+ *metadata; /**< Metadata payloads associated with the image. */
+
void *fb_priv; /**< Frame buffer data associated with the image. */
} aom_image_t; /**< alias for struct aom_image */
-/**\brief Representation of a rectangle on a surface */
-typedef struct aom_image_rect {
- unsigned int x; /**< leftmost column */
- unsigned int y; /**< topmost row */
- unsigned int w; /**< width */
- unsigned int h; /**< height */
-} aom_image_rect_t; /**< alias for struct aom_image_rect */
-
/*!\brief Open a descriptor, allocating storage for the underlying image
*
* Returns a descriptor for storing an image of the given format. The
- * storage for the descriptor is allocated on the heap.
+ * storage for the image is allocated on the heap.
*
* \param[in] img Pointer to storage for descriptor. If this parameter
* is NULL, the storage for the descriptor will be
@@ -212,7 +236,7 @@ typedef struct aom_image_rect {
* \param[in] d_w Width of the image
* \param[in] d_h Height of the image
* \param[in] align Alignment, in bytes, of the image buffer and
- * each row in the image(stride).
+ * each row in the image (stride).
*
* \return Returns a pointer to the initialized image descriptor. If the img
* parameter is non-null, the value of the img parameter will be
@@ -225,7 +249,7 @@ aom_image_t *aom_img_alloc(aom_image_t *img, aom_img_fmt_t fmt,
/*!\brief Open a descriptor, using existing storage for the underlying image
*
* Returns a descriptor for storing an image of the given format. The
- * storage for descriptor has been allocated elsewhere, and a descriptor is
+ * storage for the image has been allocated elsewhere, and a descriptor is
* desired to "wrap" that storage.
*
* \param[in] img Pointer to storage for descriptor. If this parameter
@@ -234,7 +258,8 @@ aom_image_t *aom_img_alloc(aom_image_t *img, aom_img_fmt_t fmt,
* \param[in] fmt Format for the image
* \param[in] d_w Width of the image
* \param[in] d_h Height of the image
- * \param[in] align Alignment, in bytes, of each row in the image.
+ * \param[in] align Alignment, in bytes, of each row in the image
+ * (stride).
* \param[in] img_data Storage to use for the image
*
* \return Returns a pointer to the initialized image descriptor. If the img
@@ -249,7 +274,7 @@ aom_image_t *aom_img_wrap(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w,
* border
*
* Returns a descriptor for storing an image of the given format and its
- * borders. The storage for the descriptor is allocated on the heap.
+ * borders. The storage for the image is allocated on the heap.
*
* \param[in] img Pointer to storage for descriptor. If this parameter
* is NULL, the storage for the descriptor will be
@@ -258,8 +283,8 @@ aom_image_t *aom_img_wrap(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w,
* \param[in] d_w Width of the image
* \param[in] d_h Height of the image
* \param[in] align Alignment, in bytes, of the image buffer and
- * each row in the image(stride).
- * \param[in] size_align Alignment, in bytes, of the image width and height.
+ * each row in the image (stride).
+ * \param[in] size_align Alignment, in pixels, of the image width and height.
* \param[in] border A border that is padded on four sides of the image.
*
* \return Returns a pointer to the initialized image descriptor. If the img
@@ -324,6 +349,80 @@ int aom_img_plane_width(const aom_image_t *img, int plane);
*/
int aom_img_plane_height(const aom_image_t *img, int plane);
+/*!\brief Add metadata to image.
+ *
+ * Adds metadata to aom_image_t.
+ * Function makes a copy of the provided data parameter.
+ * Metadata insertion point is controlled by insert_flag.
+ *
+ * \param[in] img Image descriptor
+ * \param[in] type Metadata type
+ * \param[in] data Metadata contents
+ * \param[in] sz Metadata contents size
+ * \param[in] insert_flag Metadata insert flag
+ */
+int aom_img_add_metadata(aom_image_t *img, uint32_t type, const uint8_t *data,
+ size_t sz, aom_metadata_insert_flags_t insert_flag);
+
+/*!\brief Return a metadata payload stored within the image metadata array.
+ *
+ * Gets the metadata (aom_metadata_t) at the indicated index in the image
+ * metadata array.
+ *
+ * \param[in] img Pointer to image descriptor to get metadata from
+ * \param[in] index Metadata index to get from metadata array
+ *
+ * \return Returns a const pointer to the selected metadata, if img and/or index
+ * is invalid, it returns NULL.
+ */
+const aom_metadata_t *aom_img_get_metadata(const aom_image_t *img,
+ size_t index);
+
+/*!\brief Return the number of metadata blocks within the image.
+ *
+ * Gets the number of metadata blocks contained within the provided image
+ * metadata array.
+ *
+ * \param[in] img Pointer to image descriptor to get metadata number
+ * from.
+ *
+ * \return Returns the size of the metadata array. If img or metadata is NULL,
+ * it returns 0.
+ */
+size_t aom_img_num_metadata(const aom_image_t *img);
+
+/*!\brief Remove metadata from image.
+ *
+ * Removes all metadata in image metadata list and sets metadata list pointer
+ * to NULL.
+ *
+ * \param[in] img Image descriptor
+ */
+void aom_img_remove_metadata(aom_image_t *img);
+
+/*!\brief Allocate memory for aom_metadata struct.
+ *
+ * Allocates storage for the metadata payload, sets its type and copies the
+ * payload data into the aom_metadata struct. A metadata payload buffer of size
+ * sz is allocated and sz bytes are copied from data into the payload buffer.
+ *
+ * \param[in] type Metadata type
+ * \param[in] data Metadata data pointer
+ * \param[in] sz Metadata size
+ * \param[in] insert_flag Metadata insert flag
+ */
+aom_metadata_t *aom_img_metadata_alloc(uint32_t type, const uint8_t *data,
+ size_t sz,
+ aom_metadata_insert_flags_t insert_flag);
+
+/*!\brief Free metadata struct.
+ *
+ * Free metadata struct and its buffer.
+ *
+ * \param[in] metadata Metadata struct pointer
+ */
+void aom_img_metadata_free(aom_metadata_t *metadata);
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/media/libaom/src/aom/aom_integer.h b/media/libaom/src/aom/aom_integer.h
index 90263bd4f2..113671e820 100644
--- a/media/libaom/src/aom/aom_integer.h
+++ b/media/libaom/src/aom/aom_integer.h
@@ -19,7 +19,6 @@
#define AOM_INLINE __inline
#else
#define AOM_FORCE_INLINE __inline__ __attribute__((always_inline))
-// TODO(jbb): Allow a way to force inline off for older compilers.
#define AOM_INLINE inline
#endif
@@ -72,8 +71,6 @@ typedef size_t uintptr_t;
#define INT32_MIN (-2147483647 - 1)
#endif
-#define NELEMENTS(x) (int)(sizeof(x) / sizeof(x[0]))
-
#if defined(__cplusplus)
extern "C" {
#endif // __cplusplus
diff --git a/media/libaom/src/aom/aomcx.h b/media/libaom/src/aom/aomcx.h
index 013ddf57e8..051d33e7bf 100644
--- a/media/libaom/src/aom/aomcx.h
+++ b/media/libaom/src/aom/aomcx.h
@@ -148,85 +148,114 @@ extern aom_codec_iface_t *aom_codec_av1_cx(void);
* This set of macros define the control functions available for AVx
* encoder interface.
*
- * \sa #aom_codec_control
+ * \sa #aom_codec_control(aom_codec_ctx_t *ctx, int ctrl_id, ...)
*/
enum aome_enc_control_id {
- /*!\brief Codec control function to set which reference frame encoder can use.
+ /*!\brief Codec control function to set which reference frame encoder can use,
+ * int parameter.
*/
AOME_USE_REFERENCE = 7,
- /*!\brief Codec control function to pass an ROI map to encoder.
+ /*!\brief Codec control function to pass an ROI map to encoder, aom_roi_map_t*
+ * parameter.
*/
AOME_SET_ROI_MAP = 8,
- /*!\brief Codec control function to pass an Active map to encoder.
+ /*!\brief Codec control function to pass an Active map to encoder,
+ * aom_active_map_t* parameter.
*/
- AOME_SET_ACTIVEMAP,
+ AOME_SET_ACTIVEMAP = 9,
- /*!\brief Codec control function to set encoder scaling mode.
+ /* NOTE: enum 10 unused */
+
+ /*!\brief Codec control function to set encoder scaling mode,
+ * aom_scaling_mode_t* parameter.
*/
AOME_SET_SCALEMODE = 11,
- /*!\brief Codec control function to set encoder spatial layer id.
+ /*!\brief Codec control function to set encoder spatial layer id, unsigned int
+ * parameter.
*/
AOME_SET_SPATIAL_LAYER_ID = 12,
- /*!\brief Codec control function to set encoder internal speed settings.
+ /*!\brief Codec control function to set encoder internal speed settings,
+ * int parameter
*
- * Changes in this value influences, among others, the encoder's selection
- * of motion estimation methods. Values greater than 0 will increase encoder
- * speed at the expense of quality.
+ * Changes in this value influences the complexity of algorithms used in
+ * encoding process, values greater than 0 will increase encoder speed at
+ * the expense of quality.
*
- * \note Valid range: 0..8
+ * Valid range: 0..8. 0 runs the slowest, and 8 runs the fastest;
+ * quality improves as speed decreases (since more compression
+ * possibilities are explored).
*/
AOME_SET_CPUUSED = 13,
- /*!\brief Codec control function to enable automatic set and use alf frames.
+ /*!\brief Codec control function to enable automatic set and use alf frames,
+ * unsigned int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AOME_SET_ENABLEAUTOALTREF,
+ AOME_SET_ENABLEAUTOALTREF = 14,
- /*!\brief Codec control function to set sharpness.
+ /* NOTE: enum 15 unused */
+
+ /*!\brief Codec control function to set sharpness, unsigned int parameter.
*/
- AOME_SET_SHARPNESS = AOME_SET_ENABLEAUTOALTREF + 2,
+ AOME_SET_SHARPNESS = AOME_SET_ENABLEAUTOALTREF + 2, // 16
- /*!\brief Codec control function to set the threshold for MBs treated static.
+ /*!\brief Codec control function to set the threshold for MBs treated static,
+ * unsigned int parameter
*/
- AOME_SET_STATIC_THRESHOLD,
+ AOME_SET_STATIC_THRESHOLD = 17,
+
+ /* NOTE: enum 18 unused */
- /*!\brief Codec control function to get last quantizer chosen by the encoder.
+ /*!\brief Codec control function to get last quantizer chosen by the encoder,
+ * int* parameter
*
* Return value uses internal quantizer scale defined by the codec.
*/
- AOME_GET_LAST_QUANTIZER = AOME_SET_STATIC_THRESHOLD + 2,
+ AOME_GET_LAST_QUANTIZER = AOME_SET_STATIC_THRESHOLD + 2, // 19
- /*!\brief Codec control function to get last quantizer chosen by the encoder.
+ /*!\brief Codec control function to get last quantizer chosen by the encoder,
+ * int* parameter
*
* Return value uses the 0..63 scale as used by the rc_*_quantizer config
* parameters.
*/
- AOME_GET_LAST_QUANTIZER_64,
+ AOME_GET_LAST_QUANTIZER_64 = 20,
- /*!\brief Codec control function to set the max no of frames to create arf.
+ /*!\brief Codec control function to set the max no of frames to create arf,
+ * unsigned int parameter
*/
- AOME_SET_ARNR_MAXFRAMES,
+ AOME_SET_ARNR_MAXFRAMES = 21,
- /*!\brief Codec control function to set the filter strength for the arf.
+ /*!\brief Codec control function to set the filter strength for the arf,
+ * unsigned int parameter
*/
- AOME_SET_ARNR_STRENGTH,
+ AOME_SET_ARNR_STRENGTH = 22,
- /*!\brief Codec control function to set visual tuning.
+ /* NOTE: enum 23 unused */
+
+ /*!\brief Codec control function to set visual tuning, aom_tune_metric (int)
+ * parameter
*/
- AOME_SET_TUNING = AOME_SET_ARNR_STRENGTH + 2,
+ AOME_SET_TUNING = AOME_SET_ARNR_STRENGTH + 2, // 24
- /*!\brief Codec control function to set constrained quality level.
+ /*!\brief Codec control function to set constrained / constant quality level,
+ * unsigned int parameter
+ *
+ * Valid range: 0..63
*
- * \attention For this value to be used aom_codec_enc_cfg_t::g_usage must be
- * set to #AOM_CQ.
- * \note Valid range: 0..63
+ * \attention For this value to be used aom_codec_enc_cfg_t::rc_end_usage
+ * must be set to #AOM_CQ or #AOM_Q.
*/
- AOME_SET_CQ_LEVEL,
+ AOME_SET_CQ_LEVEL = 25,
- /*!\brief Codec control function to set Max data rate for Intra frames.
+ /*!\brief Codec control function to set max data rate for intra frames,
+ * unsigned int parameter
*
* This value controls additional clamping on the maximum size of a
* keyframe. It is expressed as a percentage of the average
@@ -237,13 +266,15 @@ enum aome_enc_control_id {
* For example, to allocate no more than 4.5 frames worth of bitrate
* to a keyframe, set this to 450.
*/
- AOME_SET_MAX_INTRA_BITRATE_PCT,
+ AOME_SET_MAX_INTRA_BITRATE_PCT = 26,
- /*!\brief Codec control function to set number of spatial layers.
+ /*!\brief Codec control function to set number of spatial layers, int
+ * parameter
*/
- AOME_SET_NUMBER_SPATIAL_LAYERS,
+ AOME_SET_NUMBER_SPATIAL_LAYERS = 27,
- /*!\brief Codec control function to set max data rate for Inter frames.
+ /*!\brief Codec control function to set max data rate for inter frames,
+ * unsigned int parameter
*
* This value controls additional clamping on the maximum size of an
* inter frame. It is expressed as a percentage of the average
@@ -254,9 +285,10 @@ enum aome_enc_control_id {
* For example, to allow no more than 4.5 frames worth of bitrate
* to an inter frame, set this to 450.
*/
- AV1E_SET_MAX_INTER_BITRATE_PCT = AOME_SET_MAX_INTRA_BITRATE_PCT + 2,
+ AV1E_SET_MAX_INTER_BITRATE_PCT = AOME_SET_MAX_INTRA_BITRATE_PCT + 2, // 28
- /*!\brief Boost percentage for Golden Frame in CBR mode.
+ /*!\brief Boost percentage for Golden Frame in CBR mode, unsigned int
+ * parameter
*
* This value controls the amount of boost given to Golden Frame in
* CBR mode. It is expressed as a percentage of the average
@@ -267,64 +299,85 @@ enum aome_enc_control_id {
* For example, to allow 100% more bits, i.e, 2X, in a golden frame
* than average frame, set this to 100.
*/
- AV1E_SET_GF_CBR_BOOST_PCT,
+ AV1E_SET_GF_CBR_BOOST_PCT = 29,
+
+ /* NOTE: enum 30 unused */
- /*!\brief Codec control function to set lossless encoding mode.
+ /*!\brief Codec control function to set lossless encoding mode, unsigned int
+ * parameter
*
* AV1 can operate in lossless encoding mode, in which the bitstream
* produced will be able to decode and reconstruct a perfect copy of
- * input source. This control function provides a mean to switch encoder
- * into lossless coding mode(1) or normal coding mode(0) that may be lossy.
- * 0 = lossy coding mode
- * 1 = lossless coding mode
+ * input source.
*
- * By default, encoder operates in normal coding mode (maybe lossy).
+ * - 0 = normal coding mode, may be lossy (default)
+ * - 1 = lossless coding mode
*/
- AV1E_SET_LOSSLESS = AV1E_SET_GF_CBR_BOOST_PCT + 2,
+ AV1E_SET_LOSSLESS = AV1E_SET_GF_CBR_BOOST_PCT + 2, // 31
- /** control function to enable the row based multi-threading of encoder. A
- * value that is equal to 1 indicates that row based multi-threading is
- * enabled.
+ /*!\brief Codec control function to enable the row based multi-threading
+ * of the encoder, unsigned int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ROW_MT,
+ AV1E_SET_ROW_MT = 32,
- /*!\brief Codec control function to set number of tile columns.
+ /*!\brief Codec control function to set number of tile columns. unsigned int
+ * parameter
*
* In encoding and decoding, AV1 allows an input image frame be partitioned
* into separate vertical tile columns, which can be encoded or decoded
* independently. This enables easy implementation of parallel encoding and
* decoding. The parameter for this control describes the number of tile
* columns (in log2 units), which has a valid range of [0, 6]:
- * 0 = 1 tile column
- * 1 = 2 tile columns
- * 2 = 4 tile columns
- * .....
- * n = 2**n tile columns
- * The requested tile columns will be capped by encoder based on image size
- * limitation (The minimum width of a tile column is 256 pixel, the maximum
- * is 4096).
- *
+ * \verbatim
+ 0 = 1 tile column
+ 1 = 2 tile columns
+ 2 = 4 tile columns
+ .....
+ n = 2**n tile columns
+ \endverbatim
* By default, the value is 0, i.e. one single column tile for entire image.
*/
- AV1E_SET_TILE_COLUMNS,
+ AV1E_SET_TILE_COLUMNS = 33,
- /*!\brief Codec control function to set number of tile rows.
+ /*!\brief Codec control function to set number of tile rows, unsigned int
+ * parameter
*
* In encoding and decoding, AV1 allows an input image frame be partitioned
* into separate horizontal tile rows, which can be encoded or decoded
* independently. The parameter for this control describes the number of tile
* rows (in log2 units), which has a valid range of [0, 6]:
- * 0 = 1 tile row
- * 1 = 2 tile rows
- * 2 = 4 tile rows
- * .....
- * n = 2**n tile rows
- *
+ * \verbatim
+ 0 = 1 tile row
+ 1 = 2 tile rows
+ 2 = 4 tile rows
+ .....
+ n = 2**n tile rows
+ \endverbatim
* By default, the value is 0, i.e. one single row tile for entire image.
*/
- AV1E_SET_TILE_ROWS,
+ AV1E_SET_TILE_ROWS = 34,
+
+ /*!\brief Codec control function to enable RDO modulated by frame temporal
+ * dependency, unsigned int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_TPL_MODEL = 35,
+
+ /*!\brief Codec control function to enable temporal filtering on key frame,
+ * unsigned int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_KEYFRAME_FILTERING = 36,
- /*!\brief Codec control function to enable frame parallel decoding feature.
+ /*!\brief Codec control function to enable frame parallel decoding feature,
+ * unsigned int parameter
*
* AV1 has a bitstream feature to reduce decoding dependency between frames
* by turning off backward update of probability context used in encoding
@@ -332,271 +385,301 @@ enum aome_enc_control_id {
* video frames in the decoder. This control function provides a mean to
* turn this feature on or off for bitstreams produced by encoder.
*
- * By default, this feature is off.
+ * - 0 = disable (default)
+ * - 1 = enable
*/
- AV1E_SET_FRAME_PARALLEL_DECODING,
+ AV1E_SET_FRAME_PARALLEL_DECODING = 37,
- /*!\brief Codec control function to enable error_resilient_mode
+ /*!\brief Codec control function to enable error_resilient_mode, int parameter
*
* AV1 has a bitstream feature to guarantee parseability of a frame
* by turning on the error_resilient_decoding mode, even though the
* reference buffers are unreliable or not received.
*
- * By default, this feature is off.
+ * - 0 = disable (default)
+ * - 1 = enable
*/
- AV1E_SET_ERROR_RESILIENT_MODE,
+ AV1E_SET_ERROR_RESILIENT_MODE = 38,
- /*!\brief Codec control function to enable s_frame_mode
+ /*!\brief Codec control function to enable s_frame_mode, int parameter
*
* AV1 has a bitstream feature to designate certain frames as S-frames,
* from where we can switch to a different stream,
* even though the reference buffers may not be exactly identical.
*
- * By default, this feature is off.
+ * - 0 = disable (default)
+ * - 1 = enable
*/
- AV1E_SET_S_FRAME_MODE,
+ AV1E_SET_S_FRAME_MODE = 39,
- /*!\brief Codec control function to set adaptive quantization mode.
+ /*!\brief Codec control function to set adaptive quantization mode, unsigned
+ * int parameter
*
* AV1 has a segment based feature that allows encoder to adaptively change
* quantization parameter for each segment within a frame to improve the
* subjective quality. This control makes encoder operate in one of the
* several AQ_modes supported.
*
- * By default, encoder operates with AQ_Mode 0(adaptive quantization off).
+ * - 0 = disable (default)
+ * - 1 = enable
*/
- AV1E_SET_AQ_MODE,
+ AV1E_SET_AQ_MODE = 40,
- /*!\brief Codec control function to enable/disable periodic Q boost.
+ /*!\brief Codec control function to enable/disable periodic Q boost, unsigned
+ * int parameter
*
* One AV1 encoder speed feature is to enable quality boost by lowering
* frame level Q periodically. This control function provides a mean to
* turn on/off this feature.
- * 0 = off
- * 1 = on
- *
- * By default, the encoder is allowed to use this feature for appropriate
- * encoding modes.
- */
- AV1E_SET_FRAME_PERIODIC_BOOST,
-
- /*!\brief Codec control function to set noise sensitivity.
- *
- * 0: off, 1: On(YOnly)
- */
- AV1E_SET_NOISE_SENSITIVITY,
-
- /*!\brief Codec control function to set content type.
- * \note Valid parameter range:
- * AOM_CONTENT_DEFAULT = Regular video content (Default)
- * AOM_CONTENT_SCREEN = Screen capture content
- */
- AV1E_SET_TUNE_CONTENT,
-
- /*!\brief Codec control function to set CDF update mode.
- *
- * 0: no update 1: update on every frame
- * 2: selectively update
- */
- AV1E_SET_CDF_UPDATE_MODE,
-
- /*!\brief Codec control function to set color space info.
- * \note Valid ranges: 0..23, default is "Unspecified".
- * 0 = For future use
- * 1 = BT.709
- * 2 = Unspecified
- * 3 = For future use
- * 4 = BT.470 System M (historical)
- * 5 = BT.470 System B, G (historical)
- * 6 = BT.601
- * 7 = SMPTE 240
- * 8 = Generic film (color filters using illuminant C)
- * 9 = BT.2020, BT.2100
- * 10 = SMPTE 428 (CIE 1921 XYZ)
- * 11 = SMPTE RP 431-2
- * 12 = SMPTE EG 432-1
- * 13 = For future use (values 13 - 21)
- * 22 = EBU Tech. 3213-E
- * 23 = For future use
- *
- */
- AV1E_SET_COLOR_PRIMARIES,
-
- /*!\brief Codec control function to set transfer function info.
- * \note Valid ranges: 0..19, default is "Unspecified".
- * 0 = For future use
- * 1 = BT.709
- * 2 = Unspecified
- * 3 = For future use
- * 4 = BT.470 System M (historical)
- * 5 = BT.470 System B, G (historical)
- * 6 = BT.601
- * 7 = SMPTE 240 M
- * 8 = Linear
- * 9 = Logarithmic (100 : 1 range)
- * 10 = Logarithmic (100 * Sqrt(10) : 1 range)
- * 11 = IEC 61966-2-4
- * 12 = BT.1361
- * 13 = sRGB or sYCC
- * 14 = BT.2020 10-bit systems
- * 15 = BT.2020 12-bit systems
- * 16 = SMPTE ST 2084, ITU BT.2100 PQ
- * 17 = SMPTE ST 428
- * 18 = BT.2100 HLG, ARIB STD-B67
- * 19 = For future use
- *
- */
- AV1E_SET_TRANSFER_CHARACTERISTICS,
-
- /*!\brief Codec control function to set transfer function info.
- * \note Valid ranges: 0..15, default is "Unspecified".
- * 0 = Identity matrix
- * 1 = BT.709
- * 2 = Unspecified
- * 3 = For future use
- * 4 = US FCC 73.628
- * 5 = BT.470 System B, G (historical)
- * 6 = BT.601
- * 7 = SMPTE 240 M
- * 8 = YCgCo
- * 9 = BT.2020 non-constant luminance, BT.2100 YCbCr
- * 10 = BT.2020 constant luminance
- * 11 = SMPTE ST 2085 YDzDx
- * 12 = Chromaticity-derived non-constant luminance
- * 13 = Chromaticity-derived constant luminance
- * 14 = BT.2100 ICtCp
- * 15 = For future use
- *
- */
- AV1E_SET_MATRIX_COEFFICIENTS,
-
- /*!\brief Codec control function to set chroma 4:2:0 sample position info.
- * \note Valid ranges: 0..3, default is "UNKNOWN".
- * 0 = UNKNOWN,
- * 1 = VERTICAL
- * 2 = COLOCATED
- * 3 = RESERVED
- */
- AV1E_SET_CHROMA_SAMPLE_POSITION,
-
- /*!\brief Codec control function to set minimum interval between GF/ARF frames
+ *
+ * - 0 = disable (default)
+ * - 1 = enable
+ */
+ AV1E_SET_FRAME_PERIODIC_BOOST = 41,
+
+ /*!\brief Codec control function to set noise sensitivity, unsigned int
+ * parameter
+ *
+ * - 0 = disable (default)
+ * - 1 = enable (Y only)
+ */
+ AV1E_SET_NOISE_SENSITIVITY = 42,
+
+ /*!\brief Codec control function to set content type, aom_tune_content
+ * parameter
+ *
+ * - AOM_CONTENT_DEFAULT = Regular video content (default)
+ * - AOM_CONTENT_SCREEN = Screen capture content
+ */
+ AV1E_SET_TUNE_CONTENT = 43,
+
+ /*!\brief Codec control function to set CDF update mode, unsigned int
+ * parameter
+ *
+ * - 0: no update
+ * - 1: update on every frame (default)
+ * - 2: selectively update
+ */
+ AV1E_SET_CDF_UPDATE_MODE = 44,
+
+ /*!\brief Codec control function to set color space info, int parameter
+ *
+ * - 0 = For future use
+ * - 1 = BT.709
+ * - 2 = Unspecified (default)
+ * - 3 = For future use
+ * - 4 = BT.470 System M (historical)
+ * - 5 = BT.470 System B, G (historical)
+ * - 6 = BT.601
+ * - 7 = SMPTE 240
+ * - 8 = Generic film (color filters using illuminant C)
+ * - 9 = BT.2020, BT.2100
+ * - 10 = SMPTE 428 (CIE 1921 XYZ)
+ * - 11 = SMPTE RP 431-2
+ * - 12 = SMPTE EG 432-1
+ * - 13..21 = For future use
+ * - 22 = EBU Tech. 3213-E
+ * - 23 = For future use
+ */
+ AV1E_SET_COLOR_PRIMARIES = 45,
+
+ /*!\brief Codec control function to set transfer function info, int parameter
+ *
+ * - 0 = For future use
+ * - 1 = BT.709
+ * - 2 = Unspecified (default)
+ * - 3 = For future use
+ * - 4 = BT.470 System M (historical)
+ * - 5 = BT.470 System B, G (historical)
+ * - 6 = BT.601
+ * - 7 = SMPTE 240 M
+ * - 8 = Linear
+ * - 9 = Logarithmic (100 : 1 range)
+ * - 10 = Logarithmic (100 * Sqrt(10) : 1 range)
+ * - 11 = IEC 61966-2-4
+ * - 12 = BT.1361
+ * - 13 = sRGB or sYCC
+ * - 14 = BT.2020 10-bit systems
+ * - 15 = BT.2020 12-bit systems
+ * - 16 = SMPTE ST 2084, ITU BT.2100 PQ
+ * - 17 = SMPTE ST 428
+ * - 18 = BT.2100 HLG, ARIB STD-B67
+ * - 19 = For future use
+ */
+ AV1E_SET_TRANSFER_CHARACTERISTICS = 46,
+
+ /*!\brief Codec control function to set transfer function info, int parameter
+ *
+ * - 0 = Identity matrix
+ * - 1 = BT.709
+ * - 2 = Unspecified (default)
+ * - 3 = For future use
+ * - 4 = US FCC 73.628
+ * - 5 = BT.470 System B, G (historical)
+ * - 6 = BT.601
+ * - 7 = SMPTE 240 M
+ * - 8 = YCgCo
+ * - 9 = BT.2020 non-constant luminance, BT.2100 YCbCr
+ * - 10 = BT.2020 constant luminance
+ * - 11 = SMPTE ST 2085 YDzDx
+ * - 12 = Chromaticity-derived non-constant luminance
+ * - 13 = Chromaticity-derived constant luminance
+ * - 14 = BT.2100 ICtCp
+ * - 15 = For future use
+ */
+ AV1E_SET_MATRIX_COEFFICIENTS = 47,
+
+ /*!\brief Codec control function to set chroma 4:2:0 sample position info,
+ * aom_chroma_sample_position_t parameter
+ *
+ * AOM_CSP_UNKNOWN is default
+ */
+ AV1E_SET_CHROMA_SAMPLE_POSITION = 48,
+
+ /*!\brief Codec control function to set minimum interval between GF/ARF
+ * frames, unsigned int parameter
*
* By default the value is set as 4.
*/
- AV1E_SET_MIN_GF_INTERVAL,
+ AV1E_SET_MIN_GF_INTERVAL = 49,
- /*!\brief Codec control function to set minimum interval between GF/ARF frames
+ /*!\brief Codec control function to set minimum interval between GF/ARF
+ * frames, unsigned int parameter
*
* By default the value is set as 16.
*/
- AV1E_SET_MAX_GF_INTERVAL,
+ AV1E_SET_MAX_GF_INTERVAL = 50,
- /*!\brief Codec control function to get an Active map back from the encoder.
+ /*!\brief Codec control function to get an active map back from the encoder,
+ aom_active_map_t* parameter
*/
- AV1E_GET_ACTIVEMAP,
+ AV1E_GET_ACTIVEMAP = 51,
- /*!\brief Codec control function to set color range bit.
- * \note Valid ranges: 0..1, default is 0
- * 0 = Limited range (16..235 or HBD equivalent)
- * 1 = Full range (0..255 or HBD equivalent)
+ /*!\brief Codec control function to set color range bit, int parameter
+ *
+ * - 0 = Limited range, 16..235 or HBD equivalent (default)
+ * - 1 = Full range, 0..255 or HBD equivalent
*/
- AV1E_SET_COLOR_RANGE,
+ AV1E_SET_COLOR_RANGE = 52,
- /*!\brief Codec control function to set intended rendering image size.
+ /*!\brief Codec control function to set intended rendering image size,
+ * int32_t[2] parameter
*
* By default, this is identical to the image size in pixels.
*/
- AV1E_SET_RENDER_SIZE,
+ AV1E_SET_RENDER_SIZE = 53,
- /*!\brief Codec control function to set target level.
+ /*!\brief Control to set target sequence level index for a certain operating
+ * point(OP), int parameter
+ * Possible values are in the form of "ABxy"(pad leading zeros if less than
+ * 4 digits).
+ * - AB: OP index.
+ * - xy: Target level index for the OP. Can be values 0~23(corresponding to
+ * level 2.0 ~ 7.3) or 24(keep level stats only for level monitoring) or
+ * 31(maximum level parameter, no level-based constraints).
*
- * 255: off (default); 0: only keep level stats; 10: target for level 1.0;
- * 11: target for level 1.1; ... 62: target for level 6.2
+ * E.g.:
+ * - "0" means target level index 0 for the 0th OP;
+ * - "111" means target level index 11 for the 1st OP;
+ * - "1021" means target level index 21 for the 10th OP.
+ *
+ * If the target level is not specified for an OP, the maximum level parameter
+ * of 31 is used as default.
*/
- AV1E_SET_TARGET_LEVEL,
+ AV1E_SET_TARGET_SEQ_LEVEL_IDX = 54,
- /*!\brief Codec control function to get bitstream level.
+ /*!\brief Codec control function to get sequence level index for each
+ * operating point. int* parameter. There can be at most 32 operating points.
+ * The results will be written into a provided integer array of sufficient
+ * size.
*/
- AV1E_GET_LEVEL,
+ AV1E_GET_SEQ_LEVEL_IDX = 55,
- /*!\brief Codec control function to set intended superblock size.
+ /*!\brief Codec control function to set intended superblock size, unsigned int
+ * parameter
*
* By default, the superblock size is determined separately for each
* frame by the encoder.
- *
- * Experiment: EXT_PARTITION
*/
- AV1E_SET_SUPERBLOCK_SIZE,
+ AV1E_SET_SUPERBLOCK_SIZE = 56,
- /*!\brief Codec control function to enable automatic set and use
- * bwd-pred frames.
+ /*!\brief Codec control function to enable automatic set and use of
+ * bwd-pred frames, unsigned int parameter
*
+ * - 0 = disable (default)
+ * - 1 = enable
*/
- AOME_SET_ENABLEAUTOBWDREF,
+ AOME_SET_ENABLEAUTOBWDREF = 57,
- /*!\brief Codec control function to encode with CDEF.
+ /*!\brief Codec control function to encode with CDEF, unsigned int parameter
*
* CDEF is the constrained directional enhancement filter which is an
* in-loop filter aiming to remove coding artifacts
- * 0 = do not apply CDEF
- * 1 = apply CDEF
- *
- * By default, the encoder applies CDEF.
*
- * Experiment: AOM_CDEF
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ENABLE_CDEF,
+ AV1E_SET_ENABLE_CDEF = 58,
- /*!\brief Codec control function to encode with Loop Restoration Filter.
- *
- * 0 = do not apply Restoration Filter
- * 1 = apply Restoration Filter
- *
- * By default, the encoder applies Restoration Filter.
+ /*!\brief Codec control function to encode with Loop Restoration Filter,
+ * unsigned int parameter
*
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ENABLE_RESTORATION,
+ AV1E_SET_ENABLE_RESTORATION = 59,
- /*!\brief Codec control function to encode without trellis quantization.
+ /*!\brief Codec control function to force video mode, unsigned int parameter
*
- * 0 = apply trellis quantization
- * 1 = do not apply trellis quantization
+ * - 0 = do not force video mode (default)
+ * - 1 = force video mode even for a single frame
+ */
+ AV1E_SET_FORCE_VIDEO_MODE = 60,
+
+ /*!\brief Codec control function to predict with OBMC mode, unsigned int
+ * parameter
*
- * By default, the encoder applies trellis optimization on quantized
- * coefficients.
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_OBMC = 61,
+
+ /*!\brief Codec control function to encode without trellis quantization,
+ * unsigned int parameter
*
+ * - 0 = apply trellis quantization (default)
+ * - 1 = do not apply trellis quantization
+ * - 2 = disable trellis quantization in rd search
+ * - 3 = disable trellis quantization in estimate yrd
*/
- AV1E_SET_DISABLE_TRELLIS_QUANT,
+ AV1E_SET_DISABLE_TRELLIS_QUANT = 62,
- /*!\brief Codec control function to encode with quantisation matrices.
+ /*!\brief Codec control function to encode with quantisation matrices,
+ * unsigned int parameter
*
* AOM can operate with default quantisation matrices dependent on
* quantisation level and block type.
- * 0 = do not use quantisation matrices
- * 1 = use quantisation matrices
- *
- * By default, the encoder operates without quantisation matrices.
*
- * Experiment: AOM_QM
+ * - 0 = disable (default)
+ * - 1 = enable
*/
+ AV1E_SET_ENABLE_QM = 63,
- AV1E_SET_ENABLE_QM,
-
- /*!\brief Codec control function to set the min quant matrix flatness.
+ /*!\brief Codec control function to set the min quant matrix flatness,
+ * unsigned int parameter
*
* AOM can operate with different ranges of quantisation matrices.
* As quantisation levels increase, the matrices get flatter. This
* control sets the minimum level of flatness from which the matrices
* are determined.
*
- * By default, the encoder sets this minimum at half the available
- * range.
- *
- * Experiment: AOM_QM
+ * By default, the encoder sets this minimum at half the available
+ * range.
*/
- AV1E_SET_QM_MIN,
+ AV1E_SET_QM_MIN = 64,
- /*!\brief Codec control function to set the max quant matrix flatness.
+ /*!\brief Codec control function to set the max quant matrix flatness,
+ * unsigned int parameter
*
* AOM can operate with different ranges of quantisation matrices.
* As quantisation levels increase, the matrices get flatter. This
@@ -604,267 +687,575 @@ enum aome_enc_control_id {
*
* By default, the encoder sets this maximum at the top of the
* available range.
- *
- * Experiment: AOM_QM
*/
- AV1E_SET_QM_MAX,
+ AV1E_SET_QM_MAX = 65,
- /*!\brief Codec control function to set the min quant matrix flatness.
+ /*!\brief Codec control function to set the min quant matrix flatness,
+ * unsigned int parameter
*
* AOM can operate with different ranges of quantisation matrices.
* As quantisation levels increase, the matrices get flatter. This
* control sets the flatness for luma (Y).
*
- * By default, the encoder sets this minimum at half the available
- * range.
- *
- * Experiment: AOM_QM
+ * By default, the encoder sets this minimum at half the available
+ * range.
*/
- AV1E_SET_QM_Y,
+ AV1E_SET_QM_Y = 66,
- /*!\brief Codec control function to set the min quant matrix flatness.
+ /*!\brief Codec control function to set the min quant matrix flatness,
+ * unsigned int parameter
*
* AOM can operate with different ranges of quantisation matrices.
* As quantisation levels increase, the matrices get flatter. This
* control sets the flatness for chroma (U).
*
- * By default, the encoder sets this minimum at half the available
- * range.
- *
- * Experiment: AOM_QM
+ * By default, the encoder sets this minimum at half the available
+ * range.
*/
- AV1E_SET_QM_U,
+ AV1E_SET_QM_U = 67,
- /*!\brief Codec control function to set the min quant matrix flatness.
+ /*!\brief Codec control function to set the min quant matrix flatness,
+ * unsigned int parameter
*
* AOM can operate with different ranges of quantisation matrices.
* As quantisation levels increase, the matrices get flatter. This
* control sets the flatness for chrome (V).
*
- * By default, the encoder sets this minimum at half the available
- * range.
- *
- * Experiment: AOM_QM
+ * By default, the encoder sets this minimum at half the available
+ * range.
*/
- AV1E_SET_QM_V,
+ AV1E_SET_QM_V = 68,
- /*!\brief Codec control function to encode with dist_8x8.
- *
- * The dist_8x8 is enabled automatically for model tuning parameters that
- * require measuring distortion at the 8x8 level. This control also allows
- * measuring distortion at the 8x8 level for other tuning options
- * (e.g., PSNR), for testing purposes.
- * 0 = do not use dist_8x8
- * 1 = use dist_8x8
- *
- * By default, the encoder does not use dist_8x8
- *
- * Experiment: DIST_8X8
- */
- AV1E_SET_ENABLE_DIST_8X8,
+ /* NOTE: enum 69 unused */
- /*!\brief Codec control function to set a maximum number of tile groups.
+ /*!\brief Codec control function to set a maximum number of tile groups,
+ * unsigned int parameter
*
* This will set the maximum number of tile groups. This will be
* overridden if an MTU size is set. The default value is 1.
- *
- * Experiment: TILE_GROUPS
*/
- AV1E_SET_NUM_TG,
+ AV1E_SET_NUM_TG = 70,
- /*!\brief Codec control function to set an MTU size for a tile group.
+ /*!\brief Codec control function to set an MTU size for a tile group, unsigned
+ * int parameter
*
* This will set the maximum number of bytes in a tile group. This can be
* exceeded only if a single tile is larger than this amount.
*
* By default, the value is 0, in which case a fixed number of tile groups
* is used.
- *
- * Experiment: TILE_GROUPS
*/
- AV1E_SET_MTU,
+ AV1E_SET_MTU = 71,
+
+ /* NOTE: enum 72 unused */
- /*!\brief Codec control function to set dependent_horz_tiles.
+ /*!\brief Codec control function to enable/disable rectangular partitions, int
+ * parameter
*
- * In encoding and decoding, AV1 allows enabling dependent horizontal tile
- * The parameter for this control describes the value of this flag,
- * which has a valid range [0, 1]:
- * 0 = disable dependent horizontal tile
- * 1 = enable dependent horizontal tile,
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_RECT_PARTITIONS = 73,
+
+ /*!\brief Codec control function to enable/disable AB partitions, int
+ * parameter
*
- * By default, the value is 0, i.e. disable dependent horizontal tile.
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_TILE_DEPENDENT_ROWS,
+ AV1E_SET_ENABLE_AB_PARTITIONS = 74,
- /*!\brief Codec control function to set the number of symbols in an ANS data
- * window.
+ /*!\brief Codec control function to enable/disable 1:4 and 4:1 partitions, int
+ * parameter
*
- * The number of ANS symbols (both boolean and non-booleans alphabets) in an
- * ANS data window is set to 1 << value.
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_1TO4_PARTITIONS = 75,
+
+ /*!\brief Codec control function to set min partition size, int parameter
*
- * \note Valid range: [8, 23]
+ * min_partition_size is applied to both width and height of the partition.
+ * i.e, both width and height of a partition can not be smaller than
+ * the min_partition_size, except the partition at the picture boundary.
*
- * Experiment: ANS
+ * Valid values: [4, 8, 16, 32, 64, 128]. The default value is 4 for
+ * 4x4.
*/
- AV1E_SET_ANS_WINDOW_SIZE_LOG2,
+ AV1E_SET_MIN_PARTITION_SIZE = 76,
- /*!\brief Codec control function to turn on / off dual filter
- * enabling/disabling.
+ /*!\brief Codec control function to set max partition size, int parameter
*
- * This will enable or disable dual filter. The default value is 1
+ * max_partition_size is applied to both width and height of the partition.
+ * i.e, both width and height of a partition can not be larger than
+ * the max_partition_size.
*
+ * Valid values:[4, 8, 16, 32, 64, 128] The default value is 128 for
+ * 128x128.
*/
- AV1E_SET_ENABLE_DF,
+ AV1E_SET_MAX_PARTITION_SIZE = 77,
- /*!\brief Codec control function to turn on / off frame order hint for a
- * few tools:
+ /*!\brief Codec control function to turn on / off intra edge filter
+ * at sequence level, int parameter
*
- * joint compound mode
- * motion field motion vector
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_INTRA_EDGE_FILTER = 78,
+
+ /*!\brief Codec control function to turn on / off frame order hint (int
+ * parameter). Affects: joint compound mode, motion field motion vector,
* ref frame sign bias
*
- * The default value is 1.
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_ORDER_HINT = 79,
+
+ /*!\brief Codec control function to turn on / off 64-length transforms, int
+ * parameter
+ *
+ * This will enable or disable usage of length 64 transforms in any
+ * direction.
*
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ENABLE_ORDER_HINT,
+ AV1E_SET_ENABLE_TX64 = 80,
- /*!\brief Codec control function to turn on / off joint compound mode
- * at sequence level.
+ /*!\brief Codec control function to turn on / off flip and identity
+ * transforms, int parameter
*
- * This will enable or disable joint compound mode. The default value is 1.
- * If AV1E_SET_ENABLE_ORDER_HINT is 0, then this flag is forced to 0.
+ * This will enable or disable usage of flip and identity transform
+ * types in any direction. If enabled, this includes:
+ * - FLIPADST_DCT
+ * - DCT_FLIPADST
+ * - FLIPADST_FLIPADST
+ * - ADST_FLIPADST
+ * - FLIPADST_ADST
+ * - IDTX
+ * - V_DCT
+ * - H_DCT
+ * - V_ADST
+ * - H_ADST
+ * - V_FLIPADST
+ * - H_FLIPADST
*
+ * Valid values:
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ENABLE_JNT_COMP,
+ AV1E_SET_ENABLE_FLIP_IDTX = 81,
+
+ /* Note: enum value 82 unused */
+
+ /*!\brief Codec control function to turn on / off dist-wtd compound mode
+ * at sequence level, int parameter
+ *
+ * This will enable or disable distance-weighted compound mode.
+ * \attention If AV1E_SET_ENABLE_ORDER_HINT is 0, then this flag is forced
+ * to 0.
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_DIST_WTD_COMP = 83,
/*!\brief Codec control function to turn on / off ref frame mvs (mfmv) usage
- * at sequence level.
+ * at sequence level, int parameter
*
- * This will enable or disable usage of MFMV. The default value is 1.
- * If AV1E_SET_ENABLE_ORDER_HINT is 0, then this flag is forced to 0.
+ * \attention If AV1E_SET_ENABLE_ORDER_HINT is 0, then this flag is forced
+ * to 0.
*
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ENABLE_REF_FRAME_MVS,
+ AV1E_SET_ENABLE_REF_FRAME_MVS = 84,
/*!\brief Codec control function to set temporal mv prediction
- * enabling/disabling at frame level.
+ * enabling/disabling at frame level, int parameter
*
- * This will enable or disable temporal mv predicton. The default value is 1.
- * If AV1E_SET_ENABLE_REF_FRAME_MVS is 0, then this flag is forced to 0.
+ * \attention If AV1E_SET_ENABLE_REF_FRAME_MVS is 0, then this flag is
+ * forced to 0.
*
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ALLOW_REF_FRAME_MVS,
+ AV1E_SET_ALLOW_REF_FRAME_MVS = 85,
- /*!\brief Codec control function to turn on / off warped motion usage
- * at sequence level.
+ /*!\brief Codec control function to turn on / off dual interpolation filter
+ * for a sequence, int parameter
*
- * This will enable or disable usage of warped motion. The default value is 1.
+ * - 0 = disable
+ * - 1 = enable
+ */
+ AV1E_SET_ENABLE_DUAL_FILTER = 86,
+
+ /*!\brief Codec control function to turn on / off delta quantization in chroma
+ * planes usage for a sequence, int parameter
+ *
+ * - 0 = disable (default)
+ * - 1 = enable
+ */
+ AV1E_SET_ENABLE_CHROMA_DELTAQ = 87,
+
+ /*!\brief Codec control function to turn on / off masked compound usage
+ * (wedge and diff-wtd compound modes) for a sequence, int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_MASKED_COMP = 88,
+
+ /*!\brief Codec control function to turn on / off one sided compound usage
+ * for a sequence, int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_ONESIDED_COMP = 89,
+
+ /*!\brief Codec control function to turn on / off interintra compound
+ * for a sequence, int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_INTERINTRA_COMP = 90,
+
+ /*!\brief Codec control function to turn on / off smooth inter-intra
+ * mode for a sequence, int parameter
*
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ENABLE_WARPED_MOTION,
+ AV1E_SET_ENABLE_SMOOTH_INTERINTRA = 91,
+
+ /*!\brief Codec control function to turn on / off difference weighted
+ * compound, int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_DIFF_WTD_COMP = 92,
+
+ /*!\brief Codec control function to turn on / off interinter wedge
+ * compound, int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_INTERINTER_WEDGE = 93,
+
+ /*!\brief Codec control function to turn on / off interintra wedge
+ * compound, int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_INTERINTRA_WEDGE = 94,
+
+ /*!\brief Codec control function to turn on / off global motion usage
+ * for a sequence, int parameter
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_GLOBAL_MOTION = 95,
/*!\brief Codec control function to turn on / off warped motion usage
- * at frame level.
+ * at sequence level, int parameter
*
- * This will enable or disable usage of warped motion. The default value is 1.
- * If AV1E_SET_ENABLE_WARPED_MOTION is 0, then this flag is forced to 0.
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_WARPED_MOTION = 96,
+
+ /*!\brief Codec control function to turn on / off warped motion usage
+ * at frame level, int parameter
+ *
+ * \attention If AV1E_SET_ENABLE_WARPED_MOTION is 0, then this flag is
+ * forced to 0.
*
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ALLOW_WARPED_MOTION,
+ AV1E_SET_ALLOW_WARPED_MOTION = 97,
- /*!\brief Codec control function to turn on / off frame superresolution.
+ /*!\brief Codec control function to turn on / off filter intra usage at
+ * sequence level, int parameter
*
- * This will enable or disable frame superresolution. The default value is 1
- * If AV1E_SET_ENABLE_SUPERRES is 0, then this flag is forced to 0.
+ * \attention If AV1E_SET_ENABLE_FILTER_INTRA is 0, then this flag is
+ * forced to 0.
+ *
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_ENABLE_SUPERRES,
+ AV1E_SET_ENABLE_FILTER_INTRA = 98,
- /*!\brief Codec control function to set loop_filter_across_tiles_v_enabled
- * and loop_filter_across_tiles_h_enabled.
- * In encoding and decoding, AV1 allows disabling loop filter across tile
- * boundary The parameter for this control describes the value of this flag,
- * which has a valid range [0, 1]:
- * 0 = disable loop filter across tile boundary
- * 1 = enable loop filter across tile boundary
+ /*!\brief Codec control function to turn on / off smooth intra modes usage,
+ * int parameter
*
- * By default, the value is 1, i.e. enable loop filter across tile boundary.
+ * This will enable or disable usage of smooth, smooth_h and smooth_v intra
+ * modes.
*
- * Experiment: LOOPFILTERING_ACROSS_TILES_EXT
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_TILE_LOOPFILTER_V,
- AV1E_SET_TILE_LOOPFILTER_H,
+ AV1E_SET_ENABLE_SMOOTH_INTRA = 99,
- /*!\brief Codec control function to set loop_filter_across_tiles_enabled.
+ /*!\brief Codec control function to turn on / off Paeth intra mode usage, int
+ * parameter
*
- * In encoding and decoding, AV1 allows disabling loop filter across tile
- * boundary The parameter for this control describes the value of this flag,
- * which has a valid range [0, 1]:
- * 0 = disable loop filter across tile boundary
- * 1 = enable loop filter across tile boundary
+ * - 0 = disable
+ * - 1 = enable (default)
+ */
+ AV1E_SET_ENABLE_PAETH_INTRA = 100,
+
+ /*!\brief Codec control function to turn on / off CFL uv intra mode usage, int
+ * parameter
*
- * By default, the value is 1, i.e. enable loop filter across tile boundary.
+ * This will enable or disable usage of chroma-from-luma intra mode.
*
- * Experiment: LOOPFILTERING_ACROSS_TILES
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_TILE_LOOPFILTER,
+ AV1E_SET_ENABLE_CFL_INTRA = 101,
- /*!\brief Codec control function to set the delta q mode
+ /*!\brief Codec control function to turn on / off frame superresolution, int
+ * parameter
*
- * AV1 has a segment based feature that allows encoder to adaptively change
- * quantization parameter for each segment within a frame to improve the
- * subjective quality. the delta q mode is added on top of segment based
- * feature, and allows control per 64x64 q and lf delta.This control makes
- * encoder operate in one of the several DELTA_Q_modes supported.
+ * \attention If AV1E_SET_ENABLE_SUPERRES is 0, then this flag is forced to 0.
*
- * By default, encoder operates with DELTAQ_Mode 0(deltaq signaling off).
+ * - 0 = disable
+ * - 1 = enable (default)
*/
- AV1E_SET_DELTAQ_MODE,
+ AV1E_SET_ENABLE_SUPERRES = 102,
- /*!\brief Codec control function to set the single tile decoding mode to 0 or
- * 1.
+ /*!\brief Codec control function to turn on / off overlay frames for
+ * filtered ALTREF frames, int parameter
*
- * 0 means that the single tile decoding is off, and 1 means that the single
- * tile decoding is on.
+ * This will enable or disable coding of overlay frames for filtered ALTREF
+ * frames. When set to 0, overlay frames are not used but show existing frame
+ * is used to display the filtered ALTREF frame as is. As a result the decoded
+ * frame rate remains the same as the display frame rate. The default is 1.
+ */
+ AV1E_SET_ENABLE_OVERLAY = 103,
+
+ /*!\brief Codec control function to turn on/off palette mode, int parameter */
+ AV1E_SET_ENABLE_PALETTE = 104,
+
+ /*!\brief Codec control function to turn on/off intra block copy mode, int
+ parameter */
+ AV1E_SET_ENABLE_INTRABC = 105,
+
+ /*!\brief Codec control function to turn on/off intra angle delta, int
+ parameter */
+ AV1E_SET_ENABLE_ANGLE_DELTA = 106,
+
+ /*!\brief Codec control function to set the delta q mode, unsigned int
+ * parameter
+ *
+ * AV1 supports a delta q mode feature, that allows modulating q per
+ * superblock.
*
- * Experiment: EXT_TILE
+ * - 0 = deltaq signaling off
+ * - 1 = use modulation to maximize objective quality (default)
+ * - 2 = use modulation to maximize perceptual quality
*/
- AV1E_SET_SINGLE_TILE_DECODING,
+ AV1E_SET_DELTAQ_MODE = 107,
- /*!\brief Codec control function to enable the extreme motion vector unit test
- * in AV1. Please note that this is only used in motion vector unit test.
+ /*!\brief Codec control function to turn on/off loopfilter modulation
+ * when delta q modulation is enabled, unsigned int parameter.
*
- * 0 : off, 1 : MAX_EXTREME_MV, 2 : MIN_EXTREME_MV
+ * \attention AV1 only supports loopfilter modulation when delta q
+ * modulation is enabled as well.
*/
- AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST,
+ AV1E_SET_DELTALF_MODE = 108,
+
+ /*!\brief Codec control function to set the single tile decoding mode,
+ * unsigned int parameter
+ *
+ * \attention Only applicable if large scale tiling is on.
+ *
+ * - 0 = single tile decoding is off
+ * - 1 = single tile decoding is on (default)
+ */
+ AV1E_SET_SINGLE_TILE_DECODING = 109,
+
+ /*!\brief Codec control function to enable the extreme motion vector unit
+ * test, unsigned int parameter
+ *
+ * - 0 = off
+ * - 1 = MAX_EXTREME_MV
+ * - 2 = MIN_EXTREME_MV
+ *
+ * \note This is only used in motion vector unit test.
+ */
+ AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST = 110,
/*!\brief Codec control function to signal picture timing info in the
- * bitstream. \note Valid ranges: 0..1, default is "UNKNOWN". 0 = UNKNOWN, 1 =
- * EQUAL
+ * bitstream, aom_timing_info_type_t parameter. Default is
+ * AOM_TIMING_UNSPECIFIED.
*/
- AV1E_SET_TIMING_INFO_TYPE,
+ AV1E_SET_TIMING_INFO_TYPE = 111,
/*!\brief Codec control function to add film grain parameters (one of several
- * preset types) info in the bitstream.
- * \note Valid ranges: 0..11, default is "0". 0 = UNKNOWN,
- * 1..16 = different test vectors for grain
+ * preset types) info in the bitstream, int parameter
+ *
+ Valid range: 0..16, 0 is unknown, 1..16 are test vectors
*/
- AV1E_SET_FILM_GRAIN_TEST_VECTOR,
+ AV1E_SET_FILM_GRAIN_TEST_VECTOR = 112,
- /*!\brief Codec control function to set the path to the film grain parameters
+ /*!\brief Codec control function to set the path to the film grain parameters,
+ * const char* parameter
*/
- AV1E_SET_FILM_GRAIN_TABLE,
+ AV1E_SET_FILM_GRAIN_TABLE = 113,
+
+ /*!\brief Sets the noise level, int parameter */
+ AV1E_SET_DENOISE_NOISE_LEVEL = 114,
+
+ /*!\brief Sets the denoisers block size, unsigned int parameter */
+ AV1E_SET_DENOISE_BLOCK_SIZE = 115,
- /*!\brief Sets the noise level */
- AV1E_SET_DENOISE_NOISE_LEVEL,
+ /*!\brief Sets the chroma subsampling x value, unsigned int parameter */
+ AV1E_SET_CHROMA_SUBSAMPLING_X = 116,
- /*!\brief Sets the denoisers block size */
- AV1E_SET_DENOISE_BLOCK_SIZE,
+ /*!\brief Sets the chroma subsampling y value, unsigned int parameter */
+ AV1E_SET_CHROMA_SUBSAMPLING_Y = 117,
- /*!\brief Sets the chroma subsampling x value */
- AV1E_SET_CHROMA_SUBSAMPLING_X,
+ /*!\brief Control to use a reduced tx type set, int parameter */
+ AV1E_SET_REDUCED_TX_TYPE_SET = 118,
- /*!\brief Sets the chroma subsampling y value */
- AV1E_SET_CHROMA_SUBSAMPLING_Y,
+ /*!\brief Control to use dct only for intra modes, int parameter */
+ AV1E_SET_INTRA_DCT_ONLY = 119,
+
+ /*!\brief Control to use dct only for inter modes, int parameter */
+ AV1E_SET_INTER_DCT_ONLY = 120,
+
+ /*!\brief Control to use default tx type only for intra modes, int parameter
+ */
+ AV1E_SET_INTRA_DEFAULT_TX_ONLY = 121,
+
+ /*!\brief Control to use adaptive quantize_b, int parameter */
+ AV1E_SET_QUANT_B_ADAPT = 122,
+
+ /*!\brief Control to select maximum height for the GF group pyramid structure,
+ * unsigned int parameter
+ *
+ * Valid range: 0..4
+ */
+ AV1E_SET_GF_MAX_PYRAMID_HEIGHT = 123,
+
+ /*!\brief Control to select maximum reference frames allowed per frame, int
+ * parameter
+ *
+ * Valid range: 3..7
+ */
+ AV1E_SET_MAX_REFERENCE_FRAMES = 124,
+
+ /*!\brief Control to use reduced set of single and compound references, int
+ parameter */
+ AV1E_SET_REDUCED_REFERENCE_SET = 125,
+
+ /* NOTE: enums 126-139 unused */
+ /* NOTE: Need a gap in enum values to avoud conflict with 128, 129, 130 */
+
+ /*!\brief Control to set frequency of the cost updates for coefficients,
+ * unsigned int parameter
+ *
+ * - 0 = update at SB level (default)
+ * - 1 = update at SB row level in tile
+ * - 2 = update at tile level
+ * - 3 = turn off
+ */
+ AV1E_SET_COEFF_COST_UPD_FREQ = 140,
+
+ /*!\brief Control to set frequency of the cost updates for mode, unsigned int
+ * parameter
+ *
+ * - 0 = update at SB level (default)
+ * - 1 = update at SB row level in tile
+ * - 2 = update at tile level
+ * - 3 = turn off
+ */
+ AV1E_SET_MODE_COST_UPD_FREQ = 141,
+
+ /*!\brief Control to set frequency of the cost updates for motion vectors,
+ * unsigned int parameter
+ *
+ * - 0 = update at SB level (default)
+ * - 1 = update at SB row level in tile
+ * - 2 = update at tile level
+ * - 3 = turn off
+ */
+ AV1E_SET_MV_COST_UPD_FREQ = 142,
+
+ /*!\brief Control to set bit mask that specifies which tier each of the 32
+ * possible operating points conforms to, unsigned int parameter
+ *
+ * - 0 = main tier (default)
+ * - 1 = high tier
+ */
+ AV1E_SET_TIER_MASK = 143,
+
+ /*!\brief Control to set minimum compression ratio, unsigned int parameter
+ * Take integer values. If non-zero, encoder will try to keep the compression
+ * ratio of each frame to be higher than the given value divided by 100.
+ * E.g. 850 means minimum compression ratio of 8.5.
+ */
+ AV1E_SET_MIN_CR = 144,
+
+ /* NOTE: enums 145-149 unused */
+
+ /*!\brief Codec control function to set the layer id, aom_svc_layer_id_t*
+ * parameter
+ */
+ AV1E_SET_SVC_LAYER_ID = 150,
+
+ /*!\brief Codec control function to set SVC paramaeters, aom_svc_params_t*
+ * parameter
+ */
+ AV1E_SET_SVC_PARAMS = 151,
+
+ /*!\brief Codec control function to set reference frame config:
+ * the ref_idx and the refresh flags for each buffer slot.
+ * aom_svc_ref_frame_config_t* parameter
+ */
+ AV1E_SET_SVC_REF_FRAME_CONFIG = 152,
+
+ /*!\brief Codec control function to set the path to the VMAF model used when
+ * tuning the encoder for VMAF, const char* parameter
+ */
+ AV1E_SET_VMAF_MODEL_PATH = 153,
+
+ /*!\brief Codec control function to enable EXT_TILE_DEBUG in AV1 encoder,
+ * unsigned int parameter
+ *
+ * - 0 = disable (default)
+ * - 1 = enable
+ *
+ * \note This is only used in lightfield example test.
+ */
+ AV1E_ENABLE_EXT_TILE_DEBUG = 154,
+
+ /*!\brief Codec control function to enable the superblock multipass unit test
+ * in AV1 to ensure that the encoder does not leak state between different
+ * passes. unsigned int parameter.
+ *
+ * - 0 = disable (default)
+ * - 1 = enable
+ *
+ * \note This is only used in sb_multipass unit test.
+ */
+ AV1E_ENABLE_SB_MULTIPASS_UNIT_TEST = 155,
+
+ /*!\brief Control to select minimum height for the GF group pyramid structure,
+ * unsigned int parameter
+ *
+ * Valid values: 0..4
+ */
+ AV1E_SET_GF_MIN_PYRAMID_HEIGHT = 156,
};
/*!\brief aom 1-D scaling mode
@@ -948,36 +1339,78 @@ typedef enum {
*
*/
typedef enum {
- AOM_TUNE_PSNR,
- AOM_TUNE_SSIM,
- AOM_TUNE_CDEF_DIST,
- AOM_TUNE_DAALA_DIST
+ AOM_TUNE_PSNR = 0,
+ AOM_TUNE_SSIM = 1,
+ /* NOTE: enums 2 and 3 unused */
+ AOM_TUNE_VMAF_WITH_PREPROCESSING = 4,
+ AOM_TUNE_VMAF_WITHOUT_PREPROCESSING = 5,
+ AOM_TUNE_VMAF_MAX_GAIN = 6
} aom_tune_metric;
+#define AOM_MAX_LAYERS 32 /**< Max number of layers */
+#define AOM_MAX_SS_LAYERS 4 /**< Max number of spatial layers */
+#define AOM_MAX_TS_LAYERS 8 /**< Max number of temporal layers */
+
+/*!brief Struct for spatial and temporal layer ID */
+typedef struct aom_svc_layer_id {
+ int spatial_layer_id; /**< Spatial layer ID */
+ int temporal_layer_id; /**< Temporal layer ID */
+} aom_svc_layer_id_t;
+
+/*!brief Parameter type for SVC */
+typedef struct aom_svc_params {
+ int number_spatial_layers; /**< Number of spatial layers */
+ int number_temporal_layers; /**< Number of temporal layers */
+ int max_quantizers[AOM_MAX_LAYERS]; /**< Max Q for each layer */
+ int min_quantizers[AOM_MAX_LAYERS]; /**< Min Q for each layer */
+ int scaling_factor_num[AOM_MAX_SS_LAYERS]; /**< Scaling factor-numerator */
+ int scaling_factor_den[AOM_MAX_SS_LAYERS]; /**< Scaling factor-denominator */
+ /*! Target bitrate for each layer */
+ int layer_target_bitrate[AOM_MAX_LAYERS];
+ /*! Frame rate factor for each temporal layer */
+ int framerate_factor[AOM_MAX_TS_LAYERS];
+} aom_svc_params_t;
+
+/*!brief Parameters for setting ref frame config */
+typedef struct aom_svc_ref_frame_config {
+ // 7 references: LAST_FRAME (0), LAST2_FRAME(1), LAST3_FRAME(2),
+ // GOLDEN_FRAME(3), BWDREF_FRAME(4), ALTREF2_FRAME(5), ALTREF_FRAME(6).
+ int reference[7]; /**< Reference flag for each of the 7 references. */
+ /*! Buffer slot index for each of 7 references. */
+ int ref_idx[7];
+ int refresh[8]; /**< Refresh flag for each of the 8 slots. */
+} aom_svc_ref_frame_config_t;
+
/*!\cond */
/*!\brief Encoder control function parameter type
*
- * Defines the data types that AOME/AV1E control functions take. Note that
- * additional common controls are defined in aom.h
+ * Defines the data types that AOME/AV1E control functions take.
*
+ * \note Additional common controls are defined in aom.h.
+ *
+ * \note For each control ID "X", a macro-define of
+ * AOM_CTRL_X is provided. It is used at compile time to determine
+ * if the control ID is supported by the libaom library available,
+ * when the libaom version cannot be controlled.
*/
-
AOM_CTRL_USE_TYPE(AOME_USE_REFERENCE, int)
#define AOM_CTRL_AOME_USE_REFERENCE
+
AOM_CTRL_USE_TYPE(AOME_SET_ROI_MAP, aom_roi_map_t *)
#define AOM_CTRL_AOME_SET_ROI_MAP
+
AOM_CTRL_USE_TYPE(AOME_SET_ACTIVEMAP, aom_active_map_t *)
#define AOM_CTRL_AOME_SET_ACTIVEMAP
+
AOM_CTRL_USE_TYPE(AOME_SET_SCALEMODE, aom_scaling_mode_t *)
#define AOM_CTRL_AOME_SET_SCALEMODE
-AOM_CTRL_USE_TYPE(AOME_SET_SPATIAL_LAYER_ID, int)
+AOM_CTRL_USE_TYPE(AOME_SET_SPATIAL_LAYER_ID, unsigned int)
#define AOM_CTRL_AOME_SET_SPATIAL_LAYER_ID
AOM_CTRL_USE_TYPE(AOME_SET_CPUUSED, int)
#define AOM_CTRL_AOME_SET_CPUUSED
-AOM_CTRL_USE_TYPE(AOME_SET_DEVSF, int)
-#define AOM_CTRL_AOME_SET_DEVSF
+
AOM_CTRL_USE_TYPE(AOME_SET_ENABLEAUTOALTREF, unsigned int)
#define AOM_CTRL_AOME_SET_ENABLEAUTOALTREF
@@ -986,43 +1419,46 @@ AOM_CTRL_USE_TYPE(AOME_SET_ENABLEAUTOBWDREF, unsigned int)
AOM_CTRL_USE_TYPE(AOME_SET_SHARPNESS, unsigned int)
#define AOM_CTRL_AOME_SET_SHARPNESS
+
AOM_CTRL_USE_TYPE(AOME_SET_STATIC_THRESHOLD, unsigned int)
#define AOM_CTRL_AOME_SET_STATIC_THRESHOLD
AOM_CTRL_USE_TYPE(AOME_SET_ARNR_MAXFRAMES, unsigned int)
#define AOM_CTRL_AOME_SET_ARNR_MAXFRAMES
+
AOM_CTRL_USE_TYPE(AOME_SET_ARNR_STRENGTH, unsigned int)
#define AOM_CTRL_AOME_SET_ARNR_STRENGTH
+
AOM_CTRL_USE_TYPE(AOME_SET_TUNING, int) /* aom_tune_metric */
#define AOM_CTRL_AOME_SET_TUNING
+
AOM_CTRL_USE_TYPE(AOME_SET_CQ_LEVEL, unsigned int)
#define AOM_CTRL_AOME_SET_CQ_LEVEL
-AOM_CTRL_USE_TYPE(AV1E_SET_ROW_MT, int)
+AOM_CTRL_USE_TYPE(AV1E_SET_ROW_MT, unsigned int)
#define AOM_CTRL_AV1E_SET_ROW_MT
-AOM_CTRL_USE_TYPE(AV1E_SET_TILE_COLUMNS, int)
+AOM_CTRL_USE_TYPE(AV1E_SET_TILE_COLUMNS, unsigned int)
#define AOM_CTRL_AV1E_SET_TILE_COLUMNS
-AOM_CTRL_USE_TYPE(AV1E_SET_TILE_ROWS, int)
+
+AOM_CTRL_USE_TYPE(AV1E_SET_TILE_ROWS, unsigned int)
#define AOM_CTRL_AV1E_SET_TILE_ROWS
-AOM_CTRL_USE_TYPE(AV1E_SET_TILE_DEPENDENT_ROWS, int)
-#define AOM_CTRL_AV1E_SET_TILE_DEPENDENT_ROWS
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_TPL_MODEL, unsigned int)
+#define AOM_CTRL_AV1E_SET_ENABLE_TPL_MODEL
-AOM_CTRL_USE_TYPE(AV1E_SET_TILE_LOOPFILTER_V, int)
-#define AOM_CTRL_AV1E_SET_TILE_LOOPFILTER_V
-AOM_CTRL_USE_TYPE(AV1E_SET_TILE_LOOPFILTER_H, int)
-#define AOM_CTRL_AV1E_SET_TILE_LOOPFILTER_H
-AOM_CTRL_USE_TYPE(AV1E_SET_TILE_LOOPFILTER, int)
-#define AOM_CTRL_AV1E_SET_TILE_LOOPFILTER
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_KEYFRAME_FILTERING, unsigned int)
+#define AOM_CTRL_AV1E_SET_ENABLE_KEYFRAME_FILTERING
AOM_CTRL_USE_TYPE(AOME_GET_LAST_QUANTIZER, int *)
#define AOM_CTRL_AOME_GET_LAST_QUANTIZER
+
AOM_CTRL_USE_TYPE(AOME_GET_LAST_QUANTIZER_64, int *)
#define AOM_CTRL_AOME_GET_LAST_QUANTIZER_64
AOM_CTRL_USE_TYPE(AOME_SET_MAX_INTRA_BITRATE_PCT, unsigned int)
#define AOM_CTRL_AOME_SET_MAX_INTRA_BITRATE_PCT
+
AOM_CTRL_USE_TYPE(AOME_SET_MAX_INTER_BITRATE_PCT, unsigned int)
#define AOM_CTRL_AOME_SET_MAX_INTER_BITRATE_PCT
@@ -1041,6 +1477,12 @@ AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_CDEF, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_RESTORATION, unsigned int)
#define AOM_CTRL_AV1E_SET_ENABLE_RESTORATION
+AOM_CTRL_USE_TYPE(AV1E_SET_FORCE_VIDEO_MODE, unsigned int)
+#define AOM_CTRL_AV1E_SET_FORCE_VIDEO_MODE
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_OBMC, unsigned int)
+#define AOM_CTRL_AV1E_SET_ENABLE_OBMC
+
AOM_CTRL_USE_TYPE(AV1E_SET_DISABLE_TRELLIS_QUANT, unsigned int)
#define AOM_CTRL_AV1E_SET_DISABLE_TRELLIS_QUANT
@@ -1067,43 +1509,119 @@ AOM_CTRL_USE_TYPE(AV1E_SET_QM_V, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_NUM_TG, unsigned int)
#define AOM_CTRL_AV1E_SET_NUM_TG
+
AOM_CTRL_USE_TYPE(AV1E_SET_MTU, unsigned int)
#define AOM_CTRL_AV1E_SET_MTU
-AOM_CTRL_USE_TYPE(AV1E_SET_TIMING_INFO_TYPE, aom_timing_info_type_t)
+AOM_CTRL_USE_TYPE(AV1E_SET_TIMING_INFO_TYPE, int) /* aom_timing_info_type_t */
#define AOM_CTRL_AV1E_SET_TIMING_INFO_TYPE
-AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_DF, unsigned int)
-#define AOM_CTRL_AV1E_SET_ENABLE_DF
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_RECT_PARTITIONS, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_RECT_PARTITIONS
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_AB_PARTITIONS, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_AB_PARTITIONS
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_1TO4_PARTITIONS, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_1TO4_PARTITIONS
-AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_ORDER_HINT, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_SET_MIN_PARTITION_SIZE, int)
+#define AOM_CTRL_AV1E_SET_MIN_PARTITION_SIZE
+
+AOM_CTRL_USE_TYPE(AV1E_SET_MAX_PARTITION_SIZE, int)
+#define AOM_CTRL_AV1E_SET_MAX_PARTITION_SIZE
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_INTRA_EDGE_FILTER, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_INTRA_EDGE_FILTER
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_ORDER_HINT, int)
#define AOM_CTRL_AV1E_SET_ENABLE_ORDER_HINT
-AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_JNT_COMP, unsigned int)
-#define AOM_CTRL_AV1E_SET_ENABLE_JNT_COMP
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_TX64, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_TX64
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_FLIP_IDTX, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_FLIP_IDTX
-AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_REF_FRAME_MVS, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_DIST_WTD_COMP, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_DIST_WTD_COMP
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_REF_FRAME_MVS, int)
#define AOM_CTRL_AV1E_SET_ENABLE_REF_FRAME_MVS
-AOM_CTRL_USE_TYPE(AV1E_SET_ALLOW_REF_FRAME_MVS, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_SET_ALLOW_REF_FRAME_MVS, int)
#define AOM_CTRL_AV1E_SET_ALLOW_REF_FRAME_MVS
-AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_WARPED_MOTION, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_DUAL_FILTER, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_DUAL_FILTER
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_CHROMA_DELTAQ, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_CHROMA_DELTAQ
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_MASKED_COMP, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_MASKED_COMP
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_ONESIDED_COMP, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_ONESIDED_COMP
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_INTERINTRA_COMP, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_INTERINTRA_COMP
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_SMOOTH_INTERINTRA, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_SMOOTH_INTERINTRA
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_DIFF_WTD_COMP, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_DIFF_WTD_COMP
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_INTERINTER_WEDGE, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_INTERINTER_WEDGE
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_INTERINTRA_WEDGE, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_INTERINTRA_WEDGE
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_GLOBAL_MOTION, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_GLOBAL_MOTION
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_WARPED_MOTION, int)
#define AOM_CTRL_AV1E_SET_ENABLE_WARPED_MOTION
-AOM_CTRL_USE_TYPE(AV1E_SET_ALLOW_WARPED_MOTION, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_SET_ALLOW_WARPED_MOTION, int)
#define AOM_CTRL_AV1E_SET_ALLOW_WARPED_MOTION
-AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_SUPERRES, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_FILTER_INTRA, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_FILTER_INTRA
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_SMOOTH_INTRA, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_SMOOTH_INTRA
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_PAETH_INTRA, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_PAETH_INTRA
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_CFL_INTRA, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_CFL_INTRA
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_SUPERRES, int)
#define AOM_CTRL_AV1E_SET_ENABLE_SUPERRES
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_OVERLAY, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_OVERLAY
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_PALETTE, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_PALETTE
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_INTRABC, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_INTRABC
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_ANGLE_DELTA, int)
+#define AOM_CTRL_AV1E_SET_ENABLE_ANGLE_DELTA
+
AOM_CTRL_USE_TYPE(AV1E_SET_FRAME_PARALLEL_DECODING, unsigned int)
#define AOM_CTRL_AV1E_SET_FRAME_PARALLEL_DECODING
-AOM_CTRL_USE_TYPE(AV1E_SET_ERROR_RESILIENT_MODE, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_SET_ERROR_RESILIENT_MODE, int)
#define AOM_CTRL_AV1E_SET_ERROR_RESILIENT_MODE
-AOM_CTRL_USE_TYPE(AV1E_SET_S_FRAME_MODE, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_SET_S_FRAME_MODE, int)
#define AOM_CTRL_AV1E_SET_S_FRAME_MODE
AOM_CTRL_USE_TYPE(AV1E_SET_AQ_MODE, unsigned int)
@@ -1112,6 +1630,9 @@ AOM_CTRL_USE_TYPE(AV1E_SET_AQ_MODE, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_DELTAQ_MODE, unsigned int)
#define AOM_CTRL_AV1E_SET_DELTAQ_MODE
+AOM_CTRL_USE_TYPE(AV1E_SET_DELTALF_MODE, unsigned int)
+#define AOM_CTRL_AV1E_SET_DELTALF_MODE
+
AOM_CTRL_USE_TYPE(AV1E_SET_FRAME_PERIODIC_BOOST, unsigned int)
#define AOM_CTRL_AV1E_SET_FRAME_PERIODIC_BOOST
@@ -1151,14 +1672,8 @@ AOM_CTRL_USE_TYPE(AV1E_SET_RENDER_SIZE, int *)
AOM_CTRL_USE_TYPE(AV1E_SET_SUPERBLOCK_SIZE, unsigned int)
#define AOM_CTRL_AV1E_SET_SUPERBLOCK_SIZE
-AOM_CTRL_USE_TYPE(AV1E_SET_TARGET_LEVEL, unsigned int)
-#define AOM_CTRL_AV1E_SET_TARGET_LEVEL
-
-AOM_CTRL_USE_TYPE(AV1E_GET_LEVEL, int *)
-#define AOM_CTRL_AV1E_GET_LEVEL
-
-AOM_CTRL_USE_TYPE(AV1E_SET_ANS_WINDOW_SIZE_LOG2, unsigned int)
-#define AOM_CTRL_AV1E_SET_ANS_WINDOW_SIZE_LOG2
+AOM_CTRL_USE_TYPE(AV1E_GET_SEQ_LEVEL_IDX, int *)
+#define AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX
AOM_CTRL_USE_TYPE(AV1E_SET_SINGLE_TILE_DECODING, unsigned int)
#define AOM_CTRL_AV1E_SET_SINGLE_TILE_DECODING
@@ -1166,22 +1681,26 @@ AOM_CTRL_USE_TYPE(AV1E_SET_SINGLE_TILE_DECODING, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST, unsigned int)
#define AOM_CTRL_AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST
-AOM_CTRL_USE_TYPE(AV1E_SET_FILM_GRAIN_TEST_VECTOR, unsigned int)
+AOM_CTRL_USE_TYPE(AV1E_ENABLE_EXT_TILE_DEBUG, unsigned int)
+#define AOM_CTRL_AV1E_ENABLE_EXT_TILE_DEBUG
+
+AOM_CTRL_USE_TYPE(AV1E_SET_VMAF_MODEL_PATH, const char *)
+#define AOM_CTRL_AV1E_SET_VMAF_MODEL_PATH
+
+AOM_CTRL_USE_TYPE(AV1E_SET_FILM_GRAIN_TEST_VECTOR, int)
#define AOM_CTRL_AV1E_SET_FILM_GRAIN_TEST_VECTOR
AOM_CTRL_USE_TYPE(AV1E_SET_FILM_GRAIN_TABLE, const char *)
#define AOM_CTRL_AV1E_SET_FILM_GRAIN_TABLE
-AOM_CTRL_USE_TYPE(AV1E_SET_CDF_UPDATE_MODE, int)
+AOM_CTRL_USE_TYPE(AV1E_SET_CDF_UPDATE_MODE, unsigned int)
#define AOM_CTRL_AV1E_SET_CDF_UPDATE_MODE
-#ifdef CONFIG_DENOISE
-AOM_CTRL_USE_TYPE(AV1E_SET_DENOISE_NOISE_LEVEL, int);
+AOM_CTRL_USE_TYPE(AV1E_SET_DENOISE_NOISE_LEVEL, int)
#define AOM_CTRL_AV1E_SET_DENOISE_NOISE_LEVEL
-AOM_CTRL_USE_TYPE(AV1E_SET_DENOISE_BLOCK_SIZE, unsigned int);
+AOM_CTRL_USE_TYPE(AV1E_SET_DENOISE_BLOCK_SIZE, unsigned int)
#define AOM_CTRL_AV1E_SET_DENOISE_BLOCK_SIZE
-#endif
AOM_CTRL_USE_TYPE(AV1E_SET_CHROMA_SUBSAMPLING_X, unsigned int)
#define AOM_CTRL_AV1E_SET_CHROMA_SUBSAMPLING_X
@@ -1189,6 +1708,63 @@ AOM_CTRL_USE_TYPE(AV1E_SET_CHROMA_SUBSAMPLING_X, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_CHROMA_SUBSAMPLING_Y, unsigned int)
#define AOM_CTRL_AV1E_SET_CHROMA_SUBSAMPLING_Y
+AOM_CTRL_USE_TYPE(AV1E_SET_REDUCED_TX_TYPE_SET, int)
+#define AOM_CTRL_AV1E_SET_REDUCED_TX_TYPE_SET
+
+AOM_CTRL_USE_TYPE(AV1E_SET_INTRA_DCT_ONLY, int)
+#define AOM_CTRL_AV1E_SET_INTRA_DCT_ONLY
+
+AOM_CTRL_USE_TYPE(AV1E_SET_INTER_DCT_ONLY, int)
+#define AOM_CTRL_AV1E_SET_INTER_DCT_ONLY
+
+AOM_CTRL_USE_TYPE(AV1E_SET_INTRA_DEFAULT_TX_ONLY, int)
+#define AOM_CTRL_AV1E_SET_INTRA_DEFAULT_TX_ONLY
+
+AOM_CTRL_USE_TYPE(AV1E_SET_QUANT_B_ADAPT, int)
+#define AOM_CTRL_AV1E_SET_QUANT_B_ADAPT
+
+AOM_CTRL_USE_TYPE(AV1E_SET_GF_MIN_PYRAMID_HEIGHT, unsigned int)
+#define AOM_CTRL_AV1E_SET_GF_MIN_PYRAMID_HEIGHT
+
+AOM_CTRL_USE_TYPE(AV1E_SET_GF_MAX_PYRAMID_HEIGHT, unsigned int)
+#define AOM_CTRL_AV1E_SET_GF_MAX_PYRAMID_HEIGHT
+
+AOM_CTRL_USE_TYPE(AV1E_SET_MAX_REFERENCE_FRAMES, int)
+#define AOM_CTRL_AV1E_SET_MAX_REFERENCE_FRAMES
+
+AOM_CTRL_USE_TYPE(AV1E_SET_REDUCED_REFERENCE_SET, int)
+#define AOM_CTRL_AV1E_SET_REDUCED_REFERENCE_SET
+
+AOM_CTRL_USE_TYPE(AV1E_SET_COEFF_COST_UPD_FREQ, unsigned int)
+#define AOM_CTRL_AV1E_SET_COEFF_COST_UPD_FREQ
+
+AOM_CTRL_USE_TYPE(AV1E_SET_MODE_COST_UPD_FREQ, unsigned int)
+#define AOM_CTRL_AV1E_SET_MODE_COST_UPD_FREQ
+
+AOM_CTRL_USE_TYPE(AV1E_SET_MV_COST_UPD_FREQ, unsigned int)
+#define AOM_CTRL_AV1E_SET_MV_COST_UPD_FREQ
+
+AOM_CTRL_USE_TYPE(AV1E_SET_TARGET_SEQ_LEVEL_IDX, int)
+#define AOM_CTRL_AV1E_SET_TARGET_SEQ_LEVEL_IDX
+
+AOM_CTRL_USE_TYPE(AV1E_SET_TIER_MASK, unsigned int)
+#define AOM_CTRL_AV1E_SET_TIER_MASK
+
+AOM_CTRL_USE_TYPE(AV1E_SET_MIN_CR, unsigned int)
+#define AOM_CTRL_AV1E_SET_MIN_CR
+
+AOM_CTRL_USE_TYPE(AV1E_SET_SVC_LAYER_ID, aom_svc_layer_id_t *)
+#define AOME_CTRL_AV1E_SET_SVC_LAYER_ID
+
+AOM_CTRL_USE_TYPE(AV1E_SET_SVC_PARAMS, aom_svc_params_t *)
+#define AOME_CTRL_AV1E_SET_SVC_PARAMS
+
+AOM_CTRL_USE_TYPE(AV1E_SET_SVC_REF_FRAME_CONFIG, aom_svc_ref_frame_config_t *)
+#define AOME_CTRL_AV1E_SET_SVC_REF_FRAME_CONFIG
+
+AOM_CTRL_USE_TYPE(AV1E_ENABLE_SB_MULTIPASS_UNIT_TEST, unsigned int)
+#define AOM_CTRL_AV1E_ENABLE_SB_MULTIPASS_UNIT_TEST
+
/*!\endcond */
/*! @} - end defgroup aom_encoder */
#ifdef __cplusplus
diff --git a/media/libaom/src/aom/aomdx.h b/media/libaom/src/aom/aomdx.h
index 765856a1bb..8cd5de3959 100644
--- a/media/libaom/src/aom/aomdx.h
+++ b/media/libaom/src/aom/aomdx.h
@@ -45,6 +45,7 @@ typedef struct Accounting Accounting;
/** Callback that inspects decoder frame data.
*/
typedef void (*aom_inspect_cb)(void *decoder, void *ctx);
+
#endif
/*!\brief Structure to hold inspection callback and context.
@@ -60,6 +61,21 @@ typedef struct aom_inspect_init {
void *inspect_ctx;
} aom_inspect_init;
+/*!\brief Structure to collect a buffer index when inspecting.
+ *
+ * Defines a structure to hold the buffer and return an index
+ * when calling decode from inspect. This enables us to decode
+ * non showable sub frames.
+ */
+typedef struct {
+ /*! Pointer for new position in compressed buffer after decoding 1 OBU. */
+ const unsigned char *buf;
+ /*! Index into reference buffer array to see result of decoding 1 OBU. */
+ int idx;
+ /*! Is a show existing frame. */
+ int show_existing;
+} Av1DecodeReturn;
+
/*!\brief Structure to hold a tile's start address and size in the bitstream.
*
* Defines a structure to hold a tile's start address and size in the bitstream.
@@ -90,146 +106,195 @@ typedef struct av1_ext_ref_frame {
* This set of macros define the control functions available for the AOM
* decoder interface.
*
- * \sa #aom_codec_control
+ * \sa #aom_codec_control(aom_codec_ctx_t *ctx, int ctrl_id, ...)
*/
enum aom_dec_control_id {
- /** control function to get info on which reference frames were updated
- * by the last decode
+ /*!\brief Codec control function to get info on which reference frames were
+ * updated by the last decode, int* parameter
*/
AOMD_GET_LAST_REF_UPDATES = AOM_DECODER_CTRL_ID_START,
- /** check if the indicated frame is corrupted */
+ /*!\brief Codec control function to check if the indicated frame is
+ corrupted, int* parameter
+ */
AOMD_GET_FRAME_CORRUPTED,
- /** control function to get info on which reference frames were used
- * by the last decode
+ /*!\brief Codec control function to get info on which reference frames were
+ * used by the last decode, int* parameter
*/
AOMD_GET_LAST_REF_USED,
- /** control function to get the dimensions that the current frame is decoded
- * at. This may be different to the intended display size for the frame as
- * specified in the wrapper or frame header (see AV1D_GET_DISPLAY_SIZE). */
+ /*!\brief Codec control function to get the dimensions that the current
+ * frame is decoded at, int* parameter. This may be different to the
+ * intended display size for the frame as specified in the wrapper or frame
+ * header (see AV1D_GET_DISPLAY_SIZE).
+ */
AV1D_GET_FRAME_SIZE,
- /** control function to get the current frame's intended display dimensions
- * (as specified in the wrapper or frame header). This may be different to
- * the decoded dimensions of this frame (see AV1D_GET_FRAME_SIZE). */
+ /*!\brief Codec control function to get the current frame's intended display
+ * dimensions (as specified in the wrapper or frame header), int* parameter.
+ * This may be different to the decoded dimensions of this frame (see
+ * AV1D_GET_FRAME_SIZE).
+ */
AV1D_GET_DISPLAY_SIZE,
- /** control function to get the bit depth of the stream. */
+ /*!\brief Codec control function to get the bit depth of the stream,
+ * unsigned int* parameter
+ */
AV1D_GET_BIT_DEPTH,
- /** control function to get the image format of the stream. */
+ /*!\brief Codec control function to get the image format of the stream,
+ * aom_img_fmt_t* parameter
+ */
AV1D_GET_IMG_FORMAT,
- /** control function to get the size of the tile. */
+ /*!\brief Codec control function to get the size of the tile, unsigned int
+ parameter */
AV1D_GET_TILE_SIZE,
- /** control function to set the byte alignment of the planes in the reference
- * buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets
+ /*!\brief Codec control function to get the tile count in a tile list, int*
+ * parameter
+ */
+ AV1D_GET_TILE_COUNT,
+
+ /*!\brief Codec control function to set the byte alignment of the planes in
+ * the reference buffers, int parameter
+ *
+ * Valid values are power of 2, from 32 to 1024. A value of 0 sets
* legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly
* follows Y plane, and V plane directly follows U plane. Default value is 0.
*/
AV1_SET_BYTE_ALIGNMENT,
- /** control function to invert the decoding order to from right to left. The
- * function is used in a test to confirm the decoding independence of tile
+ /*!\brief Codec control function to invert the decoding order to from right to
+ * left, int parameter
+ *
+ * The function is used in a test to confirm the decoding independence of tile
* columns. The function may be used in application where this order
- * of decoding is desired.
+ * of decoding is desired. int parameter
*
* TODO(yaowu): Rework the unit test that uses this control, and in a future
* release, this test-only control shall be removed.
*/
AV1_INVERT_TILE_DECODE_ORDER,
- /** control function to set the skip loop filter flag. Valid values are
- * integers. The decoder will skip the loop filter when its value is set to
- * nonzero. If the loop filter is skipped the decoder may accumulate decode
- * artifacts. The default value is 0.
+ /*!\brief Codec control function to set the skip loop filter flag, int
+ * parameter
+ *
+ * Valid values are integers. The decoder will skip the loop filter
+ * when its value is set to nonzero. If the loop filter is skipped the
+ * decoder may accumulate decode artifacts. The default value is 0.
*/
AV1_SET_SKIP_LOOP_FILTER,
- /** control function to retrieve a pointer to the Accounting struct. When
- * compiled without --enable-accounting, this returns AOM_CODEC_INCAPABLE.
+ /*!\brief Codec control function to retrieve a pointer to the Accounting
+ * struct, takes Accounting** as parameter
+ *
* If called before a frame has been decoded, this returns AOM_CODEC_ERROR.
* The caller should ensure that AOM_CODEC_OK is returned before attempting
* to dereference the Accounting pointer.
+ *
+ * \attention When compiled without --enable-accounting, this returns
+ * AOM_CODEC_INCAPABLE.
*/
AV1_GET_ACCOUNTING,
- /** control function to get last decoded frame quantizer. Returned value uses
- * internal quantizer scale defined by the codec.
+ /*!\brief Codec control function to get last decoded frame quantizer,
+ * int* parameter
+ *
+ * Returned value uses internal quantizer scale defined by the codec.
*/
AOMD_GET_LAST_QUANTIZER,
- /** control function to set the range of tile decoding. A value that is
- * greater and equal to zero indicates only the specific row/column is
- * decoded. A value that is -1 indicates the whole row/column is decoded.
- * A special case is both values are -1 that means the whole frame is
- * decoded.
+ /*!\brief Codec control function to set the range of tile decoding, int
+ * parameter
+ *
+ * A value that is greater and equal to zero indicates only the specific
+ * row/column is decoded. A value that is -1 indicates the whole row/column
+ * is decoded. A special case is both values are -1 that means the whole
+ * frame is decoded.
*/
AV1_SET_DECODE_TILE_ROW,
AV1_SET_DECODE_TILE_COL,
- /** control function to set the tile coding mode. A value that is equal to
- * zero indicates the tiles are coded in normal tile mode. A value that is
- * 1 indicates the tiles are coded in large-scale tile mode.
+
+ /*!\brief Codec control function to set the tile coding mode, int parameter
+ *
+ * - 0 = tiles are coded in normal tile mode
+ * - 1 = tiles are coded in large-scale tile mode
*/
AV1_SET_TILE_MODE,
- /** control function to get the frame header information of an encoded frame
- * in the bitstream. This provides a way to access a frame's header data.
+
+ /*!\brief Codec control function to get the frame header information of an
+ * encoded frame, unsigned int* parameter
*/
AV1D_GET_FRAME_HEADER_INFO,
- /** control function to get the start address and size of a tile in the coded
- * bitstream. This provides a way to access a specific tile's bitstream data.
+
+ /*!\brief Codec control function to get the start address and size of a
+ * tile in the coded bitstream, aom_tile_data* parameter.
*/
AV1D_GET_TILE_DATA,
- /** control function to set the external references' pointers in the decoder.
- * This is used while decoding the tile list OBU in large-scale tile coding
- * mode.
+
+ /*!\brief Codec control function to set the external references' pointers in
+ * the decoder, av1_ext_ref_frame_t* parameter.
+ *
+ * This is used while decoding the tile list OBU in large-scale tile coding
+ * mode.
*/
AV1D_SET_EXT_REF_PTR,
- /** control function to enable the ext-tile software debug and testing code in
- * the decoder.
+
+ /*!\brief Codec control function to enable the ext-tile software debug and
+ * testing code in the decoder, unsigned int parameter
*/
AV1D_EXT_TILE_DEBUG,
- /** control function to enable the row based multi-threading of decoding. A
- * value that is equal to 1 indicates that row based multi-threading is
- * enabled.
+ /*!\brief Codec control function to enable the row based multi-threading of
+ * decoding, unsigned int parameter
+ *
+ * - 0 = disabled
+ * - 1 = enabled (default)
*/
AV1D_SET_ROW_MT,
- /** control function to indicate whether bitstream is in Annex-B format. */
+ /*!\brief Codec control function to indicate whether bitstream is in
+ * Annex-B format, unsigned int parameter
+ */
AV1D_SET_IS_ANNEXB,
- /** control function to indicate which operating point to use. A scalable
- * stream may define multiple operating points, each of which defines a
- * set of temporal and spatial layers to be processed. The operating point
- * index may take a value between 0 and operating_points_cnt_minus_1 (which
- * is at most 31).
+ /*!\brief Codec control function to indicate which operating point to use,
+ * int parameter
+ *
+ * A scalable stream may define multiple operating points, each of which
+ * defines a set of temporal and spatial layers to be processed. The
+ * operating point index may take a value between 0 and
+ * operating_points_cnt_minus_1 (which is at most 31).
*/
AV1D_SET_OPERATING_POINT,
- /** control function to indicate whether to output one frame per temporal
- * unit (the default), or one frame per spatial layer.
- * In a scalable stream, each temporal unit corresponds to a single "frame"
- * of video, and within a temporal unit there may be multiple spatial layers
- * with different versions of that frame.
- * For video playback, only the highest-quality version (within the
- * selected operating point) is needed, but for some use cases it is useful
- * to have access to multiple versions of a frame when they are available.
+ /*!\brief Codec control function to indicate whether to output one frame per
+ * temporal unit (the default), or one frame per spatial layer. int parameter
+ *
+ * In a scalable stream, each temporal unit corresponds to a single "frame"
+ * of video, and within a temporal unit there may be multiple spatial layers
+ * with different versions of that frame.
+ * For video playback, only the highest-quality version (within the
+ * selected operating point) is needed, but for some use cases it is useful
+ * to have access to multiple versions of a frame when they are available.
*/
AV1D_SET_OUTPUT_ALL_LAYERS,
- /** control function to set an aom_inspect_cb callback that is invoked each
- * time a frame is decoded. When compiled without --enable-inspection, this
+ /*!\brief Codec control function to set an aom_inspect_cb callback that is
+ * invoked each time a frame is decoded, aom_inspect_init* parameter
+ *
+ * \attention When compiled without --enable-inspection, this
* returns AOM_CODEC_INCAPABLE.
*/
AV1_SET_INSPECTION_CALLBACK,
- /** control function to set the skip film grain flag. Valid values are
- * integers. The decoder will skip the film grain when its value is set to
- * nonzero. The default value is 0.
+ /*!\brief Codec control function to set the skip film grain flag, int
+ * parameter
+ *
+ * Valid values are integers. The decoder will skip the film grain when its
+ * value is set to nonzero. The default value is 0.
*/
AV1D_SET_SKIP_FILM_GRAIN,
@@ -239,57 +304,87 @@ enum aom_dec_control_id {
/*!\cond */
/*!\brief AOM decoder control function parameter type
*
- * Defines the data types that AOMD control functions take. Note that
- * additional common controls are defined in aom.h
+ * Defines the data types that AOMD control functions take.
*
+ * \note Additional common controls are defined in aom.h.
+ *
+ * \note For each control ID "X", a macro-define of
+ * AOM_CTRL_X is provided. It is used at compile time to determine
+ * if the control ID is supported by the libaom library available,
+ * when the libaom version cannot be controlled.
*/
-
AOM_CTRL_USE_TYPE(AOMD_GET_LAST_REF_UPDATES, int *)
#define AOM_CTRL_AOMD_GET_LAST_REF_UPDATES
+
AOM_CTRL_USE_TYPE(AOMD_GET_FRAME_CORRUPTED, int *)
#define AOM_CTRL_AOMD_GET_FRAME_CORRUPTED
+
AOM_CTRL_USE_TYPE(AOMD_GET_LAST_REF_USED, int *)
#define AOM_CTRL_AOMD_GET_LAST_REF_USED
+
AOM_CTRL_USE_TYPE(AOMD_GET_LAST_QUANTIZER, int *)
#define AOM_CTRL_AOMD_GET_LAST_QUANTIZER
+
AOM_CTRL_USE_TYPE(AV1D_GET_DISPLAY_SIZE, int *)
#define AOM_CTRL_AV1D_GET_DISPLAY_SIZE
+
AOM_CTRL_USE_TYPE(AV1D_GET_BIT_DEPTH, unsigned int *)
#define AOM_CTRL_AV1D_GET_BIT_DEPTH
+
AOM_CTRL_USE_TYPE(AV1D_GET_IMG_FORMAT, aom_img_fmt_t *)
#define AOM_CTRL_AV1D_GET_IMG_FORMAT
+
AOM_CTRL_USE_TYPE(AV1D_GET_TILE_SIZE, unsigned int *)
#define AOM_CTRL_AV1D_GET_TILE_SIZE
+
+AOM_CTRL_USE_TYPE(AV1D_GET_TILE_COUNT, unsigned int *)
+#define AOM_CTRL_AV1D_GET_TILE_COUNT
+
AOM_CTRL_USE_TYPE(AV1D_GET_FRAME_SIZE, int *)
#define AOM_CTRL_AV1D_GET_FRAME_SIZE
+
AOM_CTRL_USE_TYPE(AV1_INVERT_TILE_DECODE_ORDER, int)
#define AOM_CTRL_AV1_INVERT_TILE_DECODE_ORDER
+
AOM_CTRL_USE_TYPE(AV1_GET_ACCOUNTING, Accounting **)
#define AOM_CTRL_AV1_GET_ACCOUNTING
+
AOM_CTRL_USE_TYPE(AV1_SET_DECODE_TILE_ROW, int)
#define AOM_CTRL_AV1_SET_DECODE_TILE_ROW
+
AOM_CTRL_USE_TYPE(AV1_SET_DECODE_TILE_COL, int)
#define AOM_CTRL_AV1_SET_DECODE_TILE_COL
+
AOM_CTRL_USE_TYPE(AV1_SET_TILE_MODE, unsigned int)
#define AOM_CTRL_AV1_SET_TILE_MODE
+
AOM_CTRL_USE_TYPE(AV1D_GET_FRAME_HEADER_INFO, aom_tile_data *)
#define AOM_CTRL_AV1D_GET_FRAME_HEADER_INFO
+
AOM_CTRL_USE_TYPE(AV1D_GET_TILE_DATA, aom_tile_data *)
#define AOM_CTRL_AV1D_GET_TILE_DATA
+
AOM_CTRL_USE_TYPE(AV1D_SET_EXT_REF_PTR, av1_ext_ref_frame_t *)
#define AOM_CTRL_AV1D_SET_EXT_REF_PTR
+
AOM_CTRL_USE_TYPE(AV1D_EXT_TILE_DEBUG, unsigned int)
#define AOM_CTRL_AV1D_EXT_TILE_DEBUG
+
AOM_CTRL_USE_TYPE(AV1D_SET_ROW_MT, unsigned int)
#define AOM_CTRL_AV1D_SET_ROW_MT
+
AOM_CTRL_USE_TYPE(AV1D_SET_SKIP_FILM_GRAIN, int)
#define AOM_CTRL_AV1D_SET_SKIP_FILM_GRAIN
+
AOM_CTRL_USE_TYPE(AV1D_SET_IS_ANNEXB, unsigned int)
#define AOM_CTRL_AV1D_SET_IS_ANNEXB
+
AOM_CTRL_USE_TYPE(AV1D_SET_OPERATING_POINT, int)
#define AOM_CTRL_AV1D_SET_OPERATING_POINT
+
AOM_CTRL_USE_TYPE(AV1D_SET_OUTPUT_ALL_LAYERS, int)
#define AOM_CTRL_AV1D_SET_OUTPUT_ALL_LAYERS
+
AOM_CTRL_USE_TYPE(AV1_SET_INSPECTION_CALLBACK, aom_inspect_init *)
#define AOM_CTRL_AV1_SET_INSPECTION_CALLBACK
/*!\endcond */
diff --git a/media/libaom/src/aom/exports_com b/media/libaom/src/aom/exports_com
index 2798bd51ad..6f796f5db0 100644
--- a/media/libaom/src/aom/exports_com
+++ b/media/libaom/src/aom/exports_com
@@ -1,5 +1,5 @@
text aom_codec_build_config
-text aom_codec_control_
+text aom_codec_control
text aom_codec_destroy
text aom_codec_err_to_string
text aom_codec_error
@@ -9,12 +9,21 @@ text aom_codec_iface_name
text aom_codec_version
text aom_codec_version_extra_str
text aom_codec_version_str
+text aom_free
+text aom_img_add_metadata
text aom_img_alloc
text aom_img_alloc_with_border
text aom_img_flip
text aom_img_free
+text aom_img_get_metadata
+text aom_img_metadata_array_free
+text aom_img_metadata_array_alloc
+text aom_img_metadata_free
+text aom_img_metadata_alloc
+text aom_img_num_metadata
text aom_img_plane_height
text aom_img_plane_width
+text aom_img_remove_metadata
text aom_img_set_rect
text aom_img_wrap
text aom_malloc
diff --git a/media/libaom/src/aom/exports_dec b/media/libaom/src/aom/exports_dec
index d7d1c4f7da..ffff023ddd 100644
--- a/media/libaom/src/aom/exports_dec
+++ b/media/libaom/src/aom/exports_dec
@@ -3,8 +3,6 @@ text aom_codec_decode
text aom_codec_get_frame
text aom_codec_get_stream_info
text aom_codec_peek_stream_info
-text aom_codec_register_put_frame_cb
-text aom_codec_register_put_slice_cb
text aom_codec_set_frame_buffer_functions
text aom_obu_type_to_string
text aom_read_obu_header
diff --git a/media/libaom/src/aom/exports_enc b/media/libaom/src/aom/exports_enc
index 918d742f05..1473d9d2b5 100644
--- a/media/libaom/src/aom/exports_enc
+++ b/media/libaom/src/aom/exports_enc
@@ -1,6 +1,5 @@
text aom_codec_enc_config_default
text aom_codec_enc_config_set
-text aom_codec_enc_init_multi_ver
text aom_codec_enc_init_ver
text aom_codec_encode
text aom_codec_get_cx_data
diff --git a/media/libaom/src/aom/exports_test b/media/libaom/src/aom/exports_test
index 01b864bae5..452a532ce6 100644
--- a/media/libaom/src/aom/exports_test
+++ b/media/libaom/src/aom/exports_test
@@ -1,2 +1,4 @@
+text aom_copy_metadata_to_frame_buffer
text aom_dsp_rtcd
+text aom_remove_metadata_from_frame_buffer
text aom_scale_rtcd
diff --git a/media/libaom/src/aom/internal/aom_codec_internal.h b/media/libaom/src/aom/internal/aom_codec_internal.h
index 21c0dc69c7..efe09acc91 100644
--- a/media/libaom/src/aom/internal/aom_codec_internal.h
+++ b/media/libaom/src/aom/internal/aom_codec_internal.h
@@ -59,10 +59,9 @@ extern "C" {
* types, removing or reassigning enums, adding/removing/rearranging
* fields to structures
*/
-#define AOM_CODEC_INTERNAL_ABI_VERSION (5) /**<\hideinitializer*/
+#define AOM_CODEC_INTERNAL_ABI_VERSION (7) /**<\hideinitializer*/
typedef struct aom_codec_alg_priv aom_codec_alg_priv_t;
-typedef struct aom_codec_priv_enc_mr_cfg aom_codec_priv_enc_mr_cfg_t;
/*!\brief init function pointer prototype
*
@@ -77,8 +76,7 @@ typedef struct aom_codec_priv_enc_mr_cfg aom_codec_priv_enc_mr_cfg_t;
* \retval #AOM_CODEC_MEM_ERROR
* Memory operation failed.
*/
-typedef aom_codec_err_t (*aom_codec_init_fn_t)(
- aom_codec_ctx_t *ctx, aom_codec_priv_enc_mr_cfg_t *data);
+typedef aom_codec_err_t (*aom_codec_init_fn_t)(aom_codec_ctx_t *ctx);
/*!\brief destroy function pointer prototype
*
@@ -138,7 +136,7 @@ typedef aom_codec_err_t (*aom_codec_get_si_fn_t)(aom_codec_alg_priv_t *ctx,
* function, so plugins implementing this interface may trust the input
* parameters to be properly initialized. However, this interface does not
* provide type safety for the exchanged data or assign meanings to the
- * control codes. Those details should be specified in the algorithm's
+ * control IDs. Those details should be specified in the algorithm's
* header file. In particular, the ctrl_id parameter is guaranteed to exist
* in the algorithm's control mapping table, and the data parameter may be NULL.
*
@@ -171,17 +169,12 @@ typedef const struct aom_codec_ctrl_fn_map {
/*!\brief decode data function pointer prototype
*
- * Processes a buffer of coded data. If the processing results in a new
- * decoded frame becoming available, #AOM_CODEC_CB_PUT_SLICE and
- * #AOM_CODEC_CB_PUT_FRAME events are generated as appropriate. This
- * function is called by the generic aom_codec_decode() wrapper function,
- * so plugins implementing this interface may trust the input parameters
- * to be properly initialized.
+ * Processes a buffer of coded data. This function is called by the generic
+ * aom_codec_decode() wrapper function, so plugins implementing this interface
+ * may trust the input parameters to be properly initialized.
*
* \param[in] ctx Pointer to this instance's context
- * \param[in] data Pointer to this block of new coded data. If
- * NULL, a #AOM_CODEC_CB_PUT_FRAME event is posted
- * for the previously decoded frame.
+ * \param[in] data Pointer to this block of new coded data.
* \param[in] data_sz Size of the coded data, in bytes.
*
* \return Returns #AOM_CODEC_OK if the coded data was processed completely
@@ -259,24 +252,6 @@ typedef aom_fixed_buf_t *(*aom_codec_get_global_headers_fn_t)(
typedef aom_image_t *(*aom_codec_get_preview_frame_fn_t)(
aom_codec_alg_priv_t *ctx);
-typedef aom_codec_err_t (*aom_codec_enc_mr_get_mem_loc_fn_t)(
- const aom_codec_enc_cfg_t *cfg, void **mem_loc);
-
-/*!\brief usage configuration mapping
- *
- * This structure stores the mapping between usage identifiers and
- * configuration structures. Each algorithm provides a list of these
- * mappings. This list is searched by the aom_codec_enc_config_default()
- * wrapper function to determine which config to return. The special value
- * {-1, {0}} is used to indicate end-of-list, and must be present. At least
- * one mapping must be present, in addition to the end-of-list.
- *
- */
-typedef const struct aom_codec_enc_cfg_map {
- int usage;
- aom_codec_enc_cfg_t cfg;
-} aom_codec_enc_cfg_map_t;
-
/*!\brief Decoder algorithm interface interface
*
* All decoders \ref MUST expose a variable of this type.
@@ -297,10 +272,9 @@ struct aom_codec_iface {
aom_codec_set_fb_fn_t set_fb_fn; /**< \copydoc ::aom_codec_set_fb_fn_t */
} dec;
struct aom_codec_enc_iface {
- int cfg_map_count;
- aom_codec_enc_cfg_map_t
- *cfg_maps; /**< \copydoc ::aom_codec_enc_cfg_map_t */
- aom_codec_encode_fn_t encode; /**< \copydoc ::aom_codec_encode_fn_t */
+ int cfg_count;
+ const aom_codec_enc_cfg_t *cfgs; /**< \copydoc ::aom_codec_enc_cfg_t */
+ aom_codec_encode_fn_t encode; /**< \copydoc ::aom_codec_encode_fn_t */
aom_codec_get_cx_data_fn_t
get_cx_data; /**< \copydoc ::aom_codec_get_cx_data_fn_t */
aom_codec_enc_config_set_fn_t
@@ -309,20 +283,9 @@ struct aom_codec_iface {
get_glob_hdrs; /**< \copydoc ::aom_codec_get_global_headers_fn_t */
aom_codec_get_preview_frame_fn_t
get_preview; /**< \copydoc ::aom_codec_get_preview_frame_fn_t */
- aom_codec_enc_mr_get_mem_loc_fn_t
- mr_get_mem_loc; /**< \copydoc ::aom_codec_enc_mr_get_mem_loc_fn_t */
} enc;
};
-/*!\brief Callback function pointer / user data pair storage */
-typedef struct aom_codec_priv_cb_pair {
- union {
- aom_codec_put_frame_cb_fn_t put_frame;
- aom_codec_put_slice_cb_fn_t put_slice;
- } u;
- void *user_priv;
-} aom_codec_priv_cb_pair_t;
-
/*!\brief Instance private storage
*
* This structure is allocated by the algorithm's init function. It can be
@@ -335,37 +298,14 @@ struct aom_codec_priv {
const char *err_detail;
aom_codec_flags_t init_flags;
struct {
- aom_codec_priv_cb_pair_t put_frame_cb;
- aom_codec_priv_cb_pair_t put_slice_cb;
- } dec;
- struct {
aom_fixed_buf_t cx_data_dst_buf;
unsigned int cx_data_pad_before;
unsigned int cx_data_pad_after;
aom_codec_cx_pkt_t cx_data_pkt;
- unsigned int total_encoders;
} enc;
};
-/*
- * Multi-resolution encoding internal configuration
- */
-struct aom_codec_priv_enc_mr_cfg {
- unsigned int mr_total_resolutions;
- unsigned int mr_encoder_id;
- struct aom_rational mr_down_sampling_factor;
- void *mr_low_res_mode_info;
-};
-
-#undef AOM_CTRL_USE_TYPE
-#define AOM_CTRL_USE_TYPE(id, typ) \
- static AOM_INLINE typ id##__value(va_list args) { return va_arg(args, typ); }
-
-#undef AOM_CTRL_USE_TYPE_DEPRECATED
-#define AOM_CTRL_USE_TYPE_DEPRECATED(id, typ) \
- static AOM_INLINE typ id##__value(va_list args) { return va_arg(args, typ); }
-
-#define CAST(id, arg) id##__value(arg)
+#define CAST(id, arg) va_arg((arg), aom_codec_control_type_##id)
/* CODEC_INTERFACE convenience macro
*
diff --git a/media/libaom/src/aom/internal/aom_image_internal.h b/media/libaom/src/aom/internal/aom_image_internal.h
new file mode 100644
index 0000000000..7f2fd1891d
--- /dev/null
+++ b/media/libaom/src/aom/internal/aom_image_internal.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+/*!\file
+ * \brief Describes the internal functions associated with the aom image
+ * descriptor.
+ *
+ */
+#ifndef AOM_AOM_INTERNAL_AOM_IMAGE_INTERNAL_H_
+#define AOM_AOM_INTERNAL_AOM_IMAGE_INTERNAL_H_
+
+#include "aom/aom_image.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!\brief Array of aom_metadata structs for an image. */
+struct aom_metadata_array {
+ size_t sz; /* Number of metadata structs in the list */
+ aom_metadata_t **metadata_array; /* Array of metadata structs */
+};
+
+/*!\brief Alloc memory for aom_metadata_array struct.
+ *
+ * Allocate memory for aom_metadata_array struct.
+ * If sz is 0 the aom_metadata_array structs internal buffer list will be NULL,
+ * but the aom_metadata_array struct itself will still be allocated.
+ * Returns a pointer to the allocated struct or NULL on failure.
+ *
+ * \param[in] sz Size of internal metadata list buffer
+ */
+aom_metadata_array_t *aom_img_metadata_array_alloc(size_t sz);
+
+/*!\brief Free metadata array struct.
+ *
+ * Free metadata array struct and all metadata structs inside.
+ *
+ * \param[in] arr Metadata array struct pointer
+ */
+void aom_img_metadata_array_free(aom_metadata_array_t *arr);
+
+typedef void *(*aom_alloc_img_data_cb_fn_t)(void *priv, size_t size);
+
+/*!\brief Open a descriptor, allocating storage for the underlying image by
+ * using the provided callback function.
+ *
+ * Returns a descriptor for storing an image of the given format. The storage
+ * for the image is allocated by using the provided callback function. Unlike
+ * aom_img_alloc(), the returned descriptor does not own the storage for the
+ * image. The caller is responsible for freeing the storage for the image.
+ *
+ * Note: If the callback function is invoked and succeeds,
+ * aom_img_alloc_with_cb() is guaranteed to succeed. Therefore, if
+ * aom_img_alloc_with_cb() fails, the caller is assured that no storage was
+ * allocated.
+ *
+ * \param[in] img Pointer to storage for descriptor. If this parameter
+ * is NULL, the storage for the descriptor will be
+ * allocated on the heap.
+ * \param[in] fmt Format for the image
+ * \param[in] d_w Width of the image
+ * \param[in] d_h Height of the image
+ * \param[in] align Alignment, in bytes, of the image buffer and
+ * each row in the image (stride).
+ * \param[in] alloc_cb Callback function used to allocate storage for the
+ * image.
+ * \param[in] cb_priv The first argument ('priv') for the callback
+ * function.
+ *
+ * \return Returns a pointer to the initialized image descriptor. If the img
+ * parameter is non-null, the value of the img parameter will be
+ * returned.
+ */
+aom_image_t *aom_img_alloc_with_cb(aom_image_t *img, aom_img_fmt_t fmt,
+ unsigned int d_w, unsigned int d_h,
+ unsigned int align,
+ aom_alloc_img_data_cb_fn_t alloc_cb,
+ void *cb_priv);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // AOM_AOM_INTERNAL_AOM_IMAGE_INTERNAL_H_
diff --git a/media/libaom/src/aom/src/aom_codec.c b/media/libaom/src/aom/src/aom_codec.c
index 733bffb25d..196ab8354d 100644
--- a/media/libaom/src/aom/src/aom_codec.c
+++ b/media/libaom/src/aom/src/aom_codec.c
@@ -89,7 +89,7 @@ aom_codec_caps_t aom_codec_get_caps(aom_codec_iface_t *iface) {
return (iface) ? iface->caps : 0;
}
-aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...) {
+aom_codec_err_t aom_codec_control(aom_codec_ctx_t *ctx, int ctrl_id, ...) {
aom_codec_err_t res;
if (!ctx || !ctrl_id)
diff --git a/media/libaom/src/aom/src/aom_decoder.c b/media/libaom/src/aom/src/aom_decoder.c
index 8c9111faf0..49fff26352 100644
--- a/media/libaom/src/aom/src/aom_decoder.c
+++ b/media/libaom/src/aom/src/aom_decoder.c
@@ -34,12 +34,6 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
res = AOM_CODEC_INVALID_PARAM;
else if (iface->abi_version != AOM_CODEC_INTERNAL_ABI_VERSION)
res = AOM_CODEC_ABI_MISMATCH;
- else if ((flags & AOM_CODEC_USE_POSTPROC) &&
- !(iface->caps & AOM_CODEC_CAP_POSTPROC))
- res = AOM_CODEC_INCAPABLE;
- else if ((flags & AOM_CODEC_USE_INPUT_FRAGMENTS) &&
- !(iface->caps & AOM_CODEC_CAP_INPUT_FRAGMENTS))
- res = AOM_CODEC_INCAPABLE;
else if (!(iface->caps & AOM_CODEC_CAP_DECODER))
res = AOM_CODEC_INCAPABLE;
else {
@@ -50,7 +44,7 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
ctx->init_flags = flags;
ctx->config.dec = cfg;
- res = ctx->iface->init(ctx, NULL);
+ res = ctx->iface->init(ctx);
if (res) {
ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
aom_codec_destroy(ctx);
@@ -123,44 +117,6 @@ aom_image_t *aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter) {
return img;
}
-aom_codec_err_t aom_codec_register_put_frame_cb(aom_codec_ctx_t *ctx,
- aom_codec_put_frame_cb_fn_t cb,
- void *user_priv) {
- aom_codec_err_t res;
-
- if (!ctx || !cb)
- res = AOM_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv ||
- !(ctx->iface->caps & AOM_CODEC_CAP_PUT_FRAME))
- res = AOM_CODEC_ERROR;
- else {
- ctx->priv->dec.put_frame_cb.u.put_frame = cb;
- ctx->priv->dec.put_frame_cb.user_priv = user_priv;
- res = AOM_CODEC_OK;
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-aom_codec_err_t aom_codec_register_put_slice_cb(aom_codec_ctx_t *ctx,
- aom_codec_put_slice_cb_fn_t cb,
- void *user_priv) {
- aom_codec_err_t res;
-
- if (!ctx || !cb)
- res = AOM_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv ||
- !(ctx->iface->caps & AOM_CODEC_CAP_PUT_SLICE))
- res = AOM_CODEC_ERROR;
- else {
- ctx->priv->dec.put_slice_cb.u.put_slice = cb;
- ctx->priv->dec.put_slice_cb.user_priv = user_priv;
- res = AOM_CODEC_OK;
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
aom_codec_err_t aom_codec_set_frame_buffer_functions(
aom_codec_ctx_t *ctx, aom_get_frame_buffer_cb_fn_t cb_get,
aom_release_frame_buffer_cb_fn_t cb_release, void *cb_priv) {
@@ -168,9 +124,10 @@ aom_codec_err_t aom_codec_set_frame_buffer_functions(
if (!ctx || !cb_get || !cb_release) {
res = AOM_CODEC_INVALID_PARAM;
- } else if (!ctx->iface || !ctx->priv ||
- !(ctx->iface->caps & AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
+ } else if (!ctx->iface || !ctx->priv) {
res = AOM_CODEC_ERROR;
+ } else if (!(ctx->iface->caps & AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
+ res = AOM_CODEC_INCAPABLE;
} else {
res = ctx->iface->dec.set_fb_fn(get_alg_priv(ctx), cb_get, cb_release,
cb_priv);
diff --git a/media/libaom/src/aom/src/aom_encoder.c b/media/libaom/src/aom/src/aom_encoder.c
index 523f40bbed..bb51c9388f 100644
--- a/media/libaom/src/aom/src/aom_encoder.c
+++ b/media/libaom/src/aom/src/aom_encoder.c
@@ -24,6 +24,8 @@
#include <limits.h>
#include <string.h>
+
+#include "aom/aom_encoder.h"
#include "aom/internal/aom_codec_internal.h"
#define SAVE_STATUS(ctx, var) (ctx ? (ctx->err = var) : var)
@@ -54,7 +56,7 @@ aom_codec_err_t aom_codec_enc_init_ver(aom_codec_ctx_t *ctx,
ctx->priv = NULL;
ctx->init_flags = flags;
ctx->config.enc = cfg;
- res = ctx->iface->init(ctx, NULL);
+ res = ctx->iface->init(ctx);
if (res) {
ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
@@ -65,113 +67,35 @@ aom_codec_err_t aom_codec_enc_init_ver(aom_codec_ctx_t *ctx,
return SAVE_STATUS(ctx, res);
}
-aom_codec_err_t aom_codec_enc_init_multi_ver(
- aom_codec_ctx_t *ctx, aom_codec_iface_t *iface, aom_codec_enc_cfg_t *cfg,
- int num_enc, aom_codec_flags_t flags, aom_rational_t *dsf, int ver) {
- aom_codec_err_t res = AOM_CODEC_OK;
-
- if (ver != AOM_ENCODER_ABI_VERSION)
- res = AOM_CODEC_ABI_MISMATCH;
- else if (!ctx || !iface || !cfg || (num_enc > 16 || num_enc < 1))
- res = AOM_CODEC_INVALID_PARAM;
- else if (iface->abi_version != AOM_CODEC_INTERNAL_ABI_VERSION)
- res = AOM_CODEC_ABI_MISMATCH;
- else if (!(iface->caps & AOM_CODEC_CAP_ENCODER))
- res = AOM_CODEC_INCAPABLE;
- else if ((flags & AOM_CODEC_USE_PSNR) && !(iface->caps & AOM_CODEC_CAP_PSNR))
- res = AOM_CODEC_INCAPABLE;
- else {
- int i;
- void *mem_loc = NULL;
-
- if (!(res = iface->enc.mr_get_mem_loc(cfg, &mem_loc))) {
- for (i = 0; i < num_enc; i++) {
- aom_codec_priv_enc_mr_cfg_t mr_cfg;
-
- /* Validate down-sampling factor. */
- if (dsf->num < 1 || dsf->num > 4096 || dsf->den < 1 ||
- dsf->den > dsf->num) {
- res = AOM_CODEC_INVALID_PARAM;
- break;
- }
-
- mr_cfg.mr_low_res_mode_info = mem_loc;
- mr_cfg.mr_total_resolutions = num_enc;
- mr_cfg.mr_encoder_id = num_enc - 1 - i;
- mr_cfg.mr_down_sampling_factor.num = dsf->num;
- mr_cfg.mr_down_sampling_factor.den = dsf->den;
-
- /* Force Key-frame synchronization. Namely, encoder at higher
- * resolution always use the same frame_type chosen by the
- * lowest-resolution encoder.
- */
- if (mr_cfg.mr_encoder_id) cfg->kf_mode = AOM_KF_DISABLED;
-
- ctx->iface = iface;
- ctx->name = iface->name;
- ctx->priv = NULL;
- ctx->init_flags = flags;
- ctx->config.enc = cfg;
- res = ctx->iface->init(ctx, &mr_cfg);
-
- if (res) {
- const char *error_detail = ctx->priv ? ctx->priv->err_detail : NULL;
- /* Destroy current ctx */
- ctx->err_detail = error_detail;
- aom_codec_destroy(ctx);
-
- /* Destroy already allocated high-level ctx */
- while (i) {
- ctx--;
- ctx->err_detail = error_detail;
- aom_codec_destroy(ctx);
- i--;
- }
- }
-
- if (res) break;
-
- ctx++;
- cfg++;
- dsf++;
- }
- ctx--;
- }
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface,
aom_codec_enc_cfg_t *cfg,
unsigned int usage) {
aom_codec_err_t res;
- aom_codec_enc_cfg_map_t *map;
int i;
- if (!iface || !cfg || usage > INT_MAX)
+ if (!iface || !cfg)
res = AOM_CODEC_INVALID_PARAM;
else if (!(iface->caps & AOM_CODEC_CAP_ENCODER))
res = AOM_CODEC_INCAPABLE;
else {
res = AOM_CODEC_INVALID_PARAM;
- for (i = 0; i < iface->enc.cfg_map_count; ++i) {
- map = iface->enc.cfg_maps + i;
- if (map->usage == (int)usage) {
- *cfg = map->cfg;
- cfg->g_usage = usage;
+ for (i = 0; i < iface->enc.cfg_count; ++i) {
+ if (iface->enc.cfgs[i].g_usage == usage) {
+ *cfg = iface->enc.cfgs[i];
res = AOM_CODEC_OK;
break;
}
}
}
-
/* default values */
if (cfg) {
- cfg->cfg.ext_partition = 1;
+ memset(&cfg->encoder_cfg, 0, sizeof(cfg->encoder_cfg));
+ cfg->encoder_cfg.super_block_size = 0; // Dynamic
+ cfg->encoder_cfg.max_partition_size = 128;
+ cfg->encoder_cfg.min_partition_size = 4;
+ cfg->encoder_cfg.disable_trellis_quant = 3;
}
-
return res;
}
@@ -190,8 +114,11 @@ aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface,
#if HAVE_FEXCEPT && CONFIG_DEBUG
#define FLOATING_POINT_SET_EXCEPTIONS \
- const int float_excepts = feenableexcept(FE_DIVBYZERO);
-#define FLOATING_POINT_RESTORE_EXCEPTIONS feenableexcept(float_excepts);
+ const int float_excepts = \
+ feenableexcept(FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW);
+#define FLOATING_POINT_RESTORE_EXCEPTIONS \
+ fedisableexcept(FE_ALL_EXCEPT); \
+ feenableexcept(float_excepts);
#else
#define FLOATING_POINT_SET_EXCEPTIONS
#define FLOATING_POINT_RESTORE_EXCEPTIONS
@@ -221,38 +148,11 @@ aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img,
else if (!(ctx->iface->caps & AOM_CODEC_CAP_ENCODER))
res = AOM_CODEC_INCAPABLE;
else {
- unsigned int num_enc = ctx->priv->enc.total_encoders;
-
/* Execute in a normalized floating point environment, if the platform
* requires it.
*/
FLOATING_POINT_INIT
-
- if (num_enc == 1)
- res =
- ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration, flags);
- else {
- /* Multi-resolution encoding:
- * Encode multi-levels in reverse order. For example,
- * if mr_total_resolutions = 3, first encode level 2,
- * then encode level 1, and finally encode level 0.
- */
- int i;
-
- ctx += num_enc - 1;
- if (img) img += num_enc - 1;
-
- for (i = num_enc - 1; i >= 0; i--) {
- if ((res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration,
- flags)))
- break;
-
- ctx--;
- if (img) img--;
- }
- ctx++;
- }
-
+ res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration, flags);
FLOATING_POINT_RESTORE
}
diff --git a/media/libaom/src/aom/src/aom_image.c b/media/libaom/src/aom/src/aom_image.c
index 437f0241eb..cd0b5ed835 100644
--- a/media/libaom/src/aom/src/aom_image.c
+++ b/media/libaom/src/aom/src/aom_image.c
@@ -14,6 +14,7 @@
#include "aom/aom_image.h"
#include "aom/aom_integer.h"
+#include "aom/internal/aom_image_internal.h"
#include "aom_mem/aom_mem.h"
static INLINE unsigned int align_image_dimension(unsigned int d,
@@ -29,8 +30,12 @@ static INLINE unsigned int align_image_dimension(unsigned int d,
static aom_image_t *img_alloc_helper(
aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w, unsigned int d_h,
unsigned int buf_align, unsigned int stride_align, unsigned int size_align,
- unsigned char *img_data, unsigned int border) {
- unsigned int h, w, s, xcs, ycs, bps;
+ unsigned int border, unsigned char *img_data,
+ aom_alloc_img_data_cb_fn_t alloc_cb, void *cb_priv) {
+ /* NOTE: In this function, bit_depth is either 8 or 16 (if
+ * AOM_IMG_FMT_HIGHBITDEPTH is set), never 10 or 12.
+ */
+ unsigned int h, w, s, xcs, ycs, bps, bit_depth;
unsigned int stride_in_bytes;
/* Treat align==0 like align==1 */
@@ -57,14 +62,17 @@ static aom_image_t *img_alloc_helper(
case AOM_IMG_FMT_YV12:
case AOM_IMG_FMT_AOMI420:
case AOM_IMG_FMT_AOMYV12: bps = 12; break;
- case AOM_IMG_FMT_I422:
+ case AOM_IMG_FMT_I422: bps = 16; break;
case AOM_IMG_FMT_I444: bps = 24; break;
+ case AOM_IMG_FMT_YV1216:
case AOM_IMG_FMT_I42016: bps = 24; break;
- case AOM_IMG_FMT_I42216:
+ case AOM_IMG_FMT_I42216: bps = 32; break;
case AOM_IMG_FMT_I44416: bps = 48; break;
default: bps = 16; break;
}
+ bit_depth = (fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? 16 : 8;
+
/* Get chroma shift values for this format */
switch (fmt) {
case AOM_IMG_FMT_I420:
@@ -73,6 +81,7 @@ static aom_image_t *img_alloc_helper(
case AOM_IMG_FMT_AOMYV12:
case AOM_IMG_FMT_I422:
case AOM_IMG_FMT_I42016:
+ case AOM_IMG_FMT_YV1216:
case AOM_IMG_FMT_I42216: xcs = 1; break;
default: xcs = 0; break;
}
@@ -82,6 +91,7 @@ static aom_image_t *img_alloc_helper(
case AOM_IMG_FMT_YV12:
case AOM_IMG_FMT_AOMI420:
case AOM_IMG_FMT_AOMYV12:
+ case AOM_IMG_FMT_YV1216:
case AOM_IMG_FMT_I42016: ycs = 1; break;
default: ycs = 0; break;
}
@@ -90,9 +100,9 @@ static aom_image_t *img_alloc_helper(
w = align_image_dimension(d_w, xcs, size_align);
h = align_image_dimension(d_h, ycs, size_align);
- s = (fmt & AOM_IMG_FMT_PLANAR) ? w : bps * w / 8;
+ s = (fmt & AOM_IMG_FMT_PLANAR) ? w : bps * w / bit_depth;
s = (s + 2 * border + stride_align - 1) & ~(stride_align - 1);
- stride_in_bytes = (fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s;
+ stride_in_bytes = s * bit_depth / 8;
/* Allocate the new image */
if (!img) {
@@ -110,19 +120,29 @@ static aom_image_t *img_alloc_helper(
if (!img_data) {
const uint64_t alloc_size =
(fmt & AOM_IMG_FMT_PLANAR)
- ? (uint64_t)(h + 2 * border) * stride_in_bytes * bps / 8
+ ? (uint64_t)(h + 2 * border) * stride_in_bytes * bps / bit_depth
: (uint64_t)(h + 2 * border) * stride_in_bytes;
if (alloc_size != (size_t)alloc_size) goto fail;
- img->img_data = (uint8_t *)aom_memalign(buf_align, (size_t)alloc_size);
- img->img_data_owner = 1;
+ if (alloc_cb) {
+ const size_t padded_alloc_size = (size_t)alloc_size + buf_align - 1;
+ img->img_data = (uint8_t *)alloc_cb(cb_priv, padded_alloc_size);
+ if (img->img_data) {
+ img->img_data = (uint8_t *)aom_align_addr(img->img_data, buf_align);
+ }
+ img->img_data_owner = 0;
+ } else {
+ img->img_data = (uint8_t *)aom_memalign(buf_align, (size_t)alloc_size);
+ img->img_data_owner = 1;
+ }
+ img->sz = (size_t)alloc_size;
}
if (!img->img_data) goto fail;
img->fmt = fmt;
- img->bit_depth = (fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? 16 : 8;
+ img->bit_depth = bit_depth;
// aligned width and aligned height
img->w = w;
img->h = h;
@@ -131,11 +151,13 @@ static aom_image_t *img_alloc_helper(
img->bps = bps;
/* Calculate strides */
- img->stride[AOM_PLANE_Y] = img->stride[AOM_PLANE_ALPHA] = stride_in_bytes;
+ img->stride[AOM_PLANE_Y] = stride_in_bytes;
img->stride[AOM_PLANE_U] = img->stride[AOM_PLANE_V] = stride_in_bytes >> xcs;
- /* Default viewport to entire image */
- if (!aom_img_set_rect(img, 0, 0, d_w, d_h, border)) return img;
+ /* Default viewport to entire image. (This aom_img_set_rect call always
+ * succeeds.) */
+ aom_img_set_rect(img, 0, 0, d_w, d_h, border);
+ return img;
fail:
aom_img_free(img);
@@ -145,15 +167,26 @@ fail:
aom_image_t *aom_img_alloc(aom_image_t *img, aom_img_fmt_t fmt,
unsigned int d_w, unsigned int d_h,
unsigned int align) {
- return img_alloc_helper(img, fmt, d_w, d_h, align, align, 1, NULL, 0);
+ return img_alloc_helper(img, fmt, d_w, d_h, align, align, 1, 0, NULL, NULL,
+ NULL);
+}
+
+aom_image_t *aom_img_alloc_with_cb(aom_image_t *img, aom_img_fmt_t fmt,
+ unsigned int d_w, unsigned int d_h,
+ unsigned int align,
+ aom_alloc_img_data_cb_fn_t alloc_cb,
+ void *cb_priv) {
+ return img_alloc_helper(img, fmt, d_w, d_h, align, align, 1, 0, NULL,
+ alloc_cb, cb_priv);
}
aom_image_t *aom_img_wrap(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w,
unsigned int d_h, unsigned int stride_align,
unsigned char *img_data) {
- /* By setting buf_align = 1, we don't change buffer alignment in this
- * function. */
- return img_alloc_helper(img, fmt, d_w, d_h, 1, stride_align, 1, img_data, 0);
+ /* Set buf_align = 1. It is ignored by img_alloc_helper because img_data is
+ * not NULL. */
+ return img_alloc_helper(img, fmt, d_w, d_h, 1, stride_align, 1, 0, img_data,
+ NULL, NULL);
}
aom_image_t *aom_img_alloc_with_border(aom_image_t *img, aom_img_fmt_t fmt,
@@ -161,8 +194,8 @@ aom_image_t *aom_img_alloc_with_border(aom_image_t *img, aom_img_fmt_t fmt,
unsigned int align,
unsigned int size_align,
unsigned int border) {
- return img_alloc_helper(img, fmt, d_w, d_h, align, align, size_align, NULL,
- border);
+ return img_alloc_helper(img, fmt, d_w, d_h, align, align, size_align, border,
+ NULL, NULL, NULL);
}
int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y,
@@ -185,12 +218,6 @@ int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y,
(img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
data = img->img_data;
- if (img->fmt & AOM_IMG_FMT_HAS_ALPHA) {
- img->planes[AOM_PLANE_ALPHA] =
- data + x * bytes_per_sample + y * img->stride[AOM_PLANE_ALPHA];
- data += (img->h + 2 * border) * img->stride[AOM_PLANE_ALPHA];
- }
-
img->planes[AOM_PLANE_Y] =
data + x * bytes_per_sample + y * img->stride[AOM_PLANE_Y];
data += (img->h + 2 * border) * img->stride[AOM_PLANE_Y];
@@ -236,14 +263,11 @@ void aom_img_flip(aom_image_t *img) {
img->planes[AOM_PLANE_V] += (signed)((img->d_h >> img->y_chroma_shift) - 1) *
img->stride[AOM_PLANE_V];
img->stride[AOM_PLANE_V] = -img->stride[AOM_PLANE_V];
-
- img->planes[AOM_PLANE_ALPHA] +=
- (signed)(img->d_h - 1) * img->stride[AOM_PLANE_ALPHA];
- img->stride[AOM_PLANE_ALPHA] = -img->stride[AOM_PLANE_ALPHA];
}
void aom_img_free(aom_image_t *img) {
if (img) {
+ aom_img_remove_metadata(img);
if (img->img_data && img->img_data_owner) aom_free(img->img_data);
if (img->self_allocd) free(img);
@@ -263,3 +287,109 @@ int aom_img_plane_height(const aom_image_t *img, int plane) {
else
return img->d_h;
}
+
+aom_metadata_t *aom_img_metadata_alloc(
+ uint32_t type, const uint8_t *data, size_t sz,
+ aom_metadata_insert_flags_t insert_flag) {
+ if (!data || sz == 0) return NULL;
+ aom_metadata_t *metadata = (aom_metadata_t *)malloc(sizeof(aom_metadata_t));
+ if (!metadata) return NULL;
+ metadata->type = type;
+ metadata->payload = (uint8_t *)malloc(sz);
+ if (!metadata->payload) {
+ free(metadata);
+ return NULL;
+ }
+ memcpy(metadata->payload, data, sz);
+ metadata->sz = sz;
+ metadata->insert_flag = insert_flag;
+ return metadata;
+}
+
+void aom_img_metadata_free(aom_metadata_t *metadata) {
+ if (metadata) {
+ if (metadata->payload) free(metadata->payload);
+ free(metadata);
+ }
+}
+
+aom_metadata_array_t *aom_img_metadata_array_alloc(size_t sz) {
+ aom_metadata_array_t *arr =
+ (aom_metadata_array_t *)calloc(1, sizeof(aom_metadata_array_t));
+ if (!arr) return NULL;
+ if (sz > 0) {
+ arr->metadata_array =
+ (aom_metadata_t **)calloc(sz, sizeof(aom_metadata_t *));
+ if (!arr->metadata_array) {
+ aom_img_metadata_array_free(arr);
+ return NULL;
+ }
+ arr->sz = sz;
+ }
+ return arr;
+}
+
+void aom_img_metadata_array_free(aom_metadata_array_t *arr) {
+ if (arr) {
+ if (arr->metadata_array) {
+ for (size_t i = 0; i < arr->sz; i++) {
+ aom_img_metadata_free(arr->metadata_array[i]);
+ }
+ free(arr->metadata_array);
+ }
+ free(arr);
+ }
+}
+
+int aom_img_add_metadata(aom_image_t *img, uint32_t type, const uint8_t *data,
+ size_t sz, aom_metadata_insert_flags_t insert_flag) {
+ if (!img) return -1;
+ if (!img->metadata) {
+ img->metadata = aom_img_metadata_array_alloc(0);
+ if (!img->metadata) return -1;
+ }
+ aom_metadata_t *metadata =
+ aom_img_metadata_alloc(type, data, sz, insert_flag);
+ if (!metadata) goto fail;
+ if (!img->metadata->metadata_array) {
+ img->metadata->metadata_array =
+ (aom_metadata_t **)calloc(1, sizeof(metadata));
+ if (!img->metadata->metadata_array || img->metadata->sz != 0) {
+ aom_img_metadata_free(metadata);
+ goto fail;
+ }
+ } else {
+ img->metadata->metadata_array =
+ (aom_metadata_t **)realloc(img->metadata->metadata_array,
+ (img->metadata->sz + 1) * sizeof(metadata));
+ }
+ img->metadata->metadata_array[img->metadata->sz] = metadata;
+ img->metadata->sz++;
+ return 0;
+fail:
+ aom_img_metadata_array_free(img->metadata);
+ img->metadata = NULL;
+ return -1;
+}
+
+void aom_img_remove_metadata(aom_image_t *img) {
+ if (img && img->metadata) {
+ aom_img_metadata_array_free(img->metadata);
+ img->metadata = NULL;
+ }
+}
+
+const aom_metadata_t *aom_img_get_metadata(const aom_image_t *img,
+ size_t index) {
+ if (!img) return NULL;
+ const aom_metadata_array_t *array = img->metadata;
+ if (array && index < array->sz) {
+ return array->metadata_array[index];
+ }
+ return NULL;
+}
+
+size_t aom_img_num_metadata(const aom_image_t *img) {
+ if (!img || !img->metadata) return 0;
+ return img->metadata->sz;
+}