libaom 编解码项目解码接口文件介绍

对外头文件:

  • 编码端:aom/aom_encoder.h、aom/aomcx.h
  • 解码端:aom/aom_decoder.h、aom/aomdx.h

aom/aom_decoder.h

  1. 头文件包含文件:aom/aom_codec.h、aom/aom_frame_buffer.h
  2. 文件介绍:该文件描述了应用程序和视频解码算法之间的接口。
  3. AOM_DECODER_ABI_VERSION:用于跟踪解码器的ABI版本。如果对文件的修改导致了ABI的变化,就需要更新这个宏的值。这个宏的值由一个固定的数字6和一个依赖于编解码器ABI版本的值组成。
  4. AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER:用于在解码器的功能位字段中标记解码器是否支持外部帧缓冲区。这个宏的值是一个特定的位模式,可以在位字段中用来检查或设置相应的功能。
  5. aom_codec_stream_info:该结构体包含了解码流的一些基本信息,如宽度、高度、是否是关键帧、层数、Annex-B 格式等。这些信息可以在初始化编解码器时设置,或者在解码过程中查询。
  6. aom_codec_dec_cfg:该结构体提供了一种方式来配置解码器的初始化参数,如线程数、视频的宽度和高度,以及是否允许使用低比特深度编码路径。这些参数在创建解码器实例或初始化解码器时非常重要,因为它们影响解码器的性能和行为。
  7. aom_codec_dec_init_ver:该函数是用于初始化解码器实例的函数,它接受五个参数:指向解码器上下文的指针、指向算法接口的指针、指向配置的指针(可以为NULL)、标志位字段和ABI版本号。这个函数的目的是设置解码器的初始状态,确保它可以开始解码视频流。函数的返回值指示初始化是否成功,或者是否因为内存分配失败而失败。
  8. aom_codec_dec_init:该宏提供了一个简单的方式来初始化解码器,同时确保了ABI版本参数的正确设置,使得应用程序更加健壮和易于维护。
  9. aom_codec_peek_stream_info:该函数用于解析比特流并提取流信息,而不需要先构建解码器上下文。这个函数接受四个参数:指向算法接口的指针、指向数据块的指针、数据块的大小、指向流信息结构体的指针。这个函数的目的是检查比特流是否为正确的格式,并从中提取信息,如宽度、高度、是否是关键帧等。函数的返回值指示解析是否成功,或者是否因为参数无效或比特流不被支持而失败。
  10. aom_codec_get_stream_info:该函数用于在解码过程中返回有关已解析流的信息。这个函数接受两个参数:指向解码器上下文的指针和指向流信息结构体的指针。这个函数的目的是提供关于流的详细信息,如宽度、高度、是否是关键帧等,这些信息可以在解码过程中更新。函数的返回值指示操作是否成功,或者是否因为参数无效或无法解析提交的数据而失败。
  11. aom_codec_decode:该 函数用于处理编码数据缓冲区。这个函数接受四个参数:指向解码器上下文的指针、指向编码数据的指针、编码数据的大小以及与这一帧关联的应用程序特定数据。这个函数的目的是解码传入的编码数据,并确保解码过程可以顺利进行,以便未来的图像可以无错误地解码。函数的返回值指示解码操作是否成功,或者是否遇到错误,这些错误可能影响后续的解码过程。
  12. *aom_codec_get_frame:该函数用于从解码器中获取已解码的帧。这个函数接受两个参数:指向解码器上下文的指针和指向迭代器存储的指针。迭代器存储应该在开始迭代时被初始化为
    NULL,并且在迭代完成时,函数会返回 NULL。这个函数的目的是提供一个机制来访问解码后的帧,这些帧已经准备好按照 PTS
    顺序显示。函数的返回值是一个指向 aom_image_t 结构的指针,该结构包含了帧的图像数据。如果返回
    NULL,则表示没有更多的帧可供显示,或者迭代已经完成。
  13. aom_codec_set_frame_buffer_functions:该函数允许应用程序为 libaom 解码器提供外部帧缓冲区,而不是让解码器内部分配。这对于某些应用场景,如实时视频处理,可能是必要的,因为它们可以提供更高效的内存管理。

aom/aomdx.h

  1. 头文件包含文件:aom/aom.h
  2. 文件介绍:提供了关于AOMedia AOM/AV1解码器算法接口的结构和功能的文档。它表明了这个接口能够用于解码AOM或AV1视频流,并提供了必要的定义和接口。
  3. aom_codec_av1_dx_algo:关于AV1解码器算法接口的结构和功能的文档,并声明了一个名为 aom_codec_av1_dx_algo 的外部变量,该变量是AV1解码器算法接口的一个实例。同时,它还标记了这个接口为已弃用,并推荐使用
    aom_codec_av1_dx() 作为新的接口。
  4. *aom_codec_av1_dx:该函数是一个工厂函数,用于获取AV1解码器的接口。这个接口可以被用来创建解码器实例,配置解码器,并开始解码过程。这个函数的声明和文档注释提供了关于如何使用这个函数的信息,包括它的返回值和功能。
  5. Accounting:定义了一个新的数据结构 Accounting,用于存储调试信息。
  6. *aom_inspect_cb:用来检查解码器帧数据。这种类型的函数可以在解码器输出帧数据时被调用,以便进行额外的处理或检查。
  7. aom_inspect_init:该结构体提供了一个方便的方式来传递检查回调函数及其上下文给解码器。这可以在解码过程中用于执行额外的检查或处理,例如调试、性能监控或自定义的帧处理。通过将回调函数和上下文封装在一个结构体中,可以简化函数调用和参数传递。
  8. Av1DecodeReturn:该结构体提供了一个方便的方式来保存解码过程中的缓冲区位置和结果索引。这可以在解码AV1视频流时用于跟踪解码进度和结果,特别是对于不可显示的子帧。通过这个结构体,可以更灵活地处理解码过程中的各种情况。
  9. aom_tile_data:该结构体提供了一个方便的方式来保存比特流中瓦片tile的相关信息,这在处理瓦片化编码的视频流时非常有用。通过这个结构体,可以轻松地访问和操作瓦片数据,例如在解码或分析视频流时。
  10. AOM_MAX_TILE_COLS:该宏定义了AV1编码中一个帧内允许的最大瓦片列数量。这个定义有助于确保编码过程中瓦片列的数量不会超过AV1标准所允许的最大值。通过使用这个宏,代码可以更容易地维护和更新,以适应可能的未来标准变化。
  11. AOM_MAX_TILE_ROWS:该宏定义了AV1编码中一个帧内允许的最大瓦片行数量。这个定义有助于确保编码过程中瓦片行的数量不会超过AV1标准所允许的最大值。通过使用这个宏,代码可以更容易地维护和更新,以适应可能的未来标准变化。
  12. aom_tile_info:该结构体提供了一个方便的方式来保存帧中瓦片的详细信息,包括瓦片的数量、尺寸和分组。这在处理瓦片化编码的视频流时非常有用,尤其是在解码或分析视频流时需要访问这些信息。通过这个结构体,可以轻松地管理和操作瓦片数据。
  13. aom_still_picture_info:该结构体提供了一个方便的方式来保存和识别静态图像编码的相关信息,包括是否为静态图像以及头部信息的类型。这在处理视频流中的静态图像帧时非常有用,尤其是在编码、解码或分析视频流时需要识别和处理静态图像。通过这个结构体,可以轻松地管理和操作静态图像的编码信息。
  14. aom_s_frame_info:该结构体提供了一个方便的方式来保存和识别S帧的相关信息,包括S帧的存在性以及其在视频流中的位置。这在处理视频流中的关键帧或场景变换帧时非常有用,尤其是在编码、解码或分析视频流时需要识别和处理这些特殊帧。通过这个结构体,可以轻松地管理和操作S帧的编码信息。
  15. aom_screen_content_tools_info:该结构体提供了一个方便的方式来保存和识别屏幕内容工具的相关信息,包括是否允许使用屏幕内容工具、是否允许使用_intrabc以及是否强制使用整数运动向量。这在处理屏幕内容编码时非常有用,尤其是在编码、解码或分析视频流时需要识别和处理这些特殊工具。通过这个结构体,可以轻松地管理和操作屏幕内容工具的编码信息。
  16. av1_ext_ref_frame:该结构体提供了一个方便的方式来保存和管理外部引用帧的指针和数量信息。这在处理视频编码和解码时非常有用,尤其是在使用外部帧缓冲区或进行高级编码功能,如多帧参考和帧插值时。通过这个结构体,可以轻松地管理和操作外部引用帧的数据。
  17. aom_dec_control_id:该枚举主要是控制函数,这些控制函数提供了对AOM解码器行为的深入控制,使得开发者可以根据需要配置和查询解码器的状态。
  18. 解码器控制函数参数类型:这些宏定义为开发者提供了一种机制,可以在编译时检查libaom库是否支持特定的控制ID,从而允许开发者编写更健壮的代码,以适应不同版本的libaom库。

源码

  1. aom/aom_decoder.h
/*
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
#ifndef AOM_AOM_AOM_DECODER_H_
#define AOM_AOM_AOM_DECODER_H_

/*!\defgroup decoder Decoder Algorithm Interface
 * \ingroup codec
 * This abstraction allows applications using this decoder to easily support
 * multiple video formats with minimal code duplication. This section describes
 * the interface common to all decoders.
 * @{
 */

/*!\file
 * \brief Describes the decoder algorithm interface to applications.
 *
 * This file describes the interface between an application and a
 * video decoder algorithm.
 *
 */
#ifdef __cplusplus
extern "C" {
    
    
#endif

#include "aom/aom_codec.h"  // IWYU pragma: export
#include "aom/aom_frame_buffer.h"

/*!\brief Current ABI version number
 *
 * \internal
 * If this file is altered in any way that changes the ABI, this value
 * must be bumped.  Examples include, but are not limited to, changing
 * types, removing or reassigning enums, adding/removing/rearranging
 * fields to structures
 */
#define AOM_DECODER_ABI_VERSION \
  (6 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/

/*! \brief Decoder capabilities bitfield
 *
 *  Each decoder advertises the capabilities it supports as part of its
 *  ::aom_codec_iface_t interface structure. Capabilities are extra interfaces
 *  or functionality, and are not required to be supported by a decoder.
 *
 *  The available flags are specified by AOM_CODEC_CAP_* defines.
 */
/*!brief Can support external frame buffers */
#define AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER 0x200000

/*! \brief Initialization-time Feature Enabling
 *
 *  Certain codec features must be known at initialization time, to allow for
 *  proper memory allocation.
 *
 *  The available flags are specified by AOM_CODEC_USE_* defines.
 */

/*!\brief Stream properties
 *
 * This structure is used to query or set properties of the decoded
 * 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 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
 *
 * The following functions are required to be implemented for all decoders.
 * They represent the base case functionality expected of all decoders.
 */

/*!\brief Initialization Configurations
 *
 * This structure is used to pass init time configuration options to the
 * decoder.
 */
typedef struct aom_codec_dec_cfg {
    
    
  unsigned int threads; /**< Maximum number of threads to use, default 1 */
  unsigned int w;       /**< Width */
  unsigned int h;       /**< Height */
  unsigned int allow_lowbitdepth; /**< Allow use of low-bitdepth coding path */
} aom_codec_dec_cfg_t;            /**< alias for struct aom_codec_dec_cfg */

/*!\brief Initialize a decoder instance
 *
 * Initializes a decoder context using the given interface. Applications
 * should call the aom_codec_dec_init convenience macro instead of this
 * function directly, to ensure that the ABI version number parameter
 * is properly initialized.
 *
 * 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.
 * \param[in]    iface   Pointer to the algorithm interface to use.
 * \param[in]    cfg     Configuration to use, if known. May be NULL.
 * \param[in]    flags   Bitfield of AOM_CODEC_USE_* flags
 * \param[in]    ver     ABI version number. Must be set to
 *                       AOM_DECODER_ABI_VERSION
 * \retval #AOM_CODEC_OK
 *     The decoder algorithm has been initialized.
 * \retval #AOM_CODEC_MEM_ERROR
 *     Memory allocation failed.
 */
aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
                                       aom_codec_iface_t *iface,
                                       const aom_codec_dec_cfg_t *cfg,
                                       aom_codec_flags_t flags, int ver);

/*!\brief Convenience macro for aom_codec_dec_init_ver()
 *
 * Ensures the ABI version parameter is properly set.
 */
#define aom_codec_dec_init(ctx, iface, cfg, flags) \
  aom_codec_dec_init_ver(ctx, iface, cfg, flags, AOM_DECODER_ABI_VERSION)

/*!\brief Parse stream info from a buffer
 *
 * Performs high level parsing of the bitstream. Construction of a decoder
 * context is not necessary. Can be used to determine if the bitstream is
 * of the proper format, and to extract information from the stream.
 *
 * \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. 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.
 * \retval #AOM_CODEC_INVALID_PARAM
 *     One of the arguments is invalid, for example a NULL pointer.
 * \retval #AOM_CODEC_UNSUP_BITSTREAM
 *     The decoder didn't recognize the coded data, or the
 *     buffer was too short.
 */
aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
                                           const uint8_t *data, size_t data_sz,
                                           aom_codec_stream_info_t *si);

/*!\brief Return information about the current stream.
 *
 * 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.
 *
 * \retval #AOM_CODEC_OK
 *     Bitstream is parsable and stream information updated.
 * \retval #AOM_CODEC_INVALID_PARAM
 *     One of the arguments is invalid, for example a NULL pointer.
 * \retval #AOM_CODEC_UNSUP_BITSTREAM
 *     The decoder couldn't parse the submitted data.
 */
aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
                                          aom_codec_stream_info_t *si);

/*!\brief Decode data
 *
 * 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.
 * \param[in] data_sz      Size of the coded data, in bytes.
 * \param[in] user_priv    Application specific data to associate with
 *                         this frame.
 *
 * \return Returns #AOM_CODEC_OK if the coded data was processed completely
 *         and future pictures can be decoded without error. Otherwise,
 *         see the descriptions of the other error codes in ::aom_codec_err_t
 *         for recoverability capabilities.
 */
aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data,
                                 size_t data_sz, void *user_priv);

/*!\brief Decoded frames iterator
 *
 * Iterates over a list of the frames available for display. The iterator
 * storage should be initialized to NULL to start the iteration. Iteration is
 * complete when this function returns NULL.
 *
 * The list of available frames becomes valid upon completion of the
 * aom_codec_decode call, and remains valid until the next call to
 * aom_codec_decode.
 *
 * \param[in]     ctx      Pointer to this instance's context
 * \param[in,out] iter     Iterator storage, initialized to NULL
 *
 * \return Returns a pointer to an image, if one is ready for display. Frames
 *         produced will always be in PTS (presentation time stamp) order.
 */
aom_image_t *aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter);

/*!\defgroup cap_external_frame_buffer External Frame Buffer Functions
 *
 * 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_INCAPABLE.
 * @{
 */

/*!\brief Pass in external frame buffers for the decoder to use.
 *
 * Registers functions to be called when libaom needs a frame buffer
 * to decode the current frame and a function to be called when libaom does
 * not internally reference the frame buffer. This set function must
 * be called before the first call to decode or libaom will assume the
 * default behavior of allocating frame buffers internally.
 *
 * \param[in] ctx          Pointer to this instance's context
 * \param[in] cb_get       Pointer to the get callback function
 * \param[in] cb_release   Pointer to the release callback function
 * \param[in] cb_priv      Callback's private data
 *
 * \retval #AOM_CODEC_OK
 *     External frame buffers will be used by libaom.
 * \retval #AOM_CODEC_INVALID_PARAM
 *     One or more of the callbacks were NULL.
 * \retval #AOM_CODEC_ERROR
 *     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_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);

/*!@} - end defgroup cap_external_frame_buffer */

/*!@} - end defgroup decoder*/
#ifdef __cplusplus
}
#endif
#endif  // AOM_AOM_AOM_DECODER_H_

  1. aom/aomdx.h
/*
 * 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.
 */

/*!\defgroup aom_decoder AOMedia AOM/AV1 Decoder
 * \ingroup aom
 *
 * @{
 */
/*!\file
 * \brief Provides definitions for using AOM or AV1 within the aom Decoder
 *        interface.
 */
#ifndef AOM_AOM_AOMDX_H_
#define AOM_AOM_AOMDX_H_

#ifdef __cplusplus
extern "C" {
    
    
#endif

/* Include controls common to both the encoder and decoder */
#include "aom/aom.h"

/*!\name Algorithm interface for AV1
 *
 * This interface provides the capability to decode AV1 streams.
 * @{
 */

/*!\brief A single instance of the AV1 decoder.
 *\deprecated This access mechanism is provided for backwards compatibility;
 * prefer aom_codec_av1_dx().
 */
extern aom_codec_iface_t aom_codec_av1_dx_algo;
/*!\brief The interface to the AV1 decoder.
 */
extern aom_codec_iface_t *aom_codec_av1_dx(void);

/*!@} - end algorithm interface member group */

/** Data structure that stores bit accounting for debug
 */
typedef struct Accounting Accounting;

#ifndef AOM_INSPECTION_H_
/** Callback that inspects decoder frame data.
 */
typedef void (*aom_inspect_cb)(void *decoder, void *ctx);

#endif

/*!\brief Structure to hold inspection callback and context.
 *
 * Defines a structure to hold the inspection callback function and calling
 * context.
 */
typedef struct aom_inspect_init {
    
    
  /*! Inspection callback. */
  aom_inspect_cb inspect_cb;

  /*! Inspection context. */
  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.
 */
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 Max number of tile columns
 *
 * This is the limit of number of tile columns allowed within a frame.
 *
 * Currently same as "MAX_TILE_COLS" in AV1, the maximum that AV1 supports.
 *
 */
#define AOM_MAX_TILE_COLS 64
/*!\brief Max number of tile rows
 *
 * This is the limit of number of tile rows allowed within a frame.
 *
 * Currently same as "MAX_TILE_ROWS" in AV1, the maximum that AV1 supports.
 *
 */
#define AOM_MAX_TILE_ROWS 64

/*!\brief Structure to hold information about tiles in a frame.
 *
 * Defines a structure to hold a frame's tile information, namely
 * number of tile columns, number of tile_rows, and the width and
 * height of each tile.
 */
typedef struct aom_tile_info {
    
    
  /*! Indicates the number of tile columns. */
  int tile_columns;
  /*! Indicates the number of tile rows. */
  int tile_rows;
  /*! Indicates the tile widths in units of SB. */
  int tile_widths[AOM_MAX_TILE_COLS];
  /*! Indicates the tile heights in units of SB. */
  int tile_heights[AOM_MAX_TILE_ROWS];
  /*! Indicates the number of tile groups present in a frame. */
  int num_tile_groups;
} aom_tile_info;

/*!\brief Structure to hold information about still image coding.
 *
 * Defines a structure to hold a information regarding still picture
 * and its header type.
 */
typedef struct aom_still_picture_info {
    
    
  /*! Video is a single frame still picture */
  int is_still_picture;
  /*! Use full header for still picture */
  int is_reduced_still_picture_hdr;
} aom_still_picture_info;

/*!\brief Structure to hold information about S_FRAME.
 *
 * Defines a structure to hold a information regarding S_FRAME
 * and its position.
 */
typedef struct aom_s_frame_info {
    
    
  /*! Indicates if current frame is S_FRAME */
  int is_s_frame;
  /*! Indicates if current S_FRAME is present at ALTREF frame*/
  int is_s_frame_at_altref;
} aom_s_frame_info;

/*!\brief Structure to hold information about screen content tools.
 *
 * Defines a structure to hold information about screen content
 * tools, namely: allow_screen_content_tools, allow_intrabc, and
 * force_integer_mv.
 */
typedef struct aom_screen_content_tools_info {
    
    
  /*! Are screen content tools allowed */
  int allow_screen_content_tools;
  /*! Is intrabc allowed */
  int allow_intrabc;
  /*! Is integer mv forced */
  int force_integer_mv;
} aom_screen_content_tools_info;

/*!\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
 *
 * This set of macros define the control functions available for the AOM
 * decoder interface.
 * The range for decoder control ID is >= 256.
 *
 * \sa #aom_codec_control(aom_codec_ctx_t *ctx, int ctrl_id, ...)
 */
enum aom_dec_control_id {
    
    
  /*!\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,

  /*!\brief Codec control function to check if the indicated frame is
    corrupted, int* parameter
  */
  AOMD_GET_FRAME_CORRUPTED,

  /*!\brief Codec control function to get info on which reference frames were
   * used by the last decode, int* parameter
   */
  AOMD_GET_LAST_REF_USED,

  /*!\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,

  /*!\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,

  /*!\brief Codec control function to get the bit depth of the stream,
   * unsigned int* parameter
   */
  AV1D_GET_BIT_DEPTH,

  /*!\brief Codec control function to get the image format of the stream,
   * aom_img_fmt_t* parameter
   */
  AV1D_GET_IMG_FORMAT,

  /*!\brief Codec control function to get the width and height (in pixels) of
   * the tiles in a tile list, unsigned int* parameter
   *
   * Tile width is in the high 16 bits of the output value, and tile height is
   * in the low 16 bits of the output value.
   */
  AV1D_GET_TILE_SIZE,

  /*!\brief Codec control function to get the tile count in a tile list,
   * unsigned 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,

  /*!\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. 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,

  /*!\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,

  /*!\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 configured with -DCONFIG_ACCOUNTING=0, the default, this
   * returns AOM_CODEC_INCAPABLE.
   */
  AV1_GET_ACCOUNTING,

  /*!\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,

  /*!\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,

  /*!\brief Codec control function to set the tile coding mode, unsigned int
   * parameter
   *
   * - 0 = tiles are coded in normal tile mode
   * - 1 = tiles are coded in large-scale tile mode
   */
  AV1_SET_TILE_MODE,

  /*!\brief Codec control function to get the frame header information of an
   * encoded frame, aom_tile_data* parameter
   */
  AV1D_GET_FRAME_HEADER_INFO,

  /*!\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,

  /*!\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,

  /*!\brief Codec control function to enable the ext-tile software debug and
   * testing code in the decoder, unsigned int parameter
   */
  AV1D_EXT_TILE_DEBUG,

  /*!\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,

  /*!\brief Codec control function to indicate whether bitstream is in
   * Annex-B format, unsigned int parameter
   */
  AV1D_SET_IS_ANNEXB,

  /*!\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,

  /*!\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,

  /*!\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 configured with -DCONFIG_INSPECTION=0, the default, this
   * returns AOM_CODEC_INCAPABLE.
   */
  AV1_SET_INSPECTION_CALLBACK,

  /*!\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,

  /*!\brief Codec control function to check the presence of forward key frames,
   * int* parameter
   */
  AOMD_GET_FWD_KF_PRESENT,

  /*!\brief Codec control function to get the frame flags of the previous frame
   * decoded, int* parameter
   *
   * This will return a flag of type aom_codec_frame_flags_t.
   */
  AOMD_GET_FRAME_FLAGS,

  /*!\brief Codec control function to check the presence of altref frames, int*
   * parameter
   */
  AOMD_GET_ALTREF_PRESENT,

  /*!\brief Codec control function to get tile information of the previous frame
   * decoded, aom_tile_info* parameter
   *
   * This will return a struct of type aom_tile_info.
   */
  AOMD_GET_TILE_INFO,

  /*!\brief Codec control function to get screen content tools information,
   * aom_screen_content_tools_info* parameter
   *
   * It returns a struct of type aom_screen_content_tools_info, which contains
   * the header flags allow_screen_content_tools, allow_intrabc, and
   * force_integer_mv.
   */
  AOMD_GET_SCREEN_CONTENT_TOOLS_INFO,

  /*!\brief Codec control function to get the still picture coding information,
   * aom_still_picture_info* parameter
   */
  AOMD_GET_STILL_PICTURE,

  /*!\brief Codec control function to get superblock size,
   * aom_superblock_size_t* parameter
   *
   * It returns an enum, indicating the superblock size read from the sequence
   * header(0 for BLOCK_64X64 and 1 for BLOCK_128X128)
   */
  AOMD_GET_SB_SIZE,

  /*!\brief Codec control function to check if the previous frame
   * decoded has show existing frame flag set, int* parameter
   */
  AOMD_GET_SHOW_EXISTING_FRAME_FLAG,

  /*!\brief Codec control function to get the S_FRAME coding information,
   * aom_s_frame_info* parameter
   */
  AOMD_GET_S_FRAME_INFO,

  /*!\brief Codec control function to get the show frame flag, int* parameter
   */
  AOMD_GET_SHOW_FRAME_FLAG,

  /*!\brief Codec control function to get the base q index of a frame, int*
   * parameter
   */
  AOMD_GET_BASE_Q_IDX,

  /*!\brief Codec control function to get the order hint of a frame, unsigned
   * int* parameter
   */
  AOMD_GET_ORDER_HINT,

  /*!\brief Codec control function to get the info of a 4x4 block.
   * Parameters: int mi_row, int mi_col, and MB_MODE_INFO*.
   *
   * \note This only returns a shallow copy, so all pointer members should not
   * be used.
   */
  AV1D_GET_MI_INFO,
};

/*!\cond */
/*!\brief AOM decoder control function parameter type
 *
 * 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(AV1D_GET_FRAME_SIZE, int *)
#define AOM_CTRL_AV1D_GET_FRAME_SIZE

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(AV1_INVERT_TILE_DECODE_ORDER, int)
#define AOM_CTRL_AV1_INVERT_TILE_DECODE_ORDER

AOM_CTRL_USE_TYPE(AV1_SET_SKIP_LOOP_FILTER, int)
#define AOM_CTRL_AV1_SET_SKIP_LOOP_FILTER

AOM_CTRL_USE_TYPE(AV1_GET_ACCOUNTING, Accounting **)
#define AOM_CTRL_AV1_GET_ACCOUNTING

AOM_CTRL_USE_TYPE(AOMD_GET_LAST_QUANTIZER, int *)
#define AOM_CTRL_AOMD_GET_LAST_QUANTIZER

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_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

AOM_CTRL_USE_TYPE(AV1D_SET_SKIP_FILM_GRAIN, int)
#define AOM_CTRL_AV1D_SET_SKIP_FILM_GRAIN

AOM_CTRL_USE_TYPE(AOMD_GET_FWD_KF_PRESENT, int *)
#define AOM_CTRL_AOMD_GET_FWD_KF_PRESENT

AOM_CTRL_USE_TYPE(AOMD_GET_FRAME_FLAGS, int *)
#define AOM_CTRL_AOMD_GET_FRAME_FLAGS

AOM_CTRL_USE_TYPE(AOMD_GET_ALTREF_PRESENT, int *)
#define AOM_CTRL_AOMD_GET_ALTREF_PRESENT

AOM_CTRL_USE_TYPE(AOMD_GET_TILE_INFO, aom_tile_info *)
#define AOM_CTRL_AOMD_GET_TILE_INFO

AOM_CTRL_USE_TYPE(AOMD_GET_SCREEN_CONTENT_TOOLS_INFO,
                  aom_screen_content_tools_info *)
#define AOM_CTRL_AOMD_GET_SCREEN_CONTENT_TOOLS_INFO

AOM_CTRL_USE_TYPE(AOMD_GET_STILL_PICTURE, aom_still_picture_info *)
#define AOM_CTRL_AOMD_GET_STILL_PICTURE

AOM_CTRL_USE_TYPE(AOMD_GET_SB_SIZE, aom_superblock_size_t *)
#define AOMD_CTRL_AOMD_GET_SB_SIZE

AOM_CTRL_USE_TYPE(AOMD_GET_SHOW_EXISTING_FRAME_FLAG, int *)
#define AOMD_CTRL_AOMD_GET_SHOW_EXISTING_FRAME_FLAG

AOM_CTRL_USE_TYPE(AOMD_GET_S_FRAME_INFO, aom_s_frame_info *)
#define AOMD_CTRL_AOMD_GET_S_FRAME_INFO

AOM_CTRL_USE_TYPE(AOMD_GET_SHOW_FRAME_FLAG, int *)
#define AOM_CTRL_AOMD_GET_SHOW_FRAME_FLAG

AOM_CTRL_USE_TYPE(AOMD_GET_BASE_Q_IDX, int *)
#define AOM_CTRL_AOMD_GET_BASE_Q_IDX

AOM_CTRL_USE_TYPE(AOMD_GET_ORDER_HINT, unsigned int *)
#define AOM_CTRL_AOMD_GET_ORDER_HINT

// The AOM_CTRL_USE_TYPE macro can't be used with AV1D_GET_MI_INFO because
// AV1D_GET_MI_INFO takes more than one parameter.
#define AOM_CTRL_AV1D_GET_MI_INFO
/*!\endcond */
/*! @} - end defgroup aom_decoder */
#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // AOM_AOM_AOMDX_H_

猜你喜欢

转载自blog.csdn.net/yanceyxin/article/details/143233276