libaom 编码参数详细介绍--1:aom_codec_enc_cfg_t 结构体

aom_codec_enc_cfg_t结构体

  • 说明:编码器基础参数配置结构体。
  • 编码参数文件位置:aom/aom_encoder.h

g_usage

  1. 声明:unsigned int g_usage;
  2. 简述:算法特定的用法,算法可能对 g_usage定义多个值,表达应用程序打算如何使用该流的意图,如果是非零,查阅编解码器文档来决定他的意义。
  3. 取值:高质量模式(0)、实时模式(1)、全帧内模式(2)
/*!\brief usage parameter analogous to AV1 GOOD QUALITY mode. */
#define AOM_USAGE_GOOD_QUALITY 0u
/*!\brief usage parameter analogous to AV1 REALTIME mode. */
#define AOM_USAGE_REALTIME 1u
/*!\brief usage parameter analogous to AV1 all intra mode. */
#define AOM_USAGE_ALL_INTRA 2u

g_threads

  1. 声明:unsigned int g_threads;
  2. 简述:使用的最大线程数,在多线程实现中,使用的线程数不得超过这个数值,编解码器可能会使用的线程数少于允许的最大值。取值 0 等效于 1。
  3. 取值:0~MAX_NUM_THREADS(64)
RANGE_CHECK_HI(cfg, g_threads, MAX_NUM_THREADS);

g_profile

  1. 声明:unsigned int g_profile; /**< profile of bitstream to use */
  2. 简述:使用的比特流的配置,一些编解码器支持多种比特流配置文件的概念。通常,这对应于一组被打开或关闭的特性。通常,要使用的配置文件由目标解码器的特性决定。查阅编解码器的文档以确定此参数的有效值,或者将其设置为零以获得合理的默认值。
  3. 取值:0、1、2

g_w

  1. 声明:unsigned int g_w;
  2. 简述:帧的宽,这个值标识了帧的表示分辨率,以像素为单位。注意,作为输入传递给编码器的帧必须具有此分辨率。解码器将以这个分辨率呈现帧,无论编码器可能进行任何空间重采样
  3. 取值:user 设置

g_h

  1. 声明:unsigned int g_h;
  2. 简述:帧的高,与 g_w 配合使用。
  3. 取值:user 设置

g_limit

  1. 声明:unsigned int g_limit;
  2. 简述 :最大的编码帧数,如果强制视频模式关闭(默认设置)且g_limit为1,编码器将编码一张静态图片(在序列头OBU中将still_picture设置为1)。如果此外full_still_picture_hdr为0(默认设置),编码器将为静态图片使用简化的头部(在序列头OBU中将reduced_still_picture_header设置为1)。
  3. 取值:user 设置

g_forced_max_frame_width

  1. 声明 :unsigned int g_forced_max_frame_width;
  2. 简述:强制设置帧的最大宽,如果这个值不为零,则用于强制设置在write_sequence_header()中写入的最大帧宽度。
  3. 取值:user 设置

g_forced_max_frame_height

  1. 声明 :unsigned int g_forced_max_frame_height;
  2. 简述:强制设置帧的最大高,如果这个值不为零,则用于强制设置在write_sequence_header()中写入的最大帧宽度。
  3. 取值:user 设置

g_bit_depth

  1. 声明:aom_bit_depth_t g_bit_depth;
  2. 简述:编解码的位深枚举,这个值标识了编解码器的比特深度,只有某些比特深度是支持的,如在aom_bit_depth_t枚举中所标识的。
  3. 取值:8、10、12,在 aom_codec.h 文件中定义。
/*!\brief Bit depth for codec
 * *
 * This enumeration determines the bit depth of the codec.
 */
typedef enum aom_bit_depth {
  AOM_BITS_8 = 8,   /**<  8 bits */
  AOM_BITS_10 = 10, /**< 10 bits */
  AOM_BITS_12 = 12, /**< 12 bits */
} aom_bit_depth_t;

g_input_bit_depth

  1. 声明:unsigned int g_input_bit_depth;
  2. 简述:输入帧的位深,这个值标识了输入帧的比特深度,单位是比特。注意,作为输入传递给编码器的帧必须具有这个比特深度。
  3. 取值:8、10、12

g_timebase

  1. 声明:struct aom_rational g_timebase;
  2. 简述:流时间基准单元,表示流中使用的时间间隔的最小单位,以秒为单位。对于固定帧率素材,或者帧率是给定时钟倍数的可变帧率素材(例如:视频捕获), 推荐的方法 是将时间基准设置为帧率的倒数(例如:1001/30000 对于 29.970 Hz NTSC)。这样可以使得时间戳(pts)对应于帧号,这可能很方便。对于从具有绝对时间戳的容器重新编码视频, 推荐的方法 是将时间基准设置为父容器或多媒体框架的时间基准(例如:1/1000 为毫秒,如 FLV 中的设置)。
  3. 取值:结构体有 num、den 成员,num 是分子,den 是分母。user 配置,取值 1~1000000000
/*!\brief Rational Number
 *
 * This structure holds a fractional value.
 */
typedef struct aom_rational {
  int num;        /**< fraction numerator */
  int den;        /**< fraction denominator */
} aom_rational_t; /**< alias for struct aom_rational */
RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000);
RANGE_CHECK(cfg, g_timebase.num, 1, 1000000000);

g_error_resilient

  1. 声明:aom_codec_er_flags_t g_error_resilient;
  2. 简述 :启用错误恢复模式,错误恢复位字段指示编码器应该启用哪些特性,以便采取措施在有损或嘈杂的链路上进行流传输。
  3. 取值:0(关闭)、1(开启)

g_pass

  1. 声明:enum aom_enc_pass g_pass;
  2. 简述:多 pass 编码模式,这个值应该设置为多遍编码的当前阶段。对于单遍编码,设置为 #AOM_RC_ONE_PASS。
  3. 取值:枚举取值如下aom_enc_pass中定义。
/*!\brief Multi-pass Encoding Pass
 *
 * AOM_RC_LAST_PASS is kept for backward compatibility.
 * If passes is not given and pass==2, the codec will assume passes=2.
 * For new code, it is recommended to use AOM_RC_SECOND_PASS and set
 * the "passes" member to 2 via the key & val API for two-pass encoding.
 */
enum aom_enc_pass {
  AOM_RC_ONE_PASS = 0,    /**< Single pass mode */
  AOM_RC_FIRST_PASS = 1,  /**< First pass of multi-pass mode */
  AOM_RC_SECOND_PASS = 2, /**< Second pass of multi-pass mode */
  AOM_RC_THIRD_PASS = 3,  /**< Third pass of multi-pass mode */
  AOM_RC_LAST_PASS = 2,   /**< Final pass of two-pass mode */
};

g_lag_in_frames

  1. 声明:unsigned int g_lag_in_frames;
  2. 简述:允许延迟编码,如果设置此值,编码器在产生输出帧之前可以消耗一定数量的输入帧。这允许编码器基于未来帧为当前帧做出决策。这确实会增加编码管道的延迟,所以它并不适用于所有情况(例如:实时编码)。请注意,这是一个最大值——编码器可能会在给定限制之前产生帧。将此值设置为0以禁用此功能。
  3. 取值:user 设置,0 禁用适用 RTC 应用中

rc_dropframe_thresh

  1. 声明:时间重采样配置,如果编解码器支持的话。
  2. 简述:时间重采样允许编解码器“丢弃”帧作为一种策略来满足其目标数据速率。这可能导致编码视频中的时间不连续,这在播放时可能表现为卡顿。这种权衡通常是可以接受的,但对于许多应用来说不是。在这些情况下可以禁用它。请注意,并非所有编解码器都支持此功能。所有的aom AVx编解码器都支持。对于其他编解码器,请查阅该算法的文档。此阈值被描述为目标数据缓冲区的百分比。当数据缓冲区的填充量低于此百分比时,将指示丢弃帧。将阈值设置为零(0)以禁用此功能。
  3. 取值:user 设置,设置 0 表示禁用此功能

rc_resize_mode

  1. 声明:unsigned int rc_resize_mode;
  2. 简述:空间重采样模式,如果编解码器支持的话。空间重采样允许编解码器压缩帧的较低分辨率版本,然后由解码器将其放大到正确的表示分辨率。这可以在低数据速率下提高视觉质量,但代价是在编码器/解码器上增加CPU时间。
  3. 取值:如下枚举设置,user 可以根据需求设置。
enum {
  RESIZE_NONE = 0,     // No frame resizing allowed.
  RESIZE_FIXED = 1,    // All frames are coded at the specified scale.
  RESIZE_RANDOM = 2,   // All frames are coded at a random scale.
  RESIZE_DYNAMIC = 3,  // Frames coded at lower scale based on rate control.
  RESIZE_MODES
} UENUM1BYTE(RESIZE_MODE);

rc_resize_denominator

  1. 声明:unsigned int rc_resize_denominator;
  2. 简述:帧重采样的分母,假设分子为8,用于调整大小的分母。目前有效的分母为8至16。
  3. 取值:user 设置,有效的分母设置为 8~16。

rc_resize_kf_denominator

  1. 声明:unsigned int rc_resize_kf_denominator;
  2. 简述:关键帧调整大小的分母,假设分子为8,用于调整大小的分母。目前有效的分母为8至16。
  3. 取值:user 设置,有效的分母设置为 8~16。

rc_superres_mode

  1. 声明:aom_superres_mode rc_superres_mode;
  2. 简述:帧超分采样模式,类似于空间重采样,帧超分辨率在编码/解码过程之后集成了放大操作。控制放大过程并使用恢复滤波器应该能够使其性能优于常规的调整大小。
  3. 取值:如下枚举。
/*!\brief Frame super-resolution mode. */
typedef enum {
  /**< Frame super-resolution is disabled for all frames. */
  AOM_SUPERRES_NONE,
  /**< All frames are coded at the specified scale and super-resolved. */
  AOM_SUPERRES_FIXED,
  /**< All frames are coded at a random scale and super-resolved. */
  AOM_SUPERRES_RANDOM,
  /**< Super-resolution scale for each frame is determined based on the q index
     of that frame. */
  AOM_SUPERRES_QTHRESH,
  /**< Full-resolution or super-resolution and the scale (in case of
     super-resolution) are automatically selected for each frame. */
  AOM_SUPERRES_AUTO,
} aom_superres_mode;

rc_superres_denominator

  1. 声明: unsigned int rc_superres_denominator;
  2. 简述:帧超分的分母,用于超分辨率的分母。如果设置为固定,则只有在调整大小和超分辨率的累积缩放变化大于1/2时才会改变;这迫使超分辨率减少缩放。有效的分母为8至16。仅由 AOM_SUPERRES_FIXED 使用。
  3. 取值:user 设置,取值 8~16。

rc_superres_kf_denominator

  1. 声明:unsigned int rc_superres_kf_denominator;
  2. 简述:关键帧超分辨率分母。用于超分辨率的分母。如果设置为固定,则只有在调整大小和超分辨率的累积缩放变化大于1/2时才会改变;这迫使超分辨率减少缩放。目前有效的分母为8至16。
  3. 取值:user 设置,取值 8~16。

rc_superres_qthresh

  1. 声明:unsigned int rc_superres_qthresh;
  2. 简述:帧超分辨率量化级别阈值。超分辨率启用的量化级别阈值。有效值为1至63。仅由 AOM_SUPERRES_QTHRESH 使用。
  3. 取值:user 配置,取值为1~63。
RANGE_CHECK(cfg, rc_superres_qthresh, 1, 63);

rc_superres_kf_qthresh

  1. 声明:unsigned int rc_superres_kf_qthresh;
  2. 简述:关键帧超分辨率量化级别阈值。 当量化级别低于此阈值时,用于关键帧的超分辨率功能将被启用。有效值为1至63。仅由AOM_SUPERRES_QTHRESH 使用。
  3. 取值:user 配置,取值为 1~63。
RANGE_CHECK(cfg, rc_superres_kf_qthresh, 1, 63);

rc_end_usage

  1. 声明:enum aom_rc_mode rc_end_usage;
  2. 简述:使用的速率控制算法。 指示此流的最终用途是否是要在带宽受限的链路上进行流式传输,这表明应该使用恒定比特率(CBR)模式,或者是否将在高带宽链路上播放,如从本地磁盘,那里可以接受更高的比特率变化。
  3. 取值:如下枚举,有 VBR、CBR、CQ、Q 四种码控模式。
/*!\brief Rate control mode */
enum aom_rc_mode {
  AOM_VBR, /**< Variable Bit Rate (VBR) mode */
  AOM_CBR, /**< Constant Bit Rate (CBR) mode */
  AOM_CQ,  /**< Constrained Quality (CQ)  mode */
  AOM_Q,   /**< Constant Quality (Q) mode */
};

rc_twopass_stats_in

  1. 声明: aom_fixed_buf_t rc_twopass_stats_in;
  2. 简述:两遍统计数据缓冲区,一个包含第一次遍历过程中产生的所有统计数据包的缓冲区,这些数据包是连接在一起的。
  3. 取值:设置如aom_fixed_buf结构体,包括数据指针 buf 和 buffer 长度 sz两个成员。
/*!\brief Generic fixed size buffer structure
 *
 * This structure is able to hold a reference to any fixed size buffer.
 */
typedef struct aom_fixed_buf {
  void *buf;       /**< Pointer to the data. Does NOT own the data! */
  size_t sz;       /**< Length of the buffer, in chars */
} aom_fixed_buf_t; /**< alias for struct aom_fixed_buf */

rc_firstpass_mb_stats_in

  1. 声明:aom_fixed_buf_t rc_firstpass_mb_stats_in;
  2. 简述:第一遍宏块统计数据缓冲区。 一个包含第一遍编码过程中产生的所有第一遍宏块统计数据包的缓冲区,这些数据包是连接在一起的。
  3. 取值:设置如aom_fixed_buf结构体,包括数据指针 buf 和 buffer 长度 sz两个成员。
/*!\brief Generic fixed size buffer structure
 *
 * This structure is able to hold a reference to any fixed size buffer.
 */
typedef struct aom_fixed_buf {
  void *buf;       /**< Pointer to the data. Does NOT own the data! */
  size_t sz;       /**< Length of the buffer, in chars */
} aom_fixed_buf_t; /**< alias for struct aom_fixed_buf */

rc_target_bitrate

  1. 声明: unsigned int rc_target_bitrate;
  2. 简述:目标码率,为此流设置的目标比特率,单位是每秒千比特(kilobits per second)。允许的最大值是2000000。
  3. 取值:user 设置,最大值为 2000000。
RANGE_CHECK_HI(cfg, rc_target_bitrate, 2000000);

rc_2pass_vbr_bias_pct

  1. 声明: unsigned int rc_2pass_vbr_bias_pct;
  2. 简述:2pass 编码模式 CBR/VBR 偏置,偏置以0到100的尺度表示,用于确定当前帧的目标大小。值0表示应使用最佳CBR模式值。值100表示应使用最佳VBR模式值。介于两者之间的值表明编码器应该“倾向于”哪一边。
  3. 取值:user 配置,取值 0~100。

rc_2pass_vbr_minsection_pct

  1. 声明: unsigned int rc_2pass_vbr_minsection_pct;
  2. 简述:2pass编码模式每个 GOP 的最小比特率;这个值以目标比特率的百分比表示,指示用于单个 GOP(也称为“部分”)的最小比特率。
  3. 取值:user 配置

rc_2pass_vbr_maxsection_pct

  1. 声明: unsigned int rc_2pass_vbr_maxsection_pct;
  2. 简述:2pass编码模式每个 GOP 的最大比特率;这个值以目标比特率的百分比表示,指示用于单个 GOP(也称为“部分”)的最大比特率。
  3. 取值:user 配置

fwd_kf_enabled

  1. 声明: int fwd_kf_enabled;
  2. 简述:启用前向参考关键帧的选项
  3. 取值:user 配置

kf_mode

  1. 声明: enum aom_kf_mode kf_mode;
  2. 简述:关键帧放置模式,这个值指示编码器是否应该在固定间隔处放置关键帧,或者根据 #kf_min_dist 和 #kf_max_dist 参数自动确定最佳放置位置。
  3. 取值:根据枚举aom_kf_mode进行选择配置,主要就自动决定放置最佳关键帧位置和不放置关键帧两种选项。
/*!\brief Keyframe placement mode.
 *
 * This enumeration determines whether keyframes are placed automatically by
 * the encoder or whether this behavior is disabled. Older releases of this
 * SDK were implemented such that AOM_KF_FIXED meant keyframes were disabled.
 * This name is confusing for this behavior, so the new symbols to be used
 * are AOM_KF_AUTO and AOM_KF_DISABLED.
 */
enum aom_kf_mode {
  AOM_KF_FIXED,       /**< deprecated, implies AOM_KF_DISABLED */
  AOM_KF_AUTO,        /**< Encoder determines optimal placement automatically */
  AOM_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
};

kf_max_dist

  1. 声明: unsigned int kf_max_dist;
  2. 简述:关键帧最大间隔,这个值以帧数表示,如果在过去 kf_max_dist 帧中没有编码关键帧,则强制编码器编码一个关键帧。值0意味着所有帧都将是关键帧。将 kf_min_dist 设置为与 kf_max_dist 相等,可以获得固定间隔。
  3. 取值:user 配置

sframe_dist

  1. 声明: unsigned int sframe_dist;
  2. 简述:S帧间隔,这个值以帧数表示,强制编码器每 sframe_dist 帧编码一个S帧。
  3. 取值:user 配置

sframe_mode

  1. 声明: unsigned int sframe_mode;
  2. 简述:S帧插入模式,这个值必须设置为1或2,并告诉编码器如何插入S帧。它仅在 sframe_dist != 0时有效。
    • 如果启用了altref(替代参考帧):
      • 如果 sframe_mode == 1,则只有在考虑的帧是altref帧时,才会将其制作成S帧。
      • 如果 sframe_mode == 2,则下一个altref帧将被制作成S帧。
    • 否则:考虑的帧将被制作成S帧。
  3. 取值:user 配置,设置为 1 或 2。

large_scale_tile

  1. 声明: unsigned int large_scale_tile;
  2. 简述:Tile 编码模式,值0意味着普通的非大规模tile编码。值1意味着大规模tile编码。
  3. 取值:user 配置,取值 0 或 1

monochrome

  1. 声明: unsigned int monochrome;
  2. 简述:如果这个值非零,编码器将生成一个没有色度平面的单色流。
  3. 取值:user 配置,取值 0 或者 1

full_still_picture_hdr

  1. 声明: unsigned int full_still_picture_hdr;
  2. 简述:如果这个值非零,即使在静态画面编码时,编码器也会生成一个完整的头部(在序列头OBU中将reduced_still_picture_header设置为0)。如果这个值为零(默认值),在静态画面编码时将使用简化的头部(在序列头OBU中将reduced_still_picture_header设置为1)。当编码包含多于一帧的常规视频时,这个标志没有效果。
  3. 取值:user 配置,取值 0 或者 1

save_as_annexb

  1. 声明: unsigned int save_as_annexb;
  2. 简述:比特流语法模式,值0表示比特流以第5部分比特流的形式保存。值1表示比特流以Annex-B格式保存。
  3. 取值:user 配置,取值 0 或者 1。

tile_width_count

  1. 声明: unsigned int tile_width_count;
  2. 简述:指定的显式tile宽度数量,值0意味着没有指定tile宽度。tile宽度在数组 tile_widths[] 中给出。
  3. 取值:user 配置。

tile_height_count

  1. 声明: unsigned int tile_height_count;
  2. 简述:指定的显式tile高度数量,值0意味着没有指定tile高度。tile高度在数组 tile_heights[] 中给出。
  3. 取值:user 配置。

tile_widths[MAX_TILE_WIDTHS]

  1. 声明: int tile_widths[MAX_TILE_WIDTHS];
  2. 简述:这个数组指定了tile的宽度(可能为空)。指定的宽度数量由 tile_width_count 给出,其中MAX_TILE_WIDTHS等于 64。
  3. 取值:user 配置。

tile_heights[MAX_TILE_HEIGHTS]

  1. 声明: int tile_heights[MAX_TILE_HEIGHTS];
  2. 简述:这个数组指定了tile的高度(可能为空)。指定的高度数量由 tile_height_count 给出,其中MAX_TILE_HEIGHTS等于 64。
  3. 取值:user 配置。

use_fixed_qp_offsets

  1. 声明: unsigned int use_fixed_qp_offsets;
  2. 简述:编码器是否应该使用固定的 QP 偏移量。 如果提供了值1,编码器将对金字塔不同级别的帧使用固定的 QP 偏移量。如果提供了值0,编码器将不使用固定的 QP 偏移量。注意:这个选项仅在 --end-usage=q(质量模式)时相关。
  3. 取值:user 配置。可以设置为 0 或者 1。

fixed_qp_offsets[5]

  1. 声明:int fixed_qp_offsets[5];
  2. 简述:废弃,忽略,没有使用,TODO(aomedia:3269): 在 libaom 版本 v4.0.0 中移除 fixed_qp_offsets。
  3. 取值:忽略

encoder_cfg

  1. 声明:cfg_options_t encoder_cfg;
  2. 简述:每个配置文件定义的选项
  3. 取值:cfg_options结构体内部设置编码器配置选项

源码

*!\brief Encoder configuration structure
 *
 * This structure contains the encoder settings that have common representations
 * across all codecs. This doesn't imply that all codecs support all features,
 * however.
 */
typedef struct aom_codec_enc_cfg {
  /*
   * generic settings (g)
   */

  /*!\brief Algorithm specific "usage" value
   *
   * Algorithms may define multiple values for usage, which may convey the
   * intent of how the application intends to use the stream. If this value
   * is non-zero, consult the documentation for the codec to determine its
   * meaning.
   */
  unsigned int g_usage;

  /*!\brief Maximum number of threads to use
   *
   * For multi-threaded implementations, use no more than this number of
   * threads. The codec may use fewer threads than allowed. The value
   * 0 is equivalent to the value 1.
   */
  unsigned int g_threads;

  /*!\brief Bitstream profile to use
   *
   * Some codecs support a notion of multiple bitstream profiles. Typically
   * this maps to a set of features that are turned on or off. Often the
   * profile to use is determined by the features of the intended decoder.
   * Consult the documentation for the codec to determine the valid values
   * for this parameter, or set to zero for a sane default.
   */
  unsigned int g_profile; /**< profile of bitstream to use */

  /*!\brief Width of the frame
   *
   * This value identifies the presentation resolution of the frame,
   * in pixels. Note that the frames passed as input to the encoder must
   * have this resolution. Frames will be presented by the decoder in this
   * resolution, independent of any spatial resampling the encoder may do.
   */
  unsigned int g_w;

  /*!\brief Height of the frame
   *
   * This value identifies the presentation resolution of the frame,
   * in pixels. Note that the frames passed as input to the encoder must
   * have this resolution. Frames will be presented by the decoder in this
   * resolution, independent of any spatial resampling the encoder may do.
   */
  unsigned int g_h;

  /*!\brief Max number of frames to encode
   *
   * If force video mode is off (the default) and g_limit is 1, the encoder
   * will encode a still picture (still_picture is set to 1 in the sequence
   * header OBU). If in addition full_still_picture_hdr is 0 (the default),
   * the encoder will use a reduced header (reduced_still_picture_header is
   * set to 1 in the sequence header OBU) for the still picture.
   */
  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,
   * Only certain bit-depths are supported as identified in the
   * aom_bit_depth_t enum.
   */
  aom_bit_depth_t g_bit_depth;

  /*!\brief Bit-depth of the input frames
   *
   * This value identifies the bit_depth of the input frames in bits.
   * Note that the frames passed as input to the encoder must have
   * this bit-depth.
   */
  unsigned int g_input_bit_depth;

  /*!\brief Stream timebase units
   *
   * Indicates the smallest interval of time, in seconds, used by the stream.
   * For fixed frame rate material, or variable frame rate material where
   * frames are timed at a multiple of a given clock (ex: video capture),
   * the \ref RECOMMENDED method is to set the timebase to the reciprocal
   * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the
   * pts to correspond to the frame number, which can be handy. For
   * re-encoding video from containers with absolute time timestamps, the
   * \ref RECOMMENDED method is to set the timebase to that of the parent
   * container or multimedia framework (ex: 1/1000 for ms, as in FLV).
   */
  struct aom_rational g_timebase;

  /*!\brief Enable error resilient modes.
   *
   * The error resilient bitfield indicates to the encoder which features
   * it should enable to take measures for streaming over lossy or noisy
   * links.
   */
  aom_codec_er_flags_t g_error_resilient;

  /*!\brief Multi-pass Encoding Mode
   *
   * This value should be set to the current phase for multi-pass encoding.
   * For single pass, set to #AOM_RC_ONE_PASS.
   */
  enum aom_enc_pass g_pass;

  /*!\brief Allow lagged encoding
   *
   * If set, this value allows the encoder to consume a number of input
   * frames before producing output frames. This allows the encoder to
   * base decisions for the current frame on future frames. This does
   * increase the latency of the encoding pipeline, so it is not appropriate
   * in all situations (ex: realtime encoding).
   *
   * Note that this is a maximum value -- the encoder may produce frames
   * sooner than the given limit. Set this value to 0 to disable this
   * feature.
   */
  unsigned int g_lag_in_frames;

  /*
   * rate control settings (rc)
   */

  /*!\brief Temporal resampling configuration, if supported by the codec.
   *
   * Temporal resampling allows the codec to "drop" frames as a strategy to
   * meet its target data rate. This can cause temporal discontinuities in
   * the encoded video, which may appear as stuttering during playback. This
   * trade-off is often acceptable, but for many applications is not. It can
   * be disabled in these cases.
   *
   * Note that not all codecs support this feature. All aom AVx codecs do.
   * For other codecs, consult the documentation for that algorithm.
   *
   * This threshold is described as a percentage of the target data buffer.
   * When the data buffer falls below this percentage of fullness, a
   * dropped frame is indicated. Set the threshold to zero (0) to disable
   * this feature.
   */
  unsigned int rc_dropframe_thresh;

  /*!\brief Mode for spatial resampling, if supported by the codec.
   *
   * Spatial resampling allows the codec to compress a lower resolution
   * version of the frame, which is then upscaled by the decoder to the
   * correct presentation resolution. This increases visual quality at
   * low data rates, at the expense of CPU time on the encoder/decoder.
   */
  unsigned int rc_resize_mode;

  /*!\brief Frame resize denominator.
   *
   * The denominator for resize to use, assuming 8 as the numerator.
   *
   * Valid denominators are  8 - 16 for now.
   */
  unsigned int rc_resize_denominator;

  /*!\brief Keyframe resize denominator.
   *
   * The denominator for resize to use, assuming 8 as the numerator.
   *
   * Valid denominators are  8 - 16 for now.
   */
  unsigned int rc_resize_kf_denominator;

  /*!\brief Frame super-resolution scaling mode.
   *
   * Similar to spatial resampling, frame super-resolution integrates
   * upscaling after the encode/decode process. Taking control of upscaling and
   * using restoration filters should allow it to outperform normal resizing.
   */
  aom_superres_mode rc_superres_mode;

  /*!\brief Frame super-resolution denominator.
   *
   * The denominator for superres to use. If fixed it will only change if the
   * cumulative scale change over resizing and superres is greater than 1/2;
   * this forces superres to reduce scaling.
   *
   * Valid denominators are 8 to 16.
   *
   * Used only by AOM_SUPERRES_FIXED.
   */
  unsigned int rc_superres_denominator;

  /*!\brief Keyframe super-resolution denominator.
   *
   * The denominator for superres to use. If fixed it will only change if the
   * cumulative scale change over resizing and superres is greater than 1/2;
   * this forces superres to reduce scaling.
   *
   * Valid denominators are 8 - 16 for now.
   */
  unsigned int rc_superres_kf_denominator;

  /*!\brief Frame super-resolution q threshold.
   *
   * The q level threshold after which superres is used.
   * Valid values are 1 to 63.
   *
   * Used only by AOM_SUPERRES_QTHRESH
   */
  unsigned int rc_superres_qthresh;

  /*!\brief Keyframe super-resolution q threshold.
   *
   * The q level threshold after which superres is used for key frames.
   * Valid values are 1 to 63.
   *
   * Used only by AOM_SUPERRES_QTHRESH
   */
  unsigned int rc_superres_kf_qthresh;

  /*!\brief Rate control algorithm to use.
   *
   * Indicates whether the end usage of this stream is to be streamed over
   * a bandwidth constrained link, indicating that Constant Bit Rate (CBR)
   * mode should be used, or whether it will be played back on a high
   * bandwidth link, as from a local disk, where higher variations in
   * bitrate are acceptable.
   */
  enum aom_rc_mode rc_end_usage;

  /*!\brief Two-pass stats buffer.
   *
   * A buffer containing all of the stats packets produced in the first
   * pass, concatenated.
   */
  aom_fixed_buf_t rc_twopass_stats_in;

  /*!\brief first pass mb stats buffer.
   *
   * A buffer containing all of the first pass mb stats packets produced
   * in the first pass, concatenated.
   */
  aom_fixed_buf_t rc_firstpass_mb_stats_in;

  /*!\brief Target data rate
   *
   * Target bitrate to use for this stream, in kilobits per second.
   * Max allowed value is 2000000
   */
  unsigned int rc_target_bitrate;

  /*
   * quantizer settings
   */

  /*!\brief Minimum (Best Quality) Quantizer
   *
   * The quantizer is the most direct control over the quality of the
   * encoded image. The range of valid values for the quantizer is codec
   * specific. Consult the documentation for the codec to determine the
   * values to use. To determine the range programmatically, call
   * aom_codec_enc_config_default() with a usage value of 0.
   */
  unsigned int rc_min_quantizer;

  /*!\brief Maximum (Worst Quality) Quantizer
   *
   * The quantizer is the most direct control over the quality of the
   * encoded image. The range of valid values for the quantizer is codec
   * specific. Consult the documentation for the codec to determine the
   * values to use. To determine the range programmatically, call
   * aom_codec_enc_config_default() with a usage value of 0.
   */
  unsigned int rc_max_quantizer;

  /*
   * bitrate tolerance
   */

  /*!\brief Rate control adaptation undershoot control
   *
   * This value, controls the tolerance of the VBR algorithm to undershoot
   * and is used as a trigger threshold for more aggressive adaptation of Q.
   *
   * Valid values in the range 0-100.
   */
  unsigned int rc_undershoot_pct;

  /*!\brief Rate control adaptation overshoot control
   *
   * This value, controls the tolerance of the VBR algorithm to overshoot
   * and is used as a trigger threshold for more aggressive adaptation of Q.
   *
   * Valid values in the range 0-100.
   */
  unsigned int rc_overshoot_pct;

  /*
   * decoder buffer model parameters
   */

  /*!\brief Decoder Buffer Size
   *
   * This value indicates the amount of data that may be buffered by the
   * decoding application. Note that this value is expressed in units of
   * time (milliseconds). For example, a value of 5000 indicates that the
   * client will buffer (at least) 5000ms worth of encoded data. Use the
   * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if
   * necessary.
   */
  unsigned int rc_buf_sz;

  /*!\brief Decoder Buffer Initial Size
   *
   * This value indicates the amount of data that will be buffered by the
   * decoding application prior to beginning playback. This value is
   * expressed in units of time (milliseconds). Use the target bitrate
   * (#rc_target_bitrate) to convert to bits/bytes, if necessary.
   */
  unsigned int rc_buf_initial_sz;

  /*!\brief Decoder Buffer Optimal Size
   *
   * This value indicates the amount of data that the encoder should try
   * to maintain in the decoder's buffer. This value is expressed in units
   * of time (milliseconds). Use the target bitrate (#rc_target_bitrate)
   * to convert to bits/bytes, if necessary.
   */
  unsigned int rc_buf_optimal_sz;

  /*
   * 2 pass rate control parameters
   */

  /*!\brief Two-pass mode CBR/VBR bias
   *
   * Bias, expressed on a scale of 0 to 100, for determining target size
   * for the current frame. The value 0 indicates the optimal CBR mode
   * value should be used. The value 100 indicates the optimal VBR mode
   * value should be used. Values in between indicate which way the
   * encoder should "lean."
   */
  unsigned int rc_2pass_vbr_bias_pct;

  /*!\brief Two-pass mode per-GOP minimum bitrate
   *
   * This value, expressed as a percentage of the target bitrate, indicates
   * the minimum bitrate to be used for a single GOP (aka "section")
   */
  unsigned int rc_2pass_vbr_minsection_pct;

  /*!\brief Two-pass mode per-GOP maximum bitrate
   *
   * This value, expressed as a percentage of the target bitrate, indicates
   * the maximum bitrate to be used for a single GOP (aka "section")
   */
  unsigned int rc_2pass_vbr_maxsection_pct;

  /*
   * 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
   * fixed interval, or determine the optimal placement automatically
   * (as governed by the #kf_min_dist and #kf_max_dist parameters)
   */
  enum aom_kf_mode kf_mode;

  /*!\brief Keyframe minimum interval
   *
   * This value, expressed as a number of frames, prevents the encoder from
   * placing a keyframe nearer than kf_min_dist to the previous keyframe. At
   * least kf_min_dist frames non-keyframes will be coded before the next
   * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval.
   */
  unsigned int kf_min_dist;

  /*!\brief Keyframe maximum interval
   *
   * This value, expressed as a number of frames, forces the encoder to code
   * a keyframe if one has not been coded in the last kf_max_dist frames.
   * A value of 0 implies all frames will be keyframes. Set kf_min_dist
   * equal to kf_max_dist for a fixed interval.
   */
  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.
   * A value of 0 implies a normal non-large-scale tile coding. A value of 1
   * implies a large-scale tile coding.
   */
  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
   * (reduced_still_picture_header is set to 0 in the sequence header OBU) even
   * for still picture encoding. If this is zero (the default), a reduced
   * header (reduced_still_picture_header is set to 1 in the sequence header
   * OBU) is used for still picture encoding. 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
   * A value of 0 implies no tile widths are specified.
   * Tile widths are given in the array tile_widths[]
   */
  int tile_width_count;

  /*!\brief Number of explicit tile heights specified
   *
   * This value indicates the number of tile heights specified
   * A value of 0 implies no tile heights are specified.
   * Tile heights are given in the array tile_heights[]
   */
  int tile_height_count;

/*!\brief Maximum number of tile widths in tile widths array
 *
 * This define gives the maximum number of elements in the tile_widths array.
 */
#define MAX_TILE_WIDTHS 64  // maximum tile width array length

  /*!\brief Array of specified tile widths
   *
   * This array specifies tile widths (and may be empty)
   * The number of widths specified is given by tile_width_count
   */
  int tile_widths[MAX_TILE_WIDTHS];

/*!\brief Maximum number of tile heights in tile heights array.
 *
 * This define gives the maximum number of elements in the tile_heights array.
 */
#define MAX_TILE_HEIGHTS 64  // maximum tile height array length

  /*!\brief Array of specified tile heights
   *
   * This array specifies tile heights (and may be empty)
   * The number of heights specified is given by tile_height_count
   */
  int tile_heights[MAX_TILE_HEIGHTS];

  /*!\brief Whether encoder should use fixed QP offsets.
   *
   * If a value of 1 is provided, encoder will use fixed QP offsets for frames
   * at different levels of the pyramid.
   * If a value of 0 is provided, encoder will NOT use fixed QP offsets.
   * Note: This option is only relevant for --end-usage=q.
   */
  unsigned int use_fixed_qp_offsets;

  /*!\brief Deprecated and ignored. DO NOT USE.
   *
   * TODO(aomedia:3269): Remove fixed_qp_offsets in libaom v4.0.0.
   */
  int fixed_qp_offsets[5];

  /*!\brief Options defined per config file
   *
   */
  cfg_options_t encoder_cfg;
} aom_codec_enc_cfg_t; /**< alias for struct aom_codec_enc_cfg */
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码流怪侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值