summaryrefslogtreecommitdiffstats
path: root/third_party/aom/aom
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-19 21:52:15 -0500
committertrav90 <travawine@palemoon.org>2018-10-19 21:52:20 -0500
commitbbcc64772580c8a979288791afa02d30bc476d2e (patch)
tree437ce94c3fdd7497508e5b55de06c6d011678597 /third_party/aom/aom
parent14805f6ddbfb173c327768fff9f81f40ce5e81b0 (diff)
downloadUXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.gz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.lz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.xz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.zip
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
Diffstat (limited to 'third_party/aom/aom')
-rw-r--r--third_party/aom/aom/aom.h13
-rw-r--r--third_party/aom/aom/aom_codec.h92
-rw-r--r--third_party/aom/aom/aom_codec.mk42
-rw-r--r--third_party/aom/aom/aom_decoder.h28
-rw-r--r--third_party/aom/aom/aom_encoder.h95
-rw-r--r--third_party/aom/aom/aom_frame_buffer.h2
-rw-r--r--third_party/aom/aom/aom_image.h148
-rw-r--r--third_party/aom/aom/aom_integer.h42
-rw-r--r--third_party/aom/aom/aomcx.h518
-rw-r--r--third_party/aom/aom/aomdx.h117
-rw-r--r--third_party/aom/aom/exports_com5
-rw-r--r--third_party/aom/aom/internal/aom_codec_internal.h22
-rw-r--r--third_party/aom/aom/src/aom_codec.c21
-rw-r--r--third_party/aom/aom/src/aom_decoder.c9
-rw-r--r--third_party/aom/aom/src/aom_encoder.c27
-rw-r--r--third_party/aom/aom/src/aom_image.c107
-rw-r--r--third_party/aom/aom/src/aom_integer.c105
17 files changed, 1058 insertions, 335 deletions
diff --git a/third_party/aom/aom/aom.h b/third_party/aom/aom/aom.h
index fecbeaf56..c5ef2517d 100644
--- a/third_party/aom/aom/aom.h
+++ b/third_party/aom/aom/aom.h
@@ -31,8 +31,8 @@
#ifndef AOM_AOM_H_
#define AOM_AOM_H_
-#include "./aom_codec.h"
-#include "./aom_image.h"
+#include "aom/aom_codec.h"
+#include "aom/aom_image.h"
#ifdef __cplusplus
extern "C" {
@@ -63,6 +63,8 @@ enum aom_com_control_id {
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 */
AOM_DECODER_CTRL_ID_START = 256
};
@@ -104,8 +106,9 @@ typedef struct aom_postproc_cfg {
* Define the data struct to access av1 reference frames.
*/
typedef struct av1_ref_frame {
- int idx; /**< frame index to get (input) */
- aom_image_t img; /**< img structure to populate (output) */
+ int idx; /**< frame index to get (input) */
+ int use_external_ref; /**< Directly use external ref buffer(decoder only) */
+ aom_image_t img; /**< img structure to populate (output) */
} av1_ref_frame_t;
/*!\cond */
@@ -131,6 +134,8 @@ 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
/*!\endcond */
/*! @} - end defgroup aom */
diff --git a/third_party/aom/aom/aom_codec.h b/third_party/aom/aom/aom_codec.h
index 1d301d16b..63e358624 100644
--- a/third_party/aom/aom/aom_codec.h
+++ b/third_party/aom/aom/aom_codec.h
@@ -43,37 +43,37 @@
extern "C" {
#endif
-#include "./aom_integer.h"
-#include "./aom_image.h"
+#include "aom/aom_image.h"
+#include "aom/aom_integer.h"
/*!\brief Decorator indicating a function is deprecated */
-#ifndef DEPRECATED
+#ifndef AOM_DEPRECATED
#if defined(__GNUC__) && __GNUC__
-#define DEPRECATED __attribute__((deprecated))
+#define AOM_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
-#define DEPRECATED
+#define AOM_DEPRECATED
#else
-#define DEPRECATED
+#define AOM_DEPRECATED
#endif
-#endif /* DEPRECATED */
+#endif /* AOM_DEPRECATED */
-#ifndef DECLSPEC_DEPRECATED
+#ifndef AOM_DECLSPEC_DEPRECATED
#if defined(__GNUC__) && __GNUC__
-#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
+#define AOM_DECLSPEC_DEPRECATED /**< \copydoc #AOM_DEPRECATED */
#elif defined(_MSC_VER)
-/*!\brief \copydoc #DEPRECATED */
-#define DECLSPEC_DEPRECATED __declspec(deprecated)
+/*!\brief \copydoc #AOM_DEPRECATED */
+#define AOM_DECLSPEC_DEPRECATED __declspec(deprecated)
#else
-#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
+#define AOM_DECLSPEC_DEPRECATED /**< \copydoc #AOM_DEPRECATED */
#endif
-#endif /* DECLSPEC_DEPRECATED */
+#endif /* AOM_DECLSPEC_DEPRECATED */
/*!\brief Decorator indicating a function is potentially unused */
-#ifdef UNUSED
+#ifdef AOM_UNUSED
#elif defined(__GNUC__) || defined(__clang__)
-#define UNUSED __attribute__((unused))
+#define AOM_UNUSED __attribute__((unused))
#else
-#define UNUSED
+#define AOM_UNUSED
#endif
/*!\brief Decorator indicating that given struct/union/enum is packed */
@@ -433,7 +433,7 @@ aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...);
*/
#define AOM_CTRL_USE_TYPE(id, typ) \
static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *, int, typ) \
- UNUSED; \
+ AOM_UNUSED; \
\
static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *ctx, \
int ctrl_id, typ data) { \
@@ -450,13 +450,13 @@ aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...);
* 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) \
- DECLSPEC_DEPRECATED static aom_codec_err_t aom_codec_control_##id( \
- aom_codec_ctx_t *, int, typ) DEPRECATED UNUSED; \
- \
- 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); \
+#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
@@ -471,7 +471,7 @@ aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...);
*/
#define AOM_CTRL_VOID(id) \
static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *, int) \
- UNUSED; \
+ AOM_UNUSED; \
\
static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *ctx, \
int ctrl_id) { \
@@ -480,6 +480,48 @@ aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...);
#endif
+/*!\brief OBU types. */
+typedef enum ATTRIBUTE_PACKED {
+ OBU_SEQUENCE_HEADER = 1,
+ OBU_TEMPORAL_DELIMITER = 2,
+ OBU_FRAME_HEADER = 3,
+ OBU_TILE_GROUP = 4,
+ OBU_METADATA = 5,
+ OBU_FRAME = 6,
+ OBU_REDUNDANT_FRAME_HEADER = 7,
+ OBU_TILE_LIST = 8,
+ OBU_PADDING = 15,
+} OBU_TYPE;
+
+/*!\brief OBU metadata types. */
+typedef enum {
+ OBU_METADATA_TYPE_AOM_RESERVED_0 = 0,
+ OBU_METADATA_TYPE_HDR_CLL = 1,
+ OBU_METADATA_TYPE_HDR_MDCV = 2,
+ OBU_METADATA_TYPE_SCALABILITY = 3,
+ OBU_METADATA_TYPE_ITUT_T35 = 4,
+ OBU_METADATA_TYPE_TIMECODE = 5,
+} OBU_METADATA_TYPE;
+
+/*!\brief Returns string representation of OBU_TYPE.
+ *
+ * \param[in] type The OBU_TYPE to convert to string.
+ */
+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/third_party/aom/aom/aom_codec.mk b/third_party/aom/aom/aom_codec.mk
deleted file mode 100644
index 33bd3fe3b..000000000
--- a/third_party/aom/aom/aom_codec.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-##
-## Copyright (c) 2016, Alliance for Open Media. All rights reserved
-##
-## This source code is subject to the terms of the BSD 2 Clause License and
-## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
-## was not distributed with this source code in the LICENSE file, you can
-## obtain it at www.aomedia.org/license/software. If the Alliance for Open
-## Media Patent License 1.0 was not distributed with this source code in the
-## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
-##
-
-
-API_EXPORTS += exports
-
-API_SRCS-$(CONFIG_AV1_ENCODER) += aom.h
-API_SRCS-$(CONFIG_AV1_ENCODER) += aomcx.h
-API_DOC_SRCS-$(CONFIG_AV1_ENCODER) += aom.h
-API_DOC_SRCS-$(CONFIG_AV1_ENCODER) += aomcx.h
-
-API_SRCS-$(CONFIG_AV1_DECODER) += aom.h
-API_SRCS-$(CONFIG_AV1_DECODER) += aomdx.h
-API_DOC_SRCS-$(CONFIG_AV1_DECODER) += aom.h
-API_DOC_SRCS-$(CONFIG_AV1_DECODER) += aomdx.h
-
-API_DOC_SRCS-yes += aom_codec.h
-API_DOC_SRCS-yes += aom_decoder.h
-API_DOC_SRCS-yes += aom_encoder.h
-API_DOC_SRCS-yes += aom_frame_buffer.h
-API_DOC_SRCS-yes += aom_image.h
-
-API_SRCS-yes += src/aom_decoder.c
-API_SRCS-yes += aom_decoder.h
-API_SRCS-yes += src/aom_encoder.c
-API_SRCS-yes += aom_encoder.h
-API_SRCS-yes += internal/aom_codec_internal.h
-API_SRCS-yes += src/aom_codec.c
-API_SRCS-yes += src/aom_image.c
-API_SRCS-yes += aom_codec.h
-API_SRCS-yes += aom_codec.mk
-API_SRCS-yes += aom_frame_buffer.h
-API_SRCS-yes += aom_image.h
-API_SRCS-yes += aom_integer.h
diff --git a/third_party/aom/aom/aom_decoder.h b/third_party/aom/aom/aom_decoder.h
index ceab93453..3bbdcd7e2 100644
--- a/third_party/aom/aom/aom_decoder.h
+++ b/third_party/aom/aom/aom_decoder.h
@@ -30,8 +30,8 @@
extern "C" {
#endif
-#include "./aom_codec.h"
-#include "./aom_frame_buffer.h"
+#include "aom/aom_codec.h"
+#include "aom/aom_frame_buffer.h"
/*!\brief Current ABI version number
*
@@ -74,8 +74,6 @@ extern "C" {
/*!\brief The input frame should be passed to the decoder one fragment at a
* time */
#define AOM_CODEC_USE_INPUT_FRAGMENTS 0x40000
-/*!\brief Enable frame-based multi-threading */
-#define AOM_CODEC_USE_FRAME_THREADING 0x80000
/*!\brief Stream properties
*
@@ -83,9 +81,12 @@ extern "C" {
* stream.
*/
typedef struct aom_codec_stream_info {
- unsigned int w; /**< Width (or 0 for unknown/default) */
- unsigned int h; /**< Height (or 0 for unknown/default) */
- unsigned int is_kf; /**< Current frame is a keyframe */
+ unsigned int w; /**< Width (or 0 for unknown/default) */
+ unsigned int h; /**< Height (or 0 for unknown/default) */
+ unsigned int is_kf; /**< Current frame is a keyframe */
+ unsigned int number_spatial_layers; /**< Number of spatial layers */
+ unsigned int number_temporal_layers; /**< Number of temporal layers */
+ unsigned int is_annexb; /**< Is Bitstream in Annex-B format */
} aom_codec_stream_info_t;
/* REQUIRED FUNCTIONS
@@ -104,6 +105,7 @@ 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
@@ -149,7 +151,9 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
* \param[in] iface Pointer to the algorithm interface
* \param[in] data Pointer to a block of data to parse
* \param[in] data_sz Size of the data buffer
- * \param[in,out] si Pointer to stream info to update.
+ * \param[in,out] si Pointer to stream info to update. The is_annexb
+ * member \ref MUST be properly initialized. This
+ * function sets the rest of the members.
*
* \retval #AOM_CODEC_OK
* Bitstream is parsable and stream information updated.
@@ -160,8 +164,7 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
* buffer was too short.
*/
aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
- const uint8_t *data,
- unsigned int data_sz,
+ const uint8_t *data, size_t data_sz,
aom_codec_stream_info_t *si);
/*!\brief Return information about the current stream.
@@ -203,8 +206,6 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
* \param[in] data_sz Size of the coded data, in bytes.
* \param[in] user_priv Application specific data to associate with
* this frame.
- * \param[in] deadline Soft deadline the decoder should attempt to meet,
- * in us. Set to zero for unlimited.
*
* \return Returns #AOM_CODEC_OK if the coded data was processed completely
* and future pictures can be decoded without error. Otherwise,
@@ -212,8 +213,7 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
* for recoverability capabilities.
*/
aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data,
- unsigned int data_sz, void *user_priv,
- long deadline);
+ size_t data_sz, void *user_priv);
/*!\brief Decoded frames iterator
*
diff --git a/third_party/aom/aom/aom_encoder.h b/third_party/aom/aom/aom_encoder.h
index 208ba011f..6003088ed 100644
--- a/third_party/aom/aom/aom_encoder.h
+++ b/third_party/aom/aom/aom_encoder.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#include "./aom_codec.h"
+#include "aom/aom_codec.h"
/*!\brief Current ABI version number
*
@@ -159,6 +159,8 @@ typedef struct aom_codec_cx_pkt {
* Only applicable when "output partition" mode is enabled. First
* partition has id 0.*/
int partition_id;
+ /*!\brief size of the visible frame in this packet */
+ size_t vis_frame_size;
} frame; /**< data for compressed frame packet */
aom_fixed_buf_t twopass_stats; /**< data for two-pass packet */
aom_fixed_buf_t firstpass_mb_stats; /**< first pass mb packet */
@@ -282,6 +284,25 @@ typedef struct aom_codec_enc_cfg {
*/
unsigned int g_h;
+ /*!\brief Max number of frames to encode
+ *
+ */
+ unsigned int g_limit;
+
+ /*!\brief Forced maximum width of the frame
+ *
+ * If this value is non-zero then it is used to force the maximum frame
+ * width written in write_sequence_header().
+ */
+ unsigned int g_forced_max_frame_width;
+
+ /*!\brief Forced maximum height of the frame
+ *
+ * If this value is non-zero then it is used to force the maximum frame
+ * height written in write_sequence_header().
+ */
+ unsigned int g_forced_max_frame_height;
+
/*!\brief Bit-depth of the codec
*
* This value identifies the bit_depth of the codec,
@@ -586,6 +607,11 @@ typedef struct aom_codec_enc_cfg {
* keyframing settings (kf)
*/
+ /*!\brief Option to enable forward reference key frame
+ *
+ */
+ int fwd_kf_enabled;
+
/*!\brief Keyframe placement mode
*
* This value indicates whether the encoder should place keyframes at a
@@ -612,6 +638,28 @@ typedef struct aom_codec_enc_cfg {
*/
unsigned int kf_max_dist;
+ /*!\brief sframe interval
+ *
+ * This value, expressed as a number of frames, forces the encoder to code
+ * an S-Frame every sframe_dist frames.
+ */
+ unsigned int sframe_dist;
+
+ /*!\brief sframe insertion mode
+ *
+ * This value must be set to 1 or 2, and tells the encoder how to insert
+ * S-Frames. It will only have an effect if sframe_dist != 0.
+ *
+ * If altref is enabled:
+ * - if sframe_mode == 1, the considered frame will be made into an
+ * S-Frame only if it is an altref frame
+ * - if sframe_mode == 2, the next altref frame will be made into an
+ * S-Frame.
+ *
+ * Otherwise: the considered frame will be made into an S-Frame.
+ */
+ unsigned int sframe_mode;
+
/*!\brief Tile coding mode
*
* This value indicates the tile coding mode.
@@ -620,6 +668,30 @@ typedef struct aom_codec_enc_cfg {
*/
unsigned int large_scale_tile;
+ /*!\brief Monochrome mode
+ *
+ * If this is nonzero, the encoder will generate a monochrome stream
+ * with no chroma planes.
+ */
+ unsigned int monochrome;
+
+ /*!\brief full_still_picture_hdr
+ *
+ * If this is nonzero, the encoder will generate a full header even for
+ * still picture encoding. if zero, a reduced header is used for still
+ * picture. This flag has no effect when a regular video with more than
+ * a single frame is encoded.
+ */
+ unsigned int full_still_picture_hdr;
+
+ /*!\brief Bitstream syntax mode
+ *
+ * This value indicates the bitstream syntax mode.
+ * A value of 0 indicates bitstream is saved as Section 5 bitstream. A value
+ * of 1 indicates the bitstream is saved in Annex-B format
+ */
+ unsigned int save_as_annexb;
+
/*!\brief Number of explicit tile widths specified
*
* This value indicates the number of tile widths specified
@@ -661,6 +733,11 @@ typedef struct aom_codec_enc_cfg {
* The number of heights specified is given by tile_height_count
*/
int tile_heights[MAX_TILE_HEIGHTS];
+
+ /*!\brief Options defined per config file
+ *
+ */
+ cfg_options_t cfg;
} aom_codec_enc_cfg_t; /**< alias for struct aom_codec_enc_cfg */
/*!\brief Initialize an encoder instance
@@ -782,23 +859,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 deadline parameter analogous to AVx GOOD QUALITY mode. */
-#define AOM_DL_GOOD_QUALITY (1000000)
/*!\brief Encode a frame
*
* Encodes a video frame at the given "presentation time." The presentation
* time stamp (PTS) \ref MUST be strictly increasing.
*
- * The encoder supports the notion of a soft real-time deadline. Given a
- * non-zero value to the deadline parameter, the encoder will make a "best
- * effort" guarantee to return before the given time slice expires. It is
- * implicit that limiting the available time to encode will degrade the
- * output quality. The encoder can be given an unlimited time to produce the
- * best possible frame by specifying a deadline of '0'. This deadline
- * supercedes the AVx notion of "best quality, good quality, realtime".
- * Applications that wish to map these former settings to the new deadline
- * based system can use the symbol #AOM_DL_GOOD_QUALITY.
- *
* When the last frame has been passed to the encoder, this function should
* continue to be called, with the img parameter set to NULL. This will
* signal the end-of-stream condition to the encoder and allow it to encode
@@ -810,7 +875,6 @@ aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx);
* \param[in] pts Presentation time stamp, in timebase units.
* \param[in] duration Duration to show frame, in timebase units.
* \param[in] flags Flags to use for encoding this frame.
- * \param[in] deadline Time to spend encoding, in microseconds. (0=infinite)
*
* \retval #AOM_CODEC_OK
* The configuration was populated.
@@ -821,8 +885,7 @@ aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx);
*/
aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img,
aom_codec_pts_t pts, unsigned long duration,
- aom_enc_frame_flags_t flags,
- unsigned long deadline);
+ aom_enc_frame_flags_t flags);
/*!\brief Set compressed data output buffer
*
diff --git a/third_party/aom/aom/aom_frame_buffer.h b/third_party/aom/aom/aom_frame_buffer.h
index c87cf749b..b979fcf2b 100644
--- a/third_party/aom/aom/aom_frame_buffer.h
+++ b/third_party/aom/aom/aom_frame_buffer.h
@@ -20,7 +20,7 @@
extern "C" {
#endif
-#include "./aom_integer.h"
+#include "aom/aom_integer.h"
/*!\brief The maximum number of work buffers used by libaom.
* Support maximum 4 threads to decode video in parallel.
diff --git a/third_party/aom/aom/aom_image.h b/third_party/aom/aom/aom_image.h
index 776794960..b01317b3f 100644
--- a/third_party/aom/aom/aom_image.h
+++ b/third_party/aom/aom/aom_image.h
@@ -20,6 +20,8 @@
extern "C" {
#endif
+#include "aom/aom_integer.h"
+
/*!\brief Current ABI version number
*
* \internal
@@ -38,19 +40,6 @@ extern "C" {
/*!\brief List of supported image formats */
typedef enum aom_img_fmt {
AOM_IMG_FMT_NONE,
- AOM_IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
- AOM_IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
- AOM_IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
- AOM_IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
- AOM_IMG_FMT_UYVY, /**< UYVY packed YUV */
- AOM_IMG_FMT_YUY2, /**< YUYV packed YUV */
- AOM_IMG_FMT_YVYU, /**< YVYU packed YUV */
- AOM_IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
- AOM_IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
- AOM_IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
- AOM_IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
- AOM_IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
- AOM_IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
AOM_IMG_FMT_YV12 =
AOM_IMG_FMT_PLANAR | AOM_IMG_FMT_UV_FLIP | 1, /**< planar YVU */
AOM_IMG_FMT_I420 = AOM_IMG_FMT_PLANAR | 2,
@@ -59,36 +48,79 @@ 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_I440 = AOM_IMG_FMT_PLANAR | 7,
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_I42216 = AOM_IMG_FMT_I422 | AOM_IMG_FMT_HIGHBITDEPTH,
AOM_IMG_FMT_I44416 = AOM_IMG_FMT_I444 | AOM_IMG_FMT_HIGHBITDEPTH,
- AOM_IMG_FMT_I44016 = AOM_IMG_FMT_I440 | AOM_IMG_FMT_HIGHBITDEPTH
} aom_img_fmt_t; /**< alias for enum aom_img_fmt */
-/*!\brief List of supported color spaces */
-typedef enum aom_color_space {
- AOM_CS_UNKNOWN = 0, /**< Unknown */
- AOM_CS_BT_601 = 1, /**< BT.601 */
- AOM_CS_BT_709 = 2, /**< BT.709 */
- AOM_CS_SMPTE_170 = 3, /**< SMPTE.170 */
- AOM_CS_SMPTE_240 = 4, /**< SMPTE.240 */
- AOM_CS_BT_2020_NCL = 5, /**< BT.2020 non-constant luminance (BT.2100) */
- AOM_CS_BT_2020_CL = 6, /**< BT.2020 constant luminance */
- AOM_CS_SRGB = 7, /**< sRGB */
- AOM_CS_ICTCP = 8, /**< ICtCp, ITU-R BT.2100 */
- AOM_CS_RESERVED = 9 /**< Values 9..31 are reserved */
-} aom_color_space_t; /**< alias for enum aom_color_space */
+/*!\brief List of supported color primaries */
+typedef enum aom_color_primaries {
+ AOM_CICP_CP_RESERVED_0 = 0, /**< For future use */
+ AOM_CICP_CP_BT_709 = 1, /**< BT.709 */
+ AOM_CICP_CP_UNSPECIFIED = 2, /**< Unspecified */
+ AOM_CICP_CP_RESERVED_3 = 3, /**< For future use */
+ AOM_CICP_CP_BT_470_M = 4, /**< BT.470 System M (historical) */
+ AOM_CICP_CP_BT_470_B_G = 5, /**< BT.470 System B, G (historical) */
+ AOM_CICP_CP_BT_601 = 6, /**< BT.601 */
+ AOM_CICP_CP_SMPTE_240 = 7, /**< SMPTE 240 */
+ AOM_CICP_CP_GENERIC_FILM =
+ 8, /**< Generic film (color filters using illuminant C) */
+ AOM_CICP_CP_BT_2020 = 9, /**< BT.2020, BT.2100 */
+ AOM_CICP_CP_XYZ = 10, /**< SMPTE 428 (CIE 1921 XYZ) */
+ AOM_CICP_CP_SMPTE_431 = 11, /**< SMPTE RP 431-2 */
+ AOM_CICP_CP_SMPTE_432 = 12, /**< SMPTE EG 432-1 */
+ AOM_CICP_CP_RESERVED_13 = 13, /**< For future use (values 13 - 21) */
+ AOM_CICP_CP_EBU_3213 = 22, /**< EBU Tech. 3213-E */
+ AOM_CICP_CP_RESERVED_23 = 23 /**< For future use (values 23 - 255) */
+} aom_color_primaries_t; /**< alias for enum aom_color_primaries */
/*!\brief List of supported transfer functions */
-typedef enum aom_transfer_function {
- AOM_TF_UNKNOWN = 0, /**< Unknown */
- AOM_TF_BT_709 = 1, /**< BT.709 */
- AOM_TF_PQ = 2, /**< PQ TF BT.2100 / ST.2084 */
- AOM_TF_HLG = 3, /**< Hybrid Log-Gamma */
- AOM_TF_RESERVED = 4 /**< Values 4..31 are reserved */
-} aom_transfer_function_t; /**< alias for enum aom_transfer_function */
+typedef enum aom_transfer_characteristics {
+ AOM_CICP_TC_RESERVED_0 = 0, /**< For future use */
+ AOM_CICP_TC_BT_709 = 1, /**< BT.709 */
+ AOM_CICP_TC_UNSPECIFIED = 2, /**< Unspecified */
+ AOM_CICP_TC_RESERVED_3 = 3, /**< For future use */
+ AOM_CICP_TC_BT_470_M = 4, /**< BT.470 System M (historical) */
+ AOM_CICP_TC_BT_470_B_G = 5, /**< BT.470 System B, G (historical) */
+ AOM_CICP_TC_BT_601 = 6, /**< BT.601 */
+ AOM_CICP_TC_SMPTE_240 = 7, /**< SMPTE 240 M */
+ AOM_CICP_TC_LINEAR = 8, /**< Linear */
+ AOM_CICP_TC_LOG_100 = 9, /**< Logarithmic (100 : 1 range) */
+ AOM_CICP_TC_LOG_100_SQRT10 =
+ 10, /**< Logarithmic (100 * Sqrt(10) : 1 range) */
+ AOM_CICP_TC_IEC_61966 = 11, /**< IEC 61966-2-4 */
+ AOM_CICP_TC_BT_1361 = 12, /**< BT.1361 */
+ AOM_CICP_TC_SRGB = 13, /**< sRGB or sYCC*/
+ AOM_CICP_TC_BT_2020_10_BIT = 14, /**< BT.2020 10-bit systems */
+ AOM_CICP_TC_BT_2020_12_BIT = 15, /**< BT.2020 12-bit systems */
+ AOM_CICP_TC_SMPTE_2084 = 16, /**< SMPTE ST 2084, ITU BT.2100 PQ */
+ AOM_CICP_TC_SMPTE_428 = 17, /**< SMPTE ST 428 */
+ AOM_CICP_TC_HLG = 18, /**< BT.2100 HLG, ARIB STD-B67 */
+ AOM_CICP_TC_RESERVED_19 = 19 /**< For future use (values 19-255) */
+} aom_transfer_characteristics_t; /**< alias for enum aom_transfer_function */
+
+/*!\brief List of supported matrix coefficients */
+typedef enum aom_matrix_coefficients {
+ AOM_CICP_MC_IDENTITY = 0, /**< Identity matrix */
+ AOM_CICP_MC_BT_709 = 1, /**< BT.709 */
+ AOM_CICP_MC_UNSPECIFIED = 2, /**< Unspecified */
+ AOM_CICP_MC_RESERVED_3 = 3, /**< For future use */
+ AOM_CICP_MC_FCC = 4, /**< US FCC 73.628 */
+ AOM_CICP_MC_BT_470_B_G = 5, /**< BT.470 System B, G (historical) */
+ AOM_CICP_MC_BT_601 = 6, /**< BT.601 */
+ AOM_CICP_MC_SMPTE_240 = 7, /**< SMPTE 240 M */
+ AOM_CICP_MC_SMPTE_YCGCO = 8, /**< YCgCo */
+ AOM_CICP_MC_BT_2020_NCL =
+ 9, /**< BT.2020 non-constant luminance, BT.2100 YCbCr */
+ AOM_CICP_MC_BT_2020_CL = 10, /**< BT.2020 constant luminance */
+ AOM_CICP_MC_SMPTE_2085 = 11, /**< SMPTE ST 2085 YDzDx */
+ AOM_CICP_MC_CHROMAT_NCL =
+ 12, /**< Chromaticity-derived non-constant luminance */
+ AOM_CICP_MC_CHROMAT_CL = 13, /**< Chromaticity-derived constant luminance */
+ AOM_CICP_MC_ICTCP = 14, /**< BT.2100 ICtCp */
+ AOM_CICP_MC_RESERVED_15 = 15 /**< For future use (values 15-255) */
+} aom_matrix_coefficients_t;
/*!\brief List of supported color range */
typedef enum aom_color_range {
@@ -107,11 +139,13 @@ typedef enum aom_chroma_sample_position {
/**\brief Image Descriptor */
typedef struct aom_image {
- aom_img_fmt_t fmt; /**< Image Format */
- aom_color_space_t cs; /**< Color Space */
- aom_transfer_function_t tf; /**< transfer function */
- aom_chroma_sample_position_t csp; /**< chroma sample position */
- aom_color_range_t range; /**< Color Range */
+ aom_img_fmt_t fmt; /**< Image Format */
+ aom_color_primaries_t cp; /**< CICP Color Primaries */
+ aom_transfer_characteristics_t tc; /**< CICP Transfer Characteristics */
+ aom_matrix_coefficients_t mc; /**< CICP Matrix Coefficients */
+ int monochrome; /**< Whether image is monochrome */
+ aom_chroma_sample_position_t csp; /**< chroma sample position */
+ aom_color_range_t range; /**< Color Range */
/* Image storage dimensions */
unsigned int w; /**< Stored image width */
@@ -138,9 +172,13 @@ typedef struct aom_image {
#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 */
+ size_t sz; /**< data size */
int bps; /**< bits per sample (for packed formats) */
+ int temporal_id; /**< Temporal layer Id of image */
+ int spatial_id; /**< Spatial layer Id of image */
+
/*!\brief The following member may be set by the application to associate
* data with this image.
*/
@@ -207,6 +245,33 @@ 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 align,
unsigned char *img_data);
+/*!\brief Open a descriptor, allocating storage for the underlying image with a
+ * 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.
+ *
+ * \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] size_align Alignment, in bytes, 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
+ * parameter is non-null, the value of the img parameter will be
+ * returned.
+ */
+aom_image_t *aom_img_alloc_with_border(aom_image_t *img, aom_img_fmt_t fmt,
+ unsigned int d_w, unsigned int d_h,
+ unsigned int align,
+ unsigned int size_align,
+ unsigned int border);
+
/*!\brief Set the rectangle identifying the displayed portion of the image
*
* Updates the displayed rectangle (aka viewport) on the image surface to
@@ -217,11 +282,12 @@ aom_image_t *aom_img_wrap(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w,
* \param[in] y topmost row
* \param[in] w width
* \param[in] h height
+ * \param[in] border A border that is padded on four sides of the image.
*
* \return 0 if the requested rectangle is valid, nonzero otherwise.
*/
int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y,
- unsigned int w, unsigned int h);
+ unsigned int w, unsigned int h, unsigned int border);
/*!\brief Flip the image vertically (top for bottom)
*
diff --git a/third_party/aom/aom/aom_integer.h b/third_party/aom/aom/aom_integer.h
index bd1fe270b..907d4cbec 100644
--- a/third_party/aom/aom/aom_integer.h
+++ b/third_party/aom/aom/aom_integer.h
@@ -8,7 +8,6 @@
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-
#ifndef AOM_AOM_INTEGER_H_
#define AOM_AOM_INTEGER_H_
@@ -61,6 +60,47 @@ typedef size_t uintptr_t;
#include <inttypes.h>
#endif
+#if !defined(INT8_MAX)
+#define INT8_MAX 127
+#endif
+
+#if !defined(INT32_MAX)
+#define INT32_MAX 2147483647
+#endif
+
+#if !defined(INT32_MIN)
+#define INT32_MIN (-2147483647 - 1)
+#endif
+
#define NELEMENTS(x) (int)(sizeof(x) / sizeof(x[0]))
+#if defined(__cplusplus)
+extern "C" {
+#endif // __cplusplus
+
+// Returns size of uint64_t when encoded using LEB128.
+size_t aom_uleb_size_in_bytes(uint64_t value);
+
+// Returns 0 on success, -1 on decode failure.
+// On success, 'value' stores the decoded LEB128 value and 'length' stores
+// the number of bytes decoded.
+int aom_uleb_decode(const uint8_t *buffer, size_t available, uint64_t *value,
+ size_t *length);
+
+// Encodes LEB128 integer. Returns 0 when successful, and -1 upon failure.
+int aom_uleb_encode(uint64_t value, size_t available, uint8_t *coded_value,
+ size_t *coded_size);
+
+// Encodes LEB128 integer to size specified. Returns 0 when successful, and -1
+// upon failure.
+// Note: This will write exactly pad_to_size bytes; if the value cannot be
+// encoded in this many bytes, then this will fail.
+int aom_uleb_encode_fixed_size(uint64_t value, size_t available,
+ size_t pad_to_size, uint8_t *coded_value,
+ size_t *coded_size);
+
+#if defined(__cplusplus)
+} // extern "C"
+#endif // __cplusplus
+
#endif // AOM_AOM_INTEGER_H_
diff --git a/third_party/aom/aom/aomcx.h b/third_party/aom/aom/aomcx.h
index e573f986d..4cdb5d332 100644
--- a/third_party/aom/aom/aomcx.h
+++ b/third_party/aom/aom/aomcx.h
@@ -16,8 +16,8 @@
*
* @{
*/
-#include "./aom.h"
-#include "./aom_encoder.h"
+#include "aom/aom.h"
+#include "aom/aom_encoder.h"
/*!\file
* \brief Provides definitions for using AOM or AV1 encoder algorithm within the
@@ -48,14 +48,27 @@ extern aom_codec_iface_t *aom_codec_av1_cx(void);
* last frame or not automatically.
*/
#define AOM_EFLAG_NO_REF_LAST (1 << 16)
-
+/*!\brief Don't reference the last2 frame
+ *
+ * When this flag is set, the encoder will not use the last2 frame as a
+ * predictor. When not set, the encoder will choose whether to use the
+ * last2 frame or not automatically.
+ */
+#define AOM_EFLAG_NO_REF_LAST2 (1 << 17)
+/*!\brief Don't reference the last3 frame
+ *
+ * When this flag is set, the encoder will not use the last3 frame as a
+ * predictor. When not set, the encoder will choose whether to use the
+ * last3 frame or not automatically.
+ */
+#define AOM_EFLAG_NO_REF_LAST3 (1 << 18)
/*!\brief Don't reference the golden frame
*
* When this flag is set, the encoder will not use the golden frame as a
* predictor. When not set, the encoder will choose whether to use the
* golden frame or not automatically.
*/
-#define AOM_EFLAG_NO_REF_GF (1 << 17)
+#define AOM_EFLAG_NO_REF_GF (1 << 19)
/*!\brief Don't reference the alternate reference frame
*
@@ -63,49 +76,72 @@ extern aom_codec_iface_t *aom_codec_av1_cx(void);
* predictor. When not set, the encoder will choose whether to use the
* alt ref frame or not automatically.
*/
-#define AOM_EFLAG_NO_REF_ARF (1 << 21)
+#define AOM_EFLAG_NO_REF_ARF (1 << 20)
+/*!\brief Don't reference the bwd reference frame
+ *
+ * When this flag is set, the encoder will not use the bwd ref frame as a
+ * predictor. When not set, the encoder will choose whether to use the
+ * bwd ref frame or not automatically.
+ */
+#define AOM_EFLAG_NO_REF_BWD (1 << 21)
+/*!\brief Don't reference the alt2 reference frame
+ *
+ * When this flag is set, the encoder will not use the alt2 ref frame as a
+ * predictor. When not set, the encoder will choose whether to use the
+ * alt2 ref frame or not automatically.
+ */
+#define AOM_EFLAG_NO_REF_ARF2 (1 << 22)
/*!\brief Don't update the last frame
*
* When this flag is set, the encoder will not update the last frame with
* the contents of the current frame.
*/
-#define AOM_EFLAG_NO_UPD_LAST (1 << 18)
+#define AOM_EFLAG_NO_UPD_LAST (1 << 23)
/*!\brief Don't update the golden frame
*
* When this flag is set, the encoder will not update the golden frame with
* the contents of the current frame.
*/
-#define AOM_EFLAG_NO_UPD_GF (1 << 22)
+#define AOM_EFLAG_NO_UPD_GF (1 << 24)
/*!\brief Don't update the alternate reference frame
*
* When this flag is set, the encoder will not update the alt ref frame with
* the contents of the current frame.
*/
-#define AOM_EFLAG_NO_UPD_ARF (1 << 23)
-
-/*!\brief Force golden frame update
+#define AOM_EFLAG_NO_UPD_ARF (1 << 25)
+/*!\brief Disable entropy update
*
- * When this flag is set, the encoder copy the contents of the current frame
- * to the golden frame buffer.
+ * When this flag is set, the encoder will not update its internal entropy
+ * model based on the entropy of this frame.
*/
-#define AOM_EFLAG_FORCE_GF (1 << 19)
-
-/*!\brief Force alternate reference frame update
+#define AOM_EFLAG_NO_UPD_ENTROPY (1 << 26)
+/*!\brief Disable ref frame mvs
*
- * When this flag is set, the encoder copy the contents of the current frame
- * to the alternate reference frame buffer.
+ * When this flag is set, the encoder will not allow frames to
+ * be encoded using mfmv.
*/
-#define AOM_EFLAG_FORCE_ARF (1 << 24)
-
-/*!\brief Disable entropy update
+#define AOM_EFLAG_NO_REF_FRAME_MVS (1 << 27)
+/*!\brief Enable error resilient frame
*
- * When this flag is set, the encoder will not update its internal entropy
- * model based on the entropy of this frame.
+ * When this flag is set, the encoder will code frames as error
+ * resilient.
+ */
+#define AOM_EFLAG_ERROR_RESILIENT (1 << 28)
+/*!\brief Enable s frame mode
+ *
+ * When this flag is set, the encoder will code frames as an
+ * s frame.
+ */
+#define AOM_EFLAG_SET_S_FRAME (1 << 29)
+/*!\brief Force primary_ref_frame to PRIMARY_REF_NONE
+ *
+ * When this flag is set, the encoder will set a frame's primary_ref_frame
+ * to PRIMARY_REF_NONE
*/
-#define AOM_EFLAG_NO_UPD_ENTROPY (1 << 20)
+#define AOM_EFLAG_SET_PRIMARY_REF_NONE (1 << 30)
/*!\brief AVx encoder control functions
*
@@ -131,6 +167,10 @@ enum aome_enc_control_id {
*/
AOME_SET_SCALEMODE = 11,
+ /*!\brief Codec control function to set encoder spatial layer id.
+ */
+ AOME_SET_SPATIAL_LAYER_ID = 12,
+
/*!\brief Codec control function to set encoder internal speed settings.
*
* Changes in this value influences, among others, the encoder's selection
@@ -141,6 +181,10 @@ enum aome_enc_control_id {
*/
AOME_SET_CPUUSED = 13,
+ /*!\brief Speed features for codec development
+ */
+ AOME_SET_DEVSF,
+
/*!\brief Codec control function to enable automatic set and use alf frames.
*/
AOME_SET_ENABLEAUTOALTREF,
@@ -199,6 +243,10 @@ enum aome_enc_control_id {
*/
AOME_SET_MAX_INTRA_BITRATE_PCT,
+ /*!\brief Codec control function to set number of spatial layers.
+ */
+ AOME_SET_NUMBER_SPATIAL_LAYERS,
+
/*!\brief Codec control function to set max data rate for Inter frames.
*
* This value controls additional clamping on the maximum size of an
@@ -289,6 +337,26 @@ enum aome_enc_control_id {
*/
AV1E_SET_FRAME_PARALLEL_DECODING,
+ /*!\brief Codec control function to enable error_resilient_mode
+ *
+ * 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.
+ */
+ AV1E_SET_ERROR_RESILIENT_MODE,
+
+ /*!\brief Codec control function to enable s_frame_mode
+ *
+ * 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.
+ */
+ AV1E_SET_S_FRAME_MODE,
+
/*!\brief Codec control function to set adaptive quantization mode.
*
* AV1 has a segment based feature that allows encoder to adaptively change
@@ -326,30 +394,82 @@ enum aome_enc_control_id {
*/
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..9, default is "UNKNOWN".
- * 0 = UNKNOWN,
- * 1 = BT_601
- * 2 = BT_709
- * 3 = SMPTE_170
- * 4 = SMPTE_240
- * 5 = BT_2020_NCL
- * 6 = BT_2020_CL
- * 7 = SRGB
- * 8 = ICtCp
- * 9 = RESERVED
- */
- AV1E_SET_COLOR_SPACE,
+ * \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..4, default is "UNKNOWN".
- * 0 = UNKNOWN,
- * 1 = BT_709
- * 2 = PQ
- * 3 = HLG
- * 4 = RESERVED
+ * \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_TRANSFER_FUNCTION,
+ 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".
@@ -412,10 +532,43 @@ enum aome_enc_control_id {
/*!\brief Codec control function to enable automatic set and use
* bwd-pred frames.
*
- * Experiment: EXT_REFS
*/
AOME_SET_ENABLEAUTOBWDREF,
+ /*!\brief Codec control function to encode with CDEF.
+ *
+ * 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
+ */
+ AV1E_SET_ENABLE_CDEF,
+
+ /*!\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.
+ *
+ */
+ AV1E_SET_ENABLE_RESTORATION,
+
+ /*!\brief Codec control function to encode without trellis quantization.
+ *
+ * 0 = apply trellis quantization
+ * 1 = do not apply trellis quantization
+ *
+ * By default, the encoder applies trellis optimization on quantized
+ * coefficients.
+ *
+ */
+ AV1E_SET_DISABLE_TRELLIS_QUANT,
+
/*!\brief Codec control function to encode with quantisation matrices.
*
* AOM can operate with default quantisation matrices dependent on
@@ -427,6 +580,7 @@ enum aome_enc_control_id {
*
* Experiment: AOM_QM
*/
+
AV1E_SET_ENABLE_QM,
/*!\brief Codec control function to set the min quant matrix flatness.
@@ -456,6 +610,45 @@ enum aome_enc_control_id {
*/
AV1E_SET_QM_MAX,
+ /*!\brief Codec control function to set the min quant matrix flatness.
+ *
+ * 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
+ */
+ AV1E_SET_QM_Y,
+
+ /*!\brief Codec control function to set the min quant matrix flatness.
+ *
+ * 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
+ */
+ AV1E_SET_QM_U,
+
+ /*!\brief Codec control function to set the min quant matrix flatness.
+ *
+ * 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
+ */
+ AV1E_SET_QM_V,
+
/*!\brief Codec control function to encode with dist_8x8.
*
* The dist_8x8 is enabled automatically for model tuning parameters that
@@ -493,15 +686,15 @@ enum aome_enc_control_id {
AV1E_SET_MTU,
/*!\brief Codec control function to set dependent_horz_tiles.
- *
- * 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,
- *
- * By default, the value is 0, i.e. disable dependent horizontal tile.
- */
+ *
+ * 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,
+ *
+ * By default, the value is 0, i.e. disable dependent horizontal tile.
+ */
AV1E_SET_TILE_DEPENDENT_ROWS,
/*!\brief Codec control function to set the number of symbols in an ANS data
@@ -516,14 +709,91 @@ enum aome_enc_control_id {
*/
AV1E_SET_ANS_WINDOW_SIZE_LOG2,
+ /*!\brief Codec control function to turn on / off dual filter
+ * enabling/disabling.
+ *
+ * This will enable or disable dual filter. The default value is 1
+ *
+ */
+ AV1E_SET_ENABLE_DF,
+
+ /*!\brief Codec control function to turn on / off frame order hint for a
+ * few tools:
+ *
+ * joint compound mode
+ * motion field motion vector
+ * ref frame sign bias
+ *
+ * The default value is 1.
+ *
+ */
+ AV1E_SET_ENABLE_ORDER_HINT,
+
+ /*!\brief Codec control function to turn on / off joint compound mode
+ * at sequence level.
+ *
+ * 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.
+ *
+ */
+ AV1E_SET_ENABLE_JNT_COMP,
+
+ /*!\brief Codec control function to turn on / off ref frame mvs (mfmv) usage
+ * at sequence level.
+ *
+ * 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.
+ *
+ */
+ AV1E_SET_ENABLE_REF_FRAME_MVS,
+
/*!\brief Codec control function to set temporal mv prediction
- * enabling/disabling.
- *
- * This will enable or disable temporal mv predicton. The default value is 0.
- *
- * Experiment: TEMPMV_SIGNALING
- */
- AV1E_SET_DISABLE_TEMPMV,
+ * enabling/disabling at frame level.
+ *
+ * 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.
+ *
+ */
+ AV1E_SET_ALLOW_REF_FRAME_MVS,
+
+ /*!\brief Codec control function to turn on / off warped motion usage
+ * at sequence level.
+ *
+ * This will enable or disable usage of warped motion. The default value is 1.
+ *
+ */
+ AV1E_SET_ENABLE_WARPED_MOTION,
+
+ /*!\brief Codec control function to turn on / off warped motion usage
+ * at frame level.
+ *
+ * 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.
+ *
+ */
+ AV1E_SET_ALLOW_WARPED_MOTION,
+
+ /*!\brief Codec control function to turn on / off frame superresolution.
+ *
+ * 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.
+ */
+ AV1E_SET_ENABLE_SUPERRES,
+
+ /*!\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
+ *
+ * By default, the value is 1, i.e. enable loop filter across tile boundary.
+ *
+ * Experiment: LOOPFILTERING_ACROSS_TILES_EXT
+ */
+ AV1E_SET_TILE_LOOPFILTER_V,
+ AV1E_SET_TILE_LOOPFILTER_H,
/*!\brief Codec control function to set loop_filter_across_tiles_enabled.
*
@@ -540,15 +810,15 @@ enum aome_enc_control_id {
AV1E_SET_TILE_LOOPFILTER,
/*!\brief Codec control function to set the delta q mode
- *
- * 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.
- *
- * By default, encoder operates with DELTAQ_Mode 0(deltaq signaling off).
- */
+ *
+ * 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.
+ *
+ * By default, encoder operates with DELTAQ_Mode 0(deltaq signaling off).
+ */
AV1E_SET_DELTAQ_MODE,
/*!\brief Codec control function to set the single tile decoding mode to 0 or
@@ -567,6 +837,23 @@ enum aome_enc_control_id {
* 0 : off, 1 : MAX_EXTREME_MV, 2 : MIN_EXTREME_MV
*/
AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST,
+
+ /*!\brief Codec control function to signal picture timing info in the
+ * bitstream. \note Valid ranges: 0..1, default is "UNKNOWN". 0 = UNKNOWN, 1 =
+ * EQUAL
+ */
+ AV1E_SET_TIMING_INFO_TYPE,
+
+ /*!\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
+ */
+ AV1E_SET_FILM_GRAIN_TEST_VECTOR,
+
+ /*!\brief Codec control function to set the path to the film grain parameters
+ */
+ AV1E_SET_FILM_GRAIN_TABLE,
};
/*!\brief aom 1-D scaling mode
@@ -637,6 +924,13 @@ typedef enum {
AOM_CONTENT_INVALID
} aom_tune_content;
+/*!brief AV1 encoder timing info type signaling */
+typedef enum {
+ AOM_TIMING_UNSPECIFIED,
+ AOM_TIMING_EQUAL,
+ AOM_TIMING_DEC_MODEL
+} aom_timing_info_type_t;
+
/*!\brief Model tuning parameters
*
* Changes the encoder to tune for certain types of input material.
@@ -645,10 +939,8 @@ typedef enum {
typedef enum {
AOM_TUNE_PSNR,
AOM_TUNE_SSIM,
-#ifdef CONFIG_DIST_8X8
AOM_TUNE_CDEF_DIST,
AOM_TUNE_DAALA_DIST
-#endif
} aom_tune_metric;
/*!\cond */
@@ -668,8 +960,13 @@ AOM_CTRL_USE_TYPE(AOME_SET_ACTIVEMAP, aom_active_map_t *)
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)
+#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
@@ -698,6 +995,10 @@ AOM_CTRL_USE_TYPE(AV1E_SET_TILE_ROWS, int)
AOM_CTRL_USE_TYPE(AV1E_SET_TILE_DEPENDENT_ROWS, int)
#define AOM_CTRL_AV1E_SET_TILE_DEPENDENT_ROWS
+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
@@ -711,12 +1012,24 @@ AOM_CTRL_USE_TYPE(AOME_SET_MAX_INTRA_BITRATE_PCT, unsigned int)
AOM_CTRL_USE_TYPE(AOME_SET_MAX_INTER_BITRATE_PCT, unsigned int)
#define AOM_CTRL_AOME_SET_MAX_INTER_BITRATE_PCT
+AOM_CTRL_USE_TYPE(AOME_SET_NUMBER_SPATIAL_LAYERS, int)
+#define AOME_CTRL_AOME_SET_NUMBER_SPATIAL_LAYERS
+
AOM_CTRL_USE_TYPE(AV1E_SET_GF_CBR_BOOST_PCT, unsigned int)
#define AOM_CTRL_AV1E_SET_GF_CBR_BOOST_PCT
AOM_CTRL_USE_TYPE(AV1E_SET_LOSSLESS, unsigned int)
#define AOM_CTRL_AV1E_SET_LOSSLESS
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_CDEF, unsigned int)
+#define AOM_CTRL_AV1E_SET_ENABLE_CDEF
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_RESTORATION, unsigned int)
+#define AOM_CTRL_AV1E_SET_ENABLE_RESTORATION
+
+AOM_CTRL_USE_TYPE(AV1E_SET_DISABLE_TRELLIS_QUANT, unsigned int)
+#define AOM_CTRL_AV1E_SET_DISABLE_TRELLIS_QUANT
+
AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_QM, unsigned int)
#define AOM_CTRL_AV1E_SET_ENABLE_QM
@@ -729,17 +1042,56 @@ AOM_CTRL_USE_TYPE(AV1E_SET_QM_MIN, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_QM_MAX, unsigned int)
#define AOM_CTRL_AV1E_SET_QM_MAX
+AOM_CTRL_USE_TYPE(AV1E_SET_QM_Y, unsigned int)
+#define AOM_CTRL_AV1E_SET_QM_Y
+
+AOM_CTRL_USE_TYPE(AV1E_SET_QM_U, unsigned int)
+#define AOM_CTRL_AV1E_SET_QM_U
+
+AOM_CTRL_USE_TYPE(AV1E_SET_QM_V, unsigned int)
+#define AOM_CTRL_AV1E_SET_QM_V
+
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_DISABLE_TEMPMV, unsigned int)
-#define AOM_CTRL_AV1E_SET_DISABLE_TEMPMV
+AOM_CTRL_USE_TYPE(AV1E_SET_TIMING_INFO_TYPE, 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_ORDER_HINT, unsigned 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_REF_FRAME_MVS, unsigned int)
+#define AOM_CTRL_AV1E_SET_ENABLE_REF_FRAME_MVS
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ALLOW_REF_FRAME_MVS, unsigned int)
+#define AOM_CTRL_AV1E_SET_ALLOW_REF_FRAME_MVS
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_WARPED_MOTION, unsigned int)
+#define AOM_CTRL_AV1E_SET_ENABLE_WARPED_MOTION
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ALLOW_WARPED_MOTION, unsigned int)
+#define AOM_CTRL_AV1E_SET_ALLOW_WARPED_MOTION
+
+AOM_CTRL_USE_TYPE(AV1E_SET_ENABLE_SUPERRES, unsigned int)
+#define AOM_CTRL_AV1E_SET_ENABLE_SUPERRES
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)
+#define AOM_CTRL_AV1E_SET_ERROR_RESILIENT_MODE
+
+AOM_CTRL_USE_TYPE(AV1E_SET_S_FRAME_MODE, unsigned int)
+#define AOM_CTRL_AV1E_SET_S_FRAME_MODE
+
AOM_CTRL_USE_TYPE(AV1E_SET_AQ_MODE, unsigned int)
#define AOM_CTRL_AV1E_SET_AQ_MODE
@@ -755,11 +1107,14 @@ AOM_CTRL_USE_TYPE(AV1E_SET_NOISE_SENSITIVITY, unsigned int)
AOM_CTRL_USE_TYPE(AV1E_SET_TUNE_CONTENT, int) /* aom_tune_content */
#define AOM_CTRL_AV1E_SET_TUNE_CONTENT
-AOM_CTRL_USE_TYPE(AV1E_SET_COLOR_SPACE, int)
-#define AOM_CTRL_AV1E_SET_COLOR_SPACE
+AOM_CTRL_USE_TYPE(AV1E_SET_COLOR_PRIMARIES, int)
+#define AOM_CTRL_AV1E_SET_COLOR_PRIMARIES
+
+AOM_CTRL_USE_TYPE(AV1E_SET_TRANSFER_CHARACTERISTICS, int)
+#define AOM_CTRL_AV1E_SET_TRANSFER_CHARACTERISTICS
-AOM_CTRL_USE_TYPE(AV1E_SET_TRANSFER_FUNCTION, int)
-#define AOM_CTRL_AV1E_SET_TRANSFER_FUNCTION
+AOM_CTRL_USE_TYPE(AV1E_SET_MATRIX_COEFFICIENTS, int)
+#define AOM_CTRL_AV1E_SET_MATRIX_COEFFICIENTS
AOM_CTRL_USE_TYPE(AV1E_SET_CHROMA_SAMPLE_POSITION, int)
#define AOM_CTRL_AV1E_SET_CHROMA_SAMPLE_POSITION
@@ -801,6 +1156,15 @@ 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)
+#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)
+#define AOM_CTRL_AV1E_SET_CDF_UPDATE_MODE
+
/*!\endcond */
/*! @} - end defgroup aom_encoder */
#ifdef __cplusplus
diff --git a/third_party/aom/aom/aomdx.h b/third_party/aom/aom/aomdx.h
index 4ca1c7285..7ff21a59b 100644
--- a/third_party/aom/aom/aomdx.h
+++ b/third_party/aom/aom/aomdx.h
@@ -26,7 +26,7 @@ extern "C" {
#endif
/* Include controls common to both the encoder and decoder */
-#include "./aom.h"
+#include "aom/aom.h"
/*!\name Algorithm interface for AV1
*
@@ -37,11 +37,9 @@ extern aom_codec_iface_t aom_codec_av1_dx_algo;
extern aom_codec_iface_t *aom_codec_av1_dx(void);
/*!@} - end algorithm interface member group*/
-#ifndef AOM_ACCOUNTING_H_
/** Data structure that stores bit accounting for debug
*/
typedef struct Accounting Accounting;
-#endif
#ifndef AOM_INSPECTION_H_
/** Callback that inspects decoder frame data.
@@ -62,6 +60,30 @@ typedef struct aom_inspect_init {
void *inspect_ctx;
} aom_inspect_init;
+/*!\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.
+ */
+typedef struct aom_tile_data {
+ /*! Tile data size. */
+ size_t coded_tile_data_size;
+ /*! Tile's start address. */
+ const void *coded_tile_data;
+ /*! Extra size information. */
+ size_t extra_size;
+} aom_tile_data;
+
+/*!\brief Structure to hold the external reference frame pointer.
+ *
+ * Define a structure to hold the external reference frame pointer.
+ */
+typedef struct av1_ext_ref_frame {
+ /*! Start pointer of external references. */
+ aom_image_t *img;
+ /*! Number of available external references. */
+ int num;
+} av1_ext_ref_frame_t;
+
/*!\enum aom_dec_control_id
* \brief AOM decoder control functions
*
@@ -84,13 +106,6 @@ enum aom_dec_control_id {
*/
AOMD_GET_LAST_REF_USED,
- /** decryption function to decrypt encoded buffer data immediately
- * before decoding. Takes a aom_decrypt_init, which contains
- * a callback function and opaque context pointer.
- */
- AOMD_SET_DECRYPTOR,
- // AOMD_SET_DECRYPTOR = AOMD_SET_DECRYPTOR,
-
/** 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). */
@@ -149,6 +164,50 @@ enum aom_dec_control_id {
*/
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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ AV1D_SET_EXT_REF_PTR,
+ /** control function to enable the ext-tile software debug and testing code in
+ * the decoder.
+ */
+ AV1D_EXT_TILE_DEBUG,
+
+ /** control function to indicate whether bitstream is in Annex-B format. */
+ 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).
+ */
+ 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.
+ */
+ 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
@@ -159,24 +218,6 @@ enum aom_dec_control_id {
AOM_DECODER_CTRL_ID_MAX,
};
-/** Decrypt n bytes of data from input -> output, using the decrypt_state
- * passed in AOMD_SET_DECRYPTOR.
- */
-typedef void (*aom_decrypt_cb)(void *decrypt_state, const unsigned char *input,
- unsigned char *output, int count);
-
-/*!\brief Structure to hold decryption state
- *
- * Defines a structure to hold the decryption state and access function.
- */
-typedef struct aom_decrypt_init {
- /*! Decrypt callback. */
- aom_decrypt_cb decrypt_cb;
-
- /*! Decryption state. */
- void *decrypt_state;
-} aom_decrypt_init;
-
/*!\cond */
/*!\brief AOM decoder control function parameter type
*
@@ -193,10 +234,6 @@ 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(AOMD_SET_DECRYPTOR, aom_decrypt_init *)
-#define AOM_CTRL_AOMD_SET_DECRYPTOR
-// AOM_CTRL_USE_TYPE(AOMD_SET_DECRYPTOR, aom_decrypt_init *)
-//#define AOM_CTRL_AOMD_SET_DECRYPTOR
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 *)
@@ -211,6 +248,22 @@ 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_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/third_party/aom/aom/exports_com b/third_party/aom/aom/exports_com
index 897b712a7..a87a4536c 100644
--- a/third_party/aom/aom/exports_com
+++ b/third_party/aom/aom/exports_com
@@ -16,3 +16,8 @@ text aom_img_plane_width
text aom_img_plane_height
text aom_img_set_rect
text aom_img_wrap
+text aom_img_alloc_with_border
+text aom_uleb_decode
+text aom_uleb_encode
+text aom_uleb_encode_fixed_size
+text aom_uleb_size_in_bytes
diff --git a/third_party/aom/aom/internal/aom_codec_internal.h b/third_party/aom/aom/internal/aom_codec_internal.h
index 5aacef7ad..84ea4eefa 100644
--- a/third_party/aom/aom/internal/aom_codec_internal.h
+++ b/third_party/aom/aom/internal/aom_codec_internal.h
@@ -104,16 +104,15 @@ typedef aom_codec_err_t (*aom_codec_destroy_fn_t)(aom_codec_alg_priv_t *ctx);
*
* \param[in] data Pointer to a block of data to parse
* \param[in] data_sz Size of the data buffer
- * \param[in,out] si Pointer to stream info to update. The size member
- * \ref MUST be properly initialized, but \ref MAY be
- * clobbered by the algorithm. This parameter \ref MAY
- * be NULL.
+ * \param[in,out] si Pointer to stream info to update. The is_annexb
+ * member \ref MUST be properly initialized. This
+ * function sets the rest of the members.
*
* \retval #AOM_CODEC_OK
* Bitstream is parsable and stream information updated
*/
typedef aom_codec_err_t (*aom_codec_peek_si_fn_t)(const uint8_t *data,
- unsigned int data_sz,
+ size_t data_sz,
aom_codec_stream_info_t *si);
/*!\brief Return information about the current stream.
@@ -121,10 +120,7 @@ typedef aom_codec_err_t (*aom_codec_peek_si_fn_t)(const uint8_t *data,
* Returns information about the stream that has been parsed during decoding.
*
* \param[in] ctx Pointer to this instance's context
- * \param[in,out] si Pointer to stream info to update. The size member
- * \ref MUST be properly initialized, but \ref MAY be
- * clobbered by the algorithm. This parameter \ref MAY
- * be NULL.
+ * \param[in,out] si Pointer to stream info to update
*
* \retval #AOM_CODEC_OK
* Bitstream is parsable and stream information updated
@@ -195,9 +191,8 @@ typedef const struct aom_codec_ctrl_fn_map {
*/
typedef aom_codec_err_t (*aom_codec_decode_fn_t)(aom_codec_alg_priv_t *ctx,
const uint8_t *data,
- unsigned int data_sz,
- void *user_priv,
- long deadline);
+ size_t data_sz,
+ void *user_priv);
/*!\brief Decoded frames iterator
*
@@ -252,8 +247,7 @@ typedef aom_codec_err_t (*aom_codec_encode_fn_t)(aom_codec_alg_priv_t *ctx,
const aom_image_t *img,
aom_codec_pts_t pts,
unsigned long duration,
- aom_enc_frame_flags_t flags,
- unsigned long deadline);
+ aom_enc_frame_flags_t flags);
typedef const aom_codec_cx_pkt_t *(*aom_codec_get_cx_data_fn_t)(
aom_codec_alg_priv_t *ctx, aom_codec_iter_t *iter);
diff --git a/third_party/aom/aom/src/aom_codec.c b/third_party/aom/aom/src/aom_codec.c
index 873d75876..733bffb25 100644
--- a/third_party/aom/aom/src/aom_codec.c
+++ b/third_party/aom/aom/src/aom_codec.c
@@ -15,9 +15,12 @@
*/
#include <stdarg.h>
#include <stdlib.h>
+
+#include "config/aom_config.h"
+#include "config/aom_version.h"
+
#include "aom/aom_integer.h"
#include "aom/internal/aom_codec_internal.h"
-#include "aom_version.h"
#define SAVE_STATUS(ctx, var) (ctx ? (ctx->err = var) : var)
@@ -136,3 +139,19 @@ void aom_internal_error(struct aom_internal_error_info *info,
void aom_merge_corrupted_flag(int *corrupted, int value) {
*corrupted |= value;
}
+
+const char *aom_obu_type_to_string(OBU_TYPE type) {
+ switch (type) {
+ case OBU_SEQUENCE_HEADER: return "OBU_SEQUENCE_HEADER";
+ case OBU_TEMPORAL_DELIMITER: return "OBU_TEMPORAL_DELIMITER";
+ case OBU_FRAME_HEADER: return "OBU_FRAME_HEADER";
+ case OBU_REDUNDANT_FRAME_HEADER: return "OBU_REDUNDANT_FRAME_HEADER";
+ case OBU_FRAME: return "OBU_FRAME";
+ case OBU_TILE_GROUP: return "OBU_TILE_GROUP";
+ case OBU_METADATA: return "OBU_METADATA";
+ case OBU_TILE_LIST: return "OBU_TILE_LIST";
+ case OBU_PADDING: return "OBU_PADDING";
+ default: break;
+ }
+ return "<Invalid OBU Type>";
+}
diff --git a/third_party/aom/aom/src/aom_decoder.c b/third_party/aom/aom/src/aom_decoder.c
index 75eb81089..e0cec10b6 100644
--- a/third_party/aom/aom/src/aom_decoder.c
+++ b/third_party/aom/aom/src/aom_decoder.c
@@ -61,8 +61,7 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
}
aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
- const uint8_t *data,
- unsigned int data_sz,
+ const uint8_t *data, size_t data_sz,
aom_codec_stream_info_t *si) {
aom_codec_err_t res;
@@ -99,8 +98,7 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
}
aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data,
- unsigned int data_sz, void *user_priv,
- long deadline) {
+ size_t data_sz, void *user_priv) {
aom_codec_err_t res;
/* Sanity checks */
@@ -110,8 +108,7 @@ aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data,
else if (!ctx->iface || !ctx->priv)
res = AOM_CODEC_ERROR;
else {
- res = ctx->iface->dec.decode(get_alg_priv(ctx), data, data_sz, user_priv,
- deadline);
+ res = ctx->iface->dec.decode(get_alg_priv(ctx), data, data_sz, user_priv);
}
return SAVE_STATUS(ctx, res);
diff --git a/third_party/aom/aom/src/aom_encoder.c b/third_party/aom/aom/src/aom_encoder.c
index ac84c888a..22765d6a6 100644
--- a/third_party/aom/aom/src/aom_encoder.c
+++ b/third_party/aom/aom/src/aom_encoder.c
@@ -13,7 +13,7 @@
* \brief Provides the high level interface to wrap encoder algorithms.
*
*/
-#include "./aom_config.h"
+#include "config/aom_config.h"
#if HAVE_FEXCEPT
#define _GNU_SOURCE
@@ -171,14 +171,14 @@ aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface,
}
}
+ /* default values */
+ if (cfg) {
+ cfg->cfg.ext_partition = 1;
+ }
+
return res;
}
-/* clang-format off */
-#define FLOATING_POINT_BEGIN_SCOPE do {
-#define FLOATING_POINT_END_SCOPE } while (0);
-/* clang-format on */
-
#if ARCH_X86 || ARCH_X86_64
/* On X86, disable the x87 unit's internal 80 bit precision for better
* consistency with the SSE unit's 64 bit precision.
@@ -201,20 +201,21 @@ aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface,
#define FLOATING_POINT_RESTORE_EXCEPTIONS
#endif // HAVE_FEXCEPT && CONFIG_DEBUG
+/* clang-format off */
#define FLOATING_POINT_INIT \
- FLOATING_POINT_BEGIN_SCOPE \
+ do { \
FLOATING_POINT_SET_PRECISION \
FLOATING_POINT_SET_EXCEPTIONS
#define FLOATING_POINT_RESTORE \
FLOATING_POINT_RESTORE_EXCEPTIONS \
FLOATING_POINT_RESTORE_PRECISION \
- FLOATING_POINT_END_SCOPE
+ } while (0);
+/* clang-format on */
aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img,
aom_codec_pts_t pts, unsigned long duration,
- aom_enc_frame_flags_t flags,
- unsigned long deadline) {
+ aom_enc_frame_flags_t flags) {
aom_codec_err_t res = AOM_CODEC_OK;
if (!ctx || (img && !duration))
@@ -232,8 +233,8 @@ aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img,
FLOATING_POINT_INIT
if (num_enc == 1)
- res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration, flags,
- deadline);
+ 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,
@@ -247,7 +248,7 @@ aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img,
for (i = num_enc - 1; i >= 0; i--) {
if ((res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration,
- flags, deadline)))
+ flags)))
break;
ctx--;
diff --git a/third_party/aom/aom/src/aom_image.c b/third_party/aom/aom/src/aom_image.c
index e1176bd45..437f0241e 100644
--- a/third_party/aom/aom/src/aom_image.c
+++ b/third_party/aom/aom/src/aom_image.c
@@ -16,14 +16,22 @@
#include "aom/aom_integer.h"
#include "aom_mem/aom_mem.h"
-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 char *img_data) {
+static INLINE unsigned int align_image_dimension(unsigned int d,
+ unsigned int subsampling,
+ unsigned int size_align) {
+ unsigned int align;
+
+ align = (1 << subsampling) - 1;
+ align = (size_align - 1 > align) ? (size_align - 1) : align;
+ return ((d + align) & ~align);
+}
+
+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 stride_in_bytes;
- int align;
/* Treat align==0 like align==1 */
if (!buf_align) buf_align = 1;
@@ -37,31 +45,22 @@ static aom_image_t *img_alloc_helper(aom_image_t *img, aom_img_fmt_t fmt,
/* Validate alignment (must be power of 2) */
if (stride_align & (stride_align - 1)) goto fail;
+ /* Treat align==0 like align==1 */
+ if (!size_align) size_align = 1;
+
+ /* Validate alignment (must be power of 2) */
+ if (size_align & (size_align - 1)) goto fail;
+
/* Get sample size for this format */
switch (fmt) {
- case AOM_IMG_FMT_RGB32:
- case AOM_IMG_FMT_RGB32_LE:
- case AOM_IMG_FMT_ARGB:
- case AOM_IMG_FMT_ARGB_LE: bps = 32; break;
- case AOM_IMG_FMT_RGB24:
- case AOM_IMG_FMT_BGR24: bps = 24; break;
- case AOM_IMG_FMT_RGB565:
- case AOM_IMG_FMT_RGB565_LE:
- case AOM_IMG_FMT_RGB555:
- case AOM_IMG_FMT_RGB555_LE:
- case AOM_IMG_FMT_UYVY:
- case AOM_IMG_FMT_YUY2:
- case AOM_IMG_FMT_YVYU: bps = 16; break;
case AOM_IMG_FMT_I420:
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_I440: bps = 16; break;
case AOM_IMG_FMT_I444: bps = 24; break;
case AOM_IMG_FMT_I42016: bps = 24; break;
case AOM_IMG_FMT_I42216:
- case AOM_IMG_FMT_I44016: bps = 32; break;
case AOM_IMG_FMT_I44416: bps = 48; break;
default: bps = 16; break;
}
@@ -80,22 +79,19 @@ static aom_image_t *img_alloc_helper(aom_image_t *img, aom_img_fmt_t fmt,
switch (fmt) {
case AOM_IMG_FMT_I420:
- case AOM_IMG_FMT_I440:
case AOM_IMG_FMT_YV12:
case AOM_IMG_FMT_AOMI420:
case AOM_IMG_FMT_AOMYV12:
- case AOM_IMG_FMT_I42016:
- case AOM_IMG_FMT_I44016: ycs = 1; break;
+ case AOM_IMG_FMT_I42016: ycs = 1; break;
default: ycs = 0; break;
}
/* Calculate storage sizes given the chroma subsampling */
- align = (1 << xcs) - 1;
- w = (d_w + align) & ~align;
- align = (1 << ycs) - 1;
- h = (d_h + align) & ~align;
+ 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 = (s + stride_align - 1) & ~(stride_align - 1);
+ s = (s + 2 * border + stride_align - 1) & ~(stride_align - 1);
stride_in_bytes = (fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s;
/* Allocate the new image */
@@ -112,9 +108,10 @@ static aom_image_t *img_alloc_helper(aom_image_t *img, aom_img_fmt_t fmt,
img->img_data = img_data;
if (!img_data) {
- const uint64_t alloc_size = (fmt & AOM_IMG_FMT_PLANAR)
- ? (uint64_t)h * s * bps / 8
- : (uint64_t)h * s;
+ 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;
if (alloc_size != (size_t)alloc_size) goto fail;
@@ -126,6 +123,7 @@ static aom_image_t *img_alloc_helper(aom_image_t *img, aom_img_fmt_t fmt,
img->fmt = fmt;
img->bit_depth = (fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? 16 : 8;
+ // aligned width and aligned height
img->w = w;
img->h = h;
img->x_chroma_shift = xcs;
@@ -137,7 +135,7 @@ static aom_image_t *img_alloc_helper(aom_image_t *img, aom_img_fmt_t fmt,
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)) return img;
+ if (!aom_img_set_rect(img, 0, 0, d_w, d_h, border)) return img;
fail:
aom_img_free(img);
@@ -147,7 +145,7 @@ 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, NULL);
+ return img_alloc_helper(img, fmt, d_w, d_h, align, align, 1, NULL, 0);
}
aom_image_t *aom_img_wrap(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w,
@@ -155,17 +153,29 @@ aom_image_t *aom_img_wrap(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w,
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, img_data);
+ return img_alloc_helper(img, fmt, d_w, d_h, 1, stride_align, 1, img_data, 0);
+}
+
+aom_image_t *aom_img_alloc_with_border(aom_image_t *img, aom_img_fmt_t fmt,
+ unsigned int d_w, unsigned int d_h,
+ 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);
}
int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y,
- unsigned int w, unsigned int h) {
+ unsigned int w, unsigned int h, unsigned int border) {
unsigned char *data;
if (x + w <= img->w && y + h <= img->h) {
img->d_w = w;
img->d_h = h;
+ x += border;
+ y += border;
+
/* Calculate plane pointers */
if (!(img->fmt & AOM_IMG_FMT_PLANAR)) {
img->planes[AOM_PLANE_PACKED] =
@@ -178,29 +188,30 @@ int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y,
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 * 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 * img->stride[AOM_PLANE_Y];
+ data += (img->h + 2 * border) * img->stride[AOM_PLANE_Y];
+ unsigned int uv_border_h = border >> img->y_chroma_shift;
+ unsigned int uv_x = x >> img->x_chroma_shift;
+ unsigned int uv_y = y >> img->y_chroma_shift;
if (!(img->fmt & AOM_IMG_FMT_UV_FLIP)) {
img->planes[AOM_PLANE_U] =
- data + (x >> img->x_chroma_shift) * bytes_per_sample +
- (y >> img->y_chroma_shift) * img->stride[AOM_PLANE_U];
- data += (img->h >> img->y_chroma_shift) * img->stride[AOM_PLANE_U];
+ data + uv_x * bytes_per_sample + uv_y * img->stride[AOM_PLANE_U];
+ data += ((img->h >> img->y_chroma_shift) + 2 * uv_border_h) *
+ img->stride[AOM_PLANE_U];
img->planes[AOM_PLANE_V] =
- data + (x >> img->x_chroma_shift) * bytes_per_sample +
- (y >> img->y_chroma_shift) * img->stride[AOM_PLANE_V];
+ data + uv_x * bytes_per_sample + uv_y * img->stride[AOM_PLANE_V];
} else {
img->planes[AOM_PLANE_V] =
- data + (x >> img->x_chroma_shift) * bytes_per_sample +
- (y >> img->y_chroma_shift) * img->stride[AOM_PLANE_V];
- data += (img->h >> img->y_chroma_shift) * img->stride[AOM_PLANE_V];
+ data + uv_x * bytes_per_sample + uv_y * img->stride[AOM_PLANE_V];
+ data += ((img->h >> img->y_chroma_shift) + 2 * uv_border_h) *
+ img->stride[AOM_PLANE_V];
img->planes[AOM_PLANE_U] =
- data + (x >> img->x_chroma_shift) * bytes_per_sample +
- (y >> img->y_chroma_shift) * img->stride[AOM_PLANE_U];
+ data + uv_x * bytes_per_sample + uv_y * img->stride[AOM_PLANE_U];
}
}
return 0;
diff --git a/third_party/aom/aom/src/aom_integer.c b/third_party/aom/aom/src/aom_integer.c
new file mode 100644
index 000000000..7edfd0de8
--- /dev/null
+++ b/third_party/aom/aom/src/aom_integer.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+#include <assert.h>
+
+#include "aom/aom_integer.h"
+
+static const size_t kMaximumLeb128Size = 8;
+static const uint8_t kLeb128ByteMask = 0x7f; // Binary: 01111111
+
+// Disallow values larger than 32-bits to ensure consistent behavior on 32 and
+// 64 bit targets: value is typically used to determine buffer allocation size
+// when decoded.
+static const uint64_t kMaximumLeb128Value = UINT32_MAX;
+
+size_t aom_uleb_size_in_bytes(uint64_t value) {
+ size_t size = 0;
+ do {
+ ++size;
+ } while ((value >>= 7) != 0);
+ return size;
+}
+
+int aom_uleb_decode(const uint8_t *buffer, size_t available, uint64_t *value,
+ size_t *length) {
+ if (buffer && value) {
+ *value = 0;
+ for (size_t i = 0; i < kMaximumLeb128Size && i < available; ++i) {
+ const uint8_t decoded_byte = *(buffer + i) & kLeb128ByteMask;
+ *value |= ((uint64_t)decoded_byte) << (i * 7);
+ if ((*(buffer + i) >> 7) == 0) {
+ if (length) {
+ *length = i + 1;
+ }
+
+ // Fail on values larger than 32-bits to ensure consistent behavior on
+ // 32 and 64 bit targets: value is typically used to determine buffer
+ // allocation size.
+ if (*value > UINT32_MAX) return -1;
+
+ return 0;
+ }
+ }
+ }
+
+ // If we get here, either the buffer/value pointers were invalid,
+ // or we ran over the available space
+ return -1;
+}
+
+int aom_uleb_encode(uint64_t value, size_t available, uint8_t *coded_value,
+ size_t *coded_size) {
+ const size_t leb_size = aom_uleb_size_in_bytes(value);
+ if (value > kMaximumLeb128Value || leb_size > kMaximumLeb128Size ||
+ leb_size > available || !coded_value || !coded_size) {
+ return -1;
+ }
+
+ for (size_t i = 0; i < leb_size; ++i) {
+ uint8_t byte = value & 0x7f;
+ value >>= 7;
+
+ if (value != 0) byte |= 0x80; // Signal that more bytes follow.
+
+ *(coded_value + i) = byte;
+ }
+
+ *coded_size = leb_size;
+ return 0;
+}
+
+int aom_uleb_encode_fixed_size(uint64_t value, size_t available,
+ size_t pad_to_size, uint8_t *coded_value,
+ size_t *coded_size) {
+ if (value > kMaximumLeb128Value || !coded_value || !coded_size ||
+ available < pad_to_size || pad_to_size > kMaximumLeb128Size) {
+ return -1;
+ }
+ const uint64_t limit = 1ULL << (7 * pad_to_size);
+ if (value >= limit) {
+ // Can't encode 'value' within 'pad_to_size' bytes
+ return -1;
+ }
+
+ for (size_t i = 0; i < pad_to_size; ++i) {
+ uint8_t byte = value & 0x7f;
+ value >>= 7;
+
+ if (i < pad_to_size - 1) byte |= 0x80; // Signal that more bytes follow.
+
+ *(coded_value + i) = byte;
+ }
+
+ assert(value == 0);
+
+ *coded_size = pad_to_size;
+ return 0;
+}