AOMedia AV1 Codec
pass2_strategy.h
1/*
2 * Copyright (c) 2019, 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#ifndef AOM_AV1_ENCODER_PASS2_STRATEGY_H_
13#define AOM_AV1_ENCODER_PASS2_STRATEGY_H_
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19struct AV1_COMP;
21
22#include "av1/encoder/encoder.h"
23
27typedef struct {
29 double gf_group_err;
30 double gf_group_raw_error;
31 double gf_group_skip_pct;
32 double gf_group_inactive_zone_rows;
33
34 double mv_ratio_accumulator;
35 double decay_accumulator;
36 double zero_motion_accumulator;
37 double loop_decay_rate;
38 double last_loop_decay_rate;
39 double this_frame_mv_in_out;
40 double mv_in_out_accumulator;
41 double abs_mv_in_out_accumulator;
42
43 double avg_sr_coded_error;
44 double avg_pcnt_second_ref;
45 double avg_new_mv_count;
46 double avg_wavelet_energy;
47 double avg_raw_err_stdev;
48 int non_zero_stdev_count;
51
55typedef struct {
57 double frame_err;
58 double frame_coded_error;
59 double frame_sr_coded_error;
64void av1_init_second_pass(struct AV1_COMP *cpi);
65
66void av1_init_single_pass_lap(AV1_COMP *cpi);
67
89 struct EncodeFrameParams *const frame_params,
90 unsigned int frame_flags);
91
106
126void av1_gop_bit_allocation(const AV1_COMP *cpi, RATE_CONTROL *const rc,
127 GF_GROUP *gf_group, int is_key_frame, int use_arf,
128 int64_t gf_group_bits);
129
130int av1_calc_arf_boost(const TWO_PASS *twopass,
131 const TWO_PASS_FRAME *twopass_frame,
132 const PRIMARY_RATE_CONTROL *p_rc, FRAME_INFO *frame_info,
133 int offset, int f_frames, int b_frames,
134 int *num_fpstats_used, int *num_fpstats_required,
135 int project_gfu_boost);
136
137void av1_mark_flashes(FIRSTPASS_STATS *first_stats,
138 FIRSTPASS_STATS *last_stats);
139void av1_estimate_noise(FIRSTPASS_STATS *first_stats,
140 FIRSTPASS_STATS *last_stats,
141 struct aom_internal_error_info *error_info);
142void av1_estimate_coeff(FIRSTPASS_STATS *first_stats,
143 FIRSTPASS_STATS *last_stats);
144
145#ifdef __cplusplus
146} // extern "C"
147#endif
148
149#endif // AOM_AV1_ENCODER_PASS2_STRATEGY_H_
Declares top-level encoder structures and functions.
void av1_get_second_pass_params(struct AV1_COMP *cpi, struct EncodeFrameParams *const frame_params, unsigned int frame_flags)
Main per frame entry point for second pass of two pass encode.
Definition pass2_strategy.c:3701
void av1_gop_bit_allocation(const AV1_COMP *cpi, RATE_CONTROL *const rc, GF_GROUP *gf_group, int is_key_frame, int use_arf, int64_t gf_group_bits)
Distributes bits to frames in a group.
Definition pass2_strategy.c:2685
void av1_twopass_postencode_update(struct AV1_COMP *cpi)
Adjustments to two pass and rate control after each frame.
Definition pass2_strategy.c:4122
Top level encoder structure.
Definition encoder.h:2870
contains per-frame encoding parameters decided upon by av1_encode_strategy() and passed down to av1_e...
Definition encoder.h:3686
The stucture of acummulated frame stats in the first pass.
Definition firstpass.h:43
accumulated stats and features for a frame
Definition pass2_strategy.h:55
accumulated stats and features in a gf group
Definition pass2_strategy.h:27
Data related to the current GF/ARF group and the individual frames within the group.
Definition firstpass.h:339
Primary Rate Control parameters and status.
Definition ratectrl.h:300
Rate Control parameters and status.
Definition ratectrl.h:134
Frame level Two pass status and control data.
Definition firstpass.h:458
Two pass status and control data.
Definition firstpass.h:416