Coverage Report

Created: 2026-05-16 06:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/svt-av1/Source/Lib/Codec/encoder.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3
 *
4
 * This source code is subject to the terms of the BSD 2 Clause License and
5
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6
 * was not distributed with this source code in the LICENSE file, you can
7
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8
 * Media Patent License 1.0 was not distributed with this source code in the
9
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10
 */
11
12
/*!\file
13
 * \brief Declares top-level encoder structures and functions.
14
 */
15
#ifndef AOM_AV1_ENCODER_ENCODER_H_
16
#define AOM_AV1_ENCODER_ENCODER_H_
17
18
#include <stdbool.h>
19
#include <stdio.h>
20
21
#include "definitions.h"
22
#include "av1_common.h"
23
#include "rc_process.h"
24
25
#ifdef __cplusplus
26
extern "C" {
27
#endif
28
29
//**********************************************************************************************************************//
30
// aom_codec.h
31
/*!\brief Rate control mode */
32
enum aom_rc_mode {
33
    AOM_VBR, /**< Variable Bit Rate (VBR) mode */
34
    AOM_CBR, /**< Constant Bit Rate (CBR) mode */
35
    AOM_Q, /**< Constant Quality (Q) mode */
36
};
37
38
//**********************************************************************************************************************//
39
40
/*!\endcond */
41
/*!
42
 * \brief Encoder rate control configuration parameters
43
 */
44
typedef struct {
45
    /*!\cond */
46
    // BUFFERING PARAMETERS
47
    // Indicates the amount of data that will be buffered by the decoding
48
    // application prior to beginning playback, and is expressed in units of
49
    // time(milliseconds).
50
    int64_t starting_buffer_level_ms;
51
    // Indicates the amount of data that the encoder should try to maintain in the
52
    // decoder's buffer, and is expressed in units of time(milliseconds).
53
    int64_t optimal_buffer_level_ms;
54
    // Indicates the maximum amount of data that may be buffered by the decoding
55
    // application, and is expressed in units of time(milliseconds).
56
    int64_t maximum_buffer_size_ms;
57
58
    // Indicates the maximum allowed bitrate for any intra frame as % of bitrate
59
    // target.
60
    unsigned int max_intra_bitrate_pct;
61
    // Indicates the maximum allowed bitrate for any inter frame as % of bitrate
62
    // target.
63
    unsigned int max_inter_bitrate_pct;
64
    // min_cr / 100 indicates the target minimum compression ratio for each frame.
65
    unsigned int min_cr;
66
    // under_shoot_pct indicates the tolerance of the VBR algorithm to undershoot
67
    // and is used as a trigger threshold for more agressive adaptation of Q. It's
68
    // value can range from 0-100.
69
    int under_shoot_pct;
70
    // over_shoot_pct indicates the tolerance of the VBR algorithm to overshoot
71
    // and is used as a trigger threshold for more agressive adaptation of Q. It's
72
    // value can range from 0-1000.
73
    int over_shoot_pct;
74
    // Indicates the maximum qindex that can be used by the quantizer i.e. the
75
    // worst quality qindex.
76
    int worst_allowed_q;
77
    // Indicates the minimum qindex that can be used by the quantizer i.e. the
78
    // best quality qindex.
79
    int best_allowed_q;
80
    // Indicates if the encoding mode is vbr, cbr, constrained quality or constant
81
    // quality.
82
    enum aom_rc_mode mode;
83
    /*!\endcond */
84
} RateControlCfg;
85
86
typedef struct {
87
    int        frame_width;
88
    int        frame_height;
89
    int        mb_rows;
90
    int        mb_cols;
91
    int        num_mbs;
92
    EbBitDepth bit_depth;
93
    int        subsampling_x;
94
    int        subsampling_y;
95
} FrameInfo;
96
97
typedef struct {
98
    // stats_in buffer contains all of the stats packets produced in the first
99
    // pass, concatenated.
100
    //aom_fixed_buf_t stats_in;
101
102
    // Indicates the minimum bitrate to be used for a single GOP as a percentage
103
    // of the target bitrate.
104
    int vbrmin_section;
105
    // Indicates the maximum bitrate to be used for a single GOP as a percentage
106
    // of the target bitrate.
107
    int vbrmax_section;
108
} TwoPassCfg;
109
110
typedef struct SwitchFrameCfg {
111
    // Indicates the number of frames after which a frame may be coded as an S-Frame.
112
    int32_t sframe_dist;
113
    // 1: the considered frame will be made into an S-Frame only if it is an altref frame.
114
    // 2: the next altref frame will be made into an S-Frame.
115
    EbSFrameMode sframe_mode;
116
} SwitchFrameCfg;
117
118
// Function return size of frame stats buffer
119
474
static INLINE int get_stats_buf_size(int num_lap_buffer, int num_lag_buffer) {
120
    /* if lookahead is enabled return num_lap_buffers else num_lag_buffers */
121
474
    return (num_lap_buffer > 0 ? num_lap_buffer + 1 : num_lag_buffer);
122
474
}
Unexecuted instantiation: enc_handle.c:get_stats_buf_size
Unexecuted instantiation: enc_settings.c:get_stats_buf_size
Unexecuted instantiation: aom_dsp_rtcd.c:get_stats_buf_size
Unexecuted instantiation: av1me.c:get_stats_buf_size
Unexecuted instantiation: cdef_process.c:get_stats_buf_size
Unexecuted instantiation: corner_match.c:get_stats_buf_size
Unexecuted instantiation: dlf_process.c:get_stats_buf_size
Unexecuted instantiation: enc_cdef.c:get_stats_buf_size
Unexecuted instantiation: enc_dec_process.c:get_stats_buf_size
Unexecuted instantiation: enc_inter_prediction.c:get_stats_buf_size
Unexecuted instantiation: enc_intra_prediction.c:get_stats_buf_size
Unexecuted instantiation: enc_mode_config.c:get_stats_buf_size
Unexecuted instantiation: entropy_coding.c:get_stats_buf_size
Unexecuted instantiation: ec_process.c:get_stats_buf_size
Unexecuted instantiation: full_loop.c:get_stats_buf_size
Unexecuted instantiation: initial_rc_process.c:get_stats_buf_size
Unexecuted instantiation: intra_prediction.c:get_stats_buf_size
Unexecuted instantiation: md_rate_estimation.c:get_stats_buf_size
Unexecuted instantiation: mode_decision.c:get_stats_buf_size
Unexecuted instantiation: md_config_process.c:get_stats_buf_size
Unexecuted instantiation: md_process.c:get_stats_buf_size
Unexecuted instantiation: motion_estimation.c:get_stats_buf_size
Unexecuted instantiation: me_process.c:get_stats_buf_size
Unexecuted instantiation: noise_model.c:get_stats_buf_size
Unexecuted instantiation: packetization_process.c:get_stats_buf_size
Unexecuted instantiation: pic_analysis_process.c:get_stats_buf_size
Unexecuted instantiation: pcs.c:get_stats_buf_size
Unexecuted instantiation: pd_process.c:get_stats_buf_size
Unexecuted instantiation: pic_manager_process.c:get_stats_buf_size
Unexecuted instantiation: pred_structure.c:get_stats_buf_size
Unexecuted instantiation: product_coding_loop.c:get_stats_buf_size
Unexecuted instantiation: rc_aq.c:get_stats_buf_size
Unexecuted instantiation: rc_process.c:get_stats_buf_size
Unexecuted instantiation: rc_rtc_cbr.c:get_stats_buf_size
Unexecuted instantiation: rc_vbr_cbr.c:get_stats_buf_size
Unexecuted instantiation: rd_cost.c:get_stats_buf_size
Unexecuted instantiation: reference_object.c:get_stats_buf_size
Unexecuted instantiation: resize.c:get_stats_buf_size
Unexecuted instantiation: resource_coordination_process.c:get_stats_buf_size
Unexecuted instantiation: rest_process.c:get_stats_buf_size
Unexecuted instantiation: restoration_pick.c:get_stats_buf_size
Unexecuted instantiation: sequence_control_set.c:get_stats_buf_size
Unexecuted instantiation: src_ops_process.c:get_stats_buf_size
Unexecuted instantiation: super_res.c:get_stats_buf_size
Unexecuted instantiation: kernel_dispatch.c:get_stats_buf_size
Unexecuted instantiation: temporal_filtering.c:get_stats_buf_size
Unexecuted instantiation: transforms.c:get_stats_buf_size
Unexecuted instantiation: encode_txb_ref_c.c:get_stats_buf_size
Unexecuted instantiation: adaptive_mv_pred.c:get_stats_buf_size
Unexecuted instantiation: coding_loop.c:get_stats_buf_size
Unexecuted instantiation: coding_unit.c:get_stats_buf_size
Unexecuted instantiation: deblocking_filter.c:get_stats_buf_size
encode_context.c:get_stats_buf_size
Line
Count
Source
119
474
static INLINE int get_stats_buf_size(int num_lap_buffer, int num_lag_buffer) {
120
    /* if lookahead is enabled return num_lap_buffers else num_lag_buffers */
121
474
    return (num_lap_buffer > 0 ? num_lap_buffer + 1 : num_lag_buffer);
122
474
}
Unexecuted instantiation: global_me.c:get_stats_buf_size
Unexecuted instantiation: global_me_cost.c:get_stats_buf_size
Unexecuted instantiation: rc_crf_cqp.c:get_stats_buf_size
Unexecuted instantiation: ransac.c:get_stats_buf_size
123
124
#ifdef __cplusplus
125
} // extern "C"
126
#endif
127
128
#endif // AOM_AV1_ENCODER_ENCODER_H_