 |
AOMedia AV1 Codec
|
Go to the documentation of this file.
15 #ifndef AOM_AV1_ENCODER_ENCODE_STRATEGY_H_
16 #define AOM_AV1_ENCODER_ENCODE_STRATEGY_H_
27 #include "av1/encoder/firstpass.h"
56 uint8_t *
const dest,
unsigned int *frame_flags,
57 int64_t *
const time_stamp, int64_t *
const time_end,
58 const aom_rational64_t *
const timestamp_ratio,
59 int *
const pop_lookahead,
int flush);
65 void av1_configure_buffer_updates(
AV1_COMP *
const cpi,
67 const FRAME_UPDATE_TYPE type,
68 const REFBUF_STATE refbuf_state,
69 int force_refresh_all);
71 int av1_get_refresh_frame_flags(
const AV1_COMP *
const cpi,
73 FRAME_UPDATE_TYPE frame_update_type,
75 #
if CONFIG_FRAME_PARALLEL_ENCODE
77 RefFrameMapPair ref_frame_map_pairs[REF_FRAMES],
79 const RefBufferStack *
const ref_buffer_stack);
81 int av1_get_refresh_ref_frame_map(
int refresh_frame_flags);
83 void av1_update_ref_frame_map(
const AV1_COMP *cpi,
84 FRAME_UPDATE_TYPE frame_update_type,
85 REFBUF_STATE refbuf_state,
int ref_map_index,
86 RefBufferStack *ref_buffer_stack);
100 void av1_get_ref_frames(
const RefBufferStack *ref_buffer_stack,
101 #
if CONFIG_FRAME_PARALLEL_ENCODE
102 RefFrameMapPair ref_frame_map_pairs[REF_FRAMES],
104 #
if CONFIG_FRAME_PARALLEL_ENCODE_2
106 int is_parallel_encode,
109 int remapped_ref_idx[REF_FRAMES]);
111 int is_forced_keyframe_pending(
struct lookahead_ctx *lookahead,
112 const int up_to_index,
113 const COMPRESSOR_STAGE compressor_stage);
115 static AOM_INLINE
int is_frame_droppable(
116 const SVC *
const svc,
120 if (svc->set_ref_frame_config)
121 return svc->non_reference_frame;
132 static AOM_INLINE
int get_current_frame_ref_type(
const AV1_COMP *
const cpi) {
143 case MAX_ARF_LAYERS + 1:
return 4;
148 #if CONFIG_FRAME_PARALLEL_ENCODE
149 #if CONFIG_FRAME_PARALLEL_ENCODE_2
150 int av1_calc_refresh_idx_for_intnl_arf(
151 AV1_COMP *cpi, RefFrameMapPair ref_frame_map_pairs[REF_FRAMES],
153 #endif // CONFIG_FRAME_PARALLEL_ENCODE_2
154 #endif // CONFIG_FRAME_PARALLEL_ENCODE
160 #endif // AOM_AV1_ENCODER_ENCODE_STRATEGY_H_
REAL_TIME_SPEED_FEATURES rt_sf
Definition: speed_features.h:1457
Declares top-level encoder structures and functions.
InterpFilter interp_filter
Definition: av1_common_int.h:411
int av1_rc_pick_q_and_bounds(const struct AV1_COMP *cpi, int width, int height, int gf_index, int *bottom_index, int *top_index)
Picks q and q bounds given the rate control parameters in cpi->rc.
void av1_cyclic_refresh_update_parameters(struct AV1_COMP *const cpi)
Set the global/frame level parameters for cyclic refresh.
bool alt_ref_frame
Definition: encoder.h:2084
ExternalFlags ext_flags
Definition: encoder.h:2765
int ref_frame_flags
Definition: encoder.h:3332
Data related to the current GF/ARF group and the individual frames within the group.
Definition: firstpass.h:344
int av1_check_show_filtered_frame(const YV12_BUFFER_CONFIG *frame, const FRAME_DIFF *frame_diff, int q_index, aom_bit_depth_t bit_depth)
Check whether a filtered frame can be show directly.
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:3607
#define AOM_EFLAG_SET_S_FRAME
Enable s frame mode.
Definition: aomcx.h:159
bool use_error_resilient
Definition: encoder.h:2124
ExtRefreshFrameFlagsInfo refresh_frame
Definition: encoder.h:2103
bool alt_ref_frame
Definition: encoder.h:1978
void av1_set_reference_structure_one_pass_rt(AV1_COMP *cpi, int gf_update)
Setup the reference prediction structure for 1 pass real-time.
Definition: ratectrl.c:2556
bool error_resilient_mode
Definition: av1_common_int.h:404
bool enable_tpl_model
Definition: encoder.h:833
int av1_gop_is_second_arf(const GF_GROUP *gf_group, int gf_frame_index)
Check whether a frame in the GOP is the second arf.
CommonTileParams tiles
Definition: av1_common_int.h:997
TWO_PASS twopass
Definition: encoder.h:2483
SPEED_FEATURES sf
Definition: encoder.h:2833
unsigned int number_spatial_layers
Definition: encoder.h:2518
bool use_s_frame
Definition: encoder.h:2129
ThreadData td
Definition: encoder.h:2647
unsigned char gf_frame_index
Definition: encoder.h:2864
COMPRESSOR_STAGE compressor_stage
Definition: encoder.h:3125
bool use_primary_ref_none
Definition: encoder.h:2135
bool golden_frame
Definition: encoder.h:2081
int ref_frame_flags
Definition: encoder.h:2098
bool alt2_ref_frame
Definition: encoder.h:2083
GF_GROUP gf_group
Definition: encoder.h:2453
@ AOM_CODEC_OK
Operation completed without error.
Definition: aom_codec.h:157
KeyFrameCfg kf_cfg
Definition: encoder.h:911
bool allow_ref_frame_mvs
Definition: av1_common_int.h:385
int av1_encode_strategy(AV1_COMP *const cpi, size_t *const size, uint8_t *const dest, unsigned int *frame_flags, int64_t *const time_stamp, int64_t *const time_end, const aom_rational64_t *const timestamp_ratio, int *const pop_lookahead, int flush)
Implement high-level encode strategy.
Definition: encode_strategy.c:1512
void av1_temporal_filter(struct AV1_COMP *cpi, const int filter_frame_lookahead_idx, int gf_frame_index, FRAME_DIFF *frame_diff, YV12_BUFFER_CONFIG *output_frame)
Performs temporal filtering if needed on a source frame. For example to create a filtered alternate r...
#define AOM_EFLAG_FORCE_KF
Force this frame to be a keyframe.
Definition: aom_encoder.h:378
Describes the codec algorithm interface to applications.
TWO_PASS_FRAME twopass_frame
Definition: encoder.h:3274
Main encoder configuration data structure.
Definition: encoder.h:894
@ AOM_RC_FIRST_PASS
Definition: aom_encoder.h:177
RefCntBuffer * cur_frame
Definition: av1_common_int.h:837
unsigned int number_temporal_layers
Definition: encoder.h:2513
bool refresh_frame_context
Definition: encoder.h:2108
@ AOM_CODEC_ERROR
Unspecified error.
Definition: aom_codec.h:160
Top level encoder structure.
Definition: encoder.h:2632
int remapped_ref_idx[REF_FRAMES]
Definition: encoder.h:3337
Frame time stamps.
Definition: encoder.h:2239
int height
Definition: av1_common_int.h:781
int droppable
Definition: encoder.h:2892
TplParams tpl_data
Definition: encoder.h:2551
The stucture of SVC.
Definition: svc_layercontext.h:87
YV12_BUFFER_CONFIG * unscaled_source
Definition: encoder.h:2708
int av1_encode(AV1_COMP *const cpi, uint8_t *const dest, const EncodeFrameInput *const frame_input, const EncodeFrameParams *const frame_params, EncodeFrameResults *const frame_results)
Run 1-pass/2-pass encoding.
Definition: encoder.c:3617
int64_t prev_ts_end
Definition: encoder.h:2247
#define AOM_EFLAG_ERROR_RESILIENT
Enable error resilient frame.
Definition: aomcx.h:153
enum aom_rc_mode mode
Definition: encoder.h:587
FRAME_TYPE frame_type
Definition: encoder.h:3310
Refresh frame flags for different type of frames.
Definition: encoder.h:1975
TEMPORAL_FILTER_INFO tf_info
Definition: encoder.h:2493
SequenceHeader * seq_params
Definition: av1_common_int.h:981
struct lookahead_ctx * lookahead
Definition: encoder.h:2425
MV_STATS mv_stats
Definition: encoder.h:2556
AV1_COMMON common
Definition: encoder.h:2675
int error_resilient_mode
Definition: encoder.h:3306
REFRESH_FRAME_CONTEXT_MODE refresh_frame_context
Definition: av1_common_int.h:425
int superres_upscaled_width
Definition: av1_common_int.h:804
bool last_frame
Definition: encoder.h:2080
bool golden_frame
Definition: encoder.h:1976
bool using_qmatrix
Definition: av1_common_int.h:701
Declares frame encoding functions.
int av1_tpl_setup_stats(struct AV1_COMP *cpi, int gop_eval, const struct EncodeFrameParams *const frame_params)
Implements temporal dependency modelling for a GOP (GF/ARF group) and selects between 16 and 32 frame...
aom_film_grain_t film_grain_params
Definition: av1_common_int.h:965
uint32_t frame_presentation_time
Definition: av1_common_int.h:826
void av1_get_one_pass_rt_params(AV1_COMP *cpi, EncodeFrameParams *const frame_params, unsigned int frame_flags)
Setup the rate control parameters for 1 pass real-time mode.
Definition: ratectrl.c:2938
aom_film_grain_table_t * film_grain_table
Definition: encoder.h:3026
int av1_lookahead_pop_sz(struct lookahead_ctx *ctx, COMPRESSOR_STAGE stage)
Get pop_sz value.
static int has_no_stats_stage(const AV1_COMP *const cpi)
Check if the current stage has statistics.
Definition: encoder.h:3732
RefBufferStack ref_buffer_stack
Definition: encoder.h:2869
@ AOM_CODEC_MEM_ERROR
Memory operation failed.
Definition: aom_codec.h:163
enum aom_enc_pass pass
Definition: encoder.h:1019
PRIMARY_RATE_CONTROL p_rc
Definition: encoder.h:2488
int speed
Definition: encoder.h:3348
HIGH_LEVEL_SPEED_FEATURES hl_sf
Definition: speed_features.h:1392
unsigned int large_scale
Definition: av1_common_int.h:492
int show_existing_alt_ref
Definition: encoder.h:2448
int64_t prev_ts_start
Definition: encoder.h:2243
TPL_SPEED_FEATURES tpl_sf
Definition: speed_features.h:1402
CommonQuantParams quant_params
Definition: av1_common_int.h:927
int use_svc
Definition: encoder.h:2503
YV12 frame buffer data structure.
Definition: yv12config.h:39
TimeStamps time_stamps
Definition: encoder.h:2808
Describes the encoder algorithm interface to applications.
Flags signalled by the external interface at frame level.
Definition: encoder.h:2094
RATE_CONTROL rc
Definition: encoder.h:2813
Top level common structure used by both encoder and decoder.
Definition: av1_common_int.h:755
bool use_ref_frame_mvs
Definition: encoder.h:2119
YV12_BUFFER_CONFIG * unfiltered_source
Definition: encoder.h:2729
int av1_svc_primary_ref_frame(const struct AV1_COMP *const cpi)
Get primary reference frame for current layer.
@ AOM_Q
Definition: aom_encoder.h:188
AlgoCfg algo_cfg
Definition: encoder.h:906
YV12_BUFFER_CONFIG scaled_source
Definition: encoder.h:2713
bool bwd_ref_frame
Definition: encoder.h:1977
RefreshFrameInfo refresh_frame
Definition: encoder.h:2760
int skip_tpl_setup_stats
Definition: encoder.h:2734
double framerate
Definition: encoder.h:2818
struct lookahead_entry * av1_lookahead_peek(struct lookahead_ctx *ctx, int index, COMPRESSOR_STAGE stage)
Get a future source buffer to encode.
contains per-frame encoding parameters decided upon by av1_encode_strategy() and passed down to av1_e...
Definition: encoder.h:3302
int second_alt_ref_filtering
Definition: speed_features.h:393
RefCntBuffer * ref_frame_map[REF_FRAMES]
Definition: av1_common_int.h:883
AV1_PRIMARY * ppi
Definition: encoder.h:2636
YV12_BUFFER_CONFIG tf_buf_second_arf
Definition: temporal_filter.h:173
Variables related to current coding block.
Definition: blockd.h:577
int enable_keyframe_filtering
Definition: encoder.h:459
int superres_upscaled_height
Definition: av1_common_int.h:805
bool refresh_frame_context_pending
Definition: encoder.h:2114
MACROBLOCKD e_mbd
Decoder's view of current coding block.
Definition: block.h:796
bool bwd_ref_frame
Definition: encoder.h:2082
unsigned int av1_lookahead_depth(struct lookahead_ctx *ctx, COMPRESSOR_STAGE stage)
Get the number of frames currently in the lookahead queue.
bool enable_sframe
Definition: encoder.h:492
int fb_of_context_type[REF_FRAMES]
Definition: encoder.h:2608
int width
Definition: av1_common_int.h:780
AV1EncoderConfig oxcf
Definition: encoder.h:2680
RefreshFrameInfo refresh_frame
Definition: encoder.h:3343
int64_t first_ts_start
Definition: encoder.h:2251
Frame refresh flags set by the external interface.
Definition: encoder.h:2079
RateControlCfg rc_cfg
Definition: encoder.h:916
double rate_correction_factors[RATE_FACTOR_LEVELS]
Definition: ratectrl.h:467
bool update_pending
Definition: encoder.h:2088
int showable_frame
Definition: av1_common_int.h:898
CurrentFrame current_frame
Definition: av1_common_int.h:759
FeatureFlags features
Definition: av1_common_int.h:910
YV12_BUFFER_CONFIG * source
Definition: encoder.h:2693
CommonModeInfoParams mi_params
Definition: av1_common_int.h:915
int show_frame
Definition: encoder.h:3320
Encoder's parameters related to the current coding block.
Definition: block.h:778
int remapped_ref_idx[REF_FRAMES]
Definition: av1_common_int.h:859
int frames_to_key
Definition: ratectrl.h:172
int key_freq_max
Definition: encoder.h:454
SVC svc
Definition: encoder.h:3120