AOMedia AV1 Codec: av1/encoder/pass2_strategy.h Source File

| 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;
20struct EncodeFrameParams;
21
22#include "av1/encoder/encoder.h"
23
28 typedef struct {
30 double gf_group_err;
31 double gf_group_raw_error;
32 double gf_group_skip_pct;
33 double gf_group_inactive_zone_rows;
34
35 double mv_ratio_accumulator;
36 double decay_accumulator;
37 double zero_motion_accumulator;
38 double loop_decay_rate;
39 double last_loop_decay_rate;
40 double this_frame_mv_in_out;
41 double mv_in_out_accumulator;
42 double abs_mv_in_out_accumulator;
43
44 double avg_sr_coded_error;
45 double avg_pcnt_second_ref;
46 double avg_new_mv_count;
47 double avg_wavelet_energy;
48 double avg_raw_err_stdev;
49 int non_zero_stdev_count;
51} GF_GROUP_STATS;
52
56 typedef struct {
58 double frame_err;
59 double frame_coded_error;
60 double frame_sr_coded_error;
62} GF_FRAME_STATS;
65void av1_init_second_pass(struct AV1_COMP *cpi);
66
67void av1_init_single_pass_lap(AV1_COMP *cpi);
68
89void av1_get_second_pass_params(struct AV1_COMP *cpi,
90 struct EncodeFrameParams *const frame_params,
91 unsigned int frame_flags);
92
106void av1_twopass_postencode_update(struct AV1_COMP *cpi);
107
127void av1_gop_bit_allocation(const AV1_COMP *cpi, RATE_CONTROL *const rc,
128 GF_GROUP *gf_group, int is_key_frame, int use_arf,
129 int64_t gf_group_bits);
130
131int av1_calc_arf_boost(const TWO_PASS *twopass,
132 const TWO_PASS_FRAME *twopass_frame,
133 const PRIMARY_RATE_CONTROL *p_rc, FRAME_INFO *frame_info,
134 int offset, int f_frames, int b_frames,
135 int *num_fpstats_used, int *num_fpstats_required,
136 int project_gfu_boost);
137
138void av1_accumulate_next_frame_stats(const FIRSTPASS_STATS *stats,
139 const int flash_detected,
140 const int frames_since_key,
141 const int cur_idx,
142 GF_GROUP_STATS *gf_stats, int f_w,
143 int f_h);
144// Identify stable and unstable regions from first pass stats.
145// stats_start points to the first frame to analyze.
146// |offset| is the offset from the current frame to the frame stats_start is
147// pointing to.
148void av1_identify_regions(const FIRSTPASS_STATS *const stats_start,
149 int total_frames, int offset, REGIONS *regions,
150 int *total_regions);
151
152#ifdef __cplusplus
153} // extern "C"
154#endif
155
156#endif // AOM_AV1_ENCODER_PASS2_STRATEGY_H_
encoder.h
Declares top-level encoder structures and functions.
av1_get_second_pass_params
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:3622
av1_gop_bit_allocation
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:2644
av1_twopass_postencode_update
void av1_twopass_postencode_update(struct AV1_COMP *cpi)
Adjustments to two pass and rate control after each frame.
Definition: pass2_strategy.c:4002
FIRSTPASS_STATS
The stucture of acummulated frame stats in the first pass.
Definition: firstpass.h:41
GF_FRAME_STATS
accumulated stats and features for a frame
Definition: pass2_strategy.h:56
GF_GROUP_STATS
accumulated stats and features in a gf group
Definition: pass2_strategy.h:28
GF_GROUP
Data related to the current GF/ARF group and the individual frames within the group.
Definition: firstpass.h:344
PRIMARY_RATE_CONTROL
Primary Rate Control parameters and status.
Definition: ratectrl.h:261
RATE_CONTROL
Rate Control parameters and status.
Definition: ratectrl.h:134
TWO_PASS_FRAME
Frame level Two pass status and control data.
Definition: firstpass.h:455
TWO_PASS
Two pass status and control data.
Definition: firstpass.h:412