15 #ifndef AOM_AV1_ENCODER_ENCODER_H_ 16 #define AOM_AV1_ENCODER_ENCODER_H_ 21 #include "config/aom_config.h" 25 #include "av1/common/alloccommon.h" 26 #include "av1/common/av1_common_int.h" 27 #include "av1/common/blockd.h" 28 #include "av1/common/entropymode.h" 30 #include "av1/common/resize.h" 31 #include "av1/common/thread_common.h" 32 #include "av1/common/timing.h" 33 #include "av1/encoder/aq_cyclicrefresh.h" 34 #include "av1/encoder/av1_quantize.h" 36 #include "av1/encoder/context_tree.h" 37 #include "av1/encoder/encodemb.h" 38 #include "av1/encoder/firstpass.h" 39 #include "av1/encoder/global_motion.h" 40 #include "av1/encoder/level.h" 42 #include "av1/encoder/mcomp.h" 43 #include "av1/encoder/pickcdef.h" 44 #include "av1/encoder/ratectrl.h" 45 #include "av1/encoder/rd.h" 47 #include "av1/encoder/svc_layercontext.h" 48 #include "av1/encoder/temporal_filter.h" 49 #include "av1/encoder/tokenize.h" 50 #include "av1/encoder/tpl_model.h" 51 #include "av1/encoder/av1_noise_estimate.h" 53 #if CONFIG_INTERNAL_STATS 54 #include "aom_dsp/ssim.h" 56 #include "aom_dsp/variance.h" 58 #include "aom_dsp/noise_model.h" 61 #include "av1/encoder/tune_vmaf.h" 63 #if CONFIG_AV1_TEMPORAL_DENOISING 64 #include "av1/encoder/av1_temporal_denoiser.h" 66 #if CONFIG_TUNE_BUTTERAUGLI 67 #include "av1/encoder/tune_butteraugli.h" 70 #include "aom/internal/aom_codec_internal.h" 71 #include "aom_util/aom_thread.h" 81 #define SCENE_CUT_KEY_TEST_INTERVAL 16 85 typedef struct aom_rational64 {
98 } UENUM1BYTE(AOM_SCALING);
112 FRAMEFLAGS_KEY = 1 << 0,
113 FRAMEFLAGS_GOLDEN = 1 << 1,
114 FRAMEFLAGS_BWDREF = 1 << 2,
116 FRAMEFLAGS_ALTREF = 1 << 3,
117 FRAMEFLAGS_INTRAONLY = 1 << 4,
118 FRAMEFLAGS_SWITCH = 1 << 5,
119 FRAMEFLAGS_ERROR_RESILIENT = 1 << 6,
120 } UENUM1BYTE(FRAMETYPE_FLAGS);
126 CYCLIC_REFRESH_AQ = 3,
128 } UENUM1BYTE(AQ_MODE);
131 DELTA_Q_OBJECTIVE = 1,
132 DELTA_Q_PERCEPTUAL = 2,
134 } UENUM1BYTE(DELTAQ_MODE);
142 } UENUM1BYTE(RESIZE_MODE);
146 SS_CFG_LOOKAHEAD = 1,
149 } UENUM1BYTE(SS_CFG_OFFSET);
153 ENABLE_SCENECUT_MODE_1,
154 ENABLE_SCENECUT_MODE_2
155 } UENUM1BYTE(SCENECUT_MODE);
157 #define MAX_VBR_CORPUS_COMPLEXITY 10000 171 } MULTI_THREADED_MODULES;
543 int gf_min_pyr_height;
545 int gf_max_pyr_height;
547 bool enable_auto_arf;
550 bool enable_auto_brf;
555 unsigned int num_tile_groups;
564 int tile_width_count;
566 int tile_height_count;
568 int tile_widths[MAX_TILE_COLS];
570 int tile_heights[MAX_TILE_ROWS];
572 bool enable_large_scale_tile;
574 bool enable_single_tile_decoding;
576 bool enable_ext_tile_debug;
586 int forced_max_frame_width;
589 int forced_max_frame_height;
600 bool enable_warped_motion;
602 bool allow_warped_motion;
609 aom_timing_info_t timing_info;
611 uint32_t num_units_in_decoding_tick;
614 bool decoder_model_info_present_flag;
617 bool display_model_info_present_flag;
619 bool timing_info_present;
635 unsigned int max_reference_frames;
637 bool enable_reduced_reference_set;
639 bool enable_onesided_comp;
657 unsigned int motion_vector_unit_test;
659 unsigned int sb_multipass_unit_test;
664 const char *vmaf_model_path;
666 const char *film_grain_table_filename;
672 int film_grain_test_vector;
677 double init_framerate;
679 unsigned int input_bit_depth;
683 unsigned int chroma_subsampling_x;
685 unsigned int chroma_subsampling_y;
696 int use_fixed_qp_offsets;
706 DELTAQ_MODE deltaq_mode;
708 bool enable_chroma_deltaq;
769 bool enable_deltalf_mode;
773 bool enable_restoration;
775 bool force_video_mode;
777 bool error_resilient_mode;
779 bool frame_parallel_decoding_mode;
781 bool enable_monochrome;
784 bool full_still_picture_hdr;
786 bool enable_dual_filter;
788 bool enable_order_hint;
790 bool ref_frame_mvs_present;
792 bool enable_ref_frame_mvs;
794 bool enable_interintra_comp;
796 bool enable_global_motion;
811 FrameDimensionCfg frm_dim_cfg;
831 QuantizationCfg q_cfg;
863 DecoderModelCfg dec_model_cfg;
866 RefFrameCfg ref_frm_cfg;
869 UnitTestCfg unit_test_cfg;
872 MotionModeCfg motion_mode_cfg;
887 CostUpdateFreq cost_upd_freq;
893 int noise_block_size;
895 int enable_dnl_denoising;
898 #if CONFIG_AV1_TEMPORAL_DENOISING 900 int noise_sensitivity;
904 unsigned int tier_mask;
908 int border_in_pixels;
917 AV1_LEVEL target_seq_level_idx[MAX_NUM_OPERATING_POINTS];
920 BITSTREAM_PROFILE profile;
941 bool use_highbitdepth;
952 static INLINE
int is_lossless_requested(
const RateControlCfg *
const rc_cfg) {
966 int obmc_probs[FRAME_UPDATE_TYPES][BLOCK_SIZES_ALL];
973 int warped_probs[FRAME_UPDATE_TYPES];
981 int tx_type_probs[FRAME_UPDATE_TYPES][TX_SIZES_ALL][TX_TYPES];
989 int switchable_interp_probs[FRAME_UPDATE_TYPES][SWITCHABLE_FILTER_CONTEXTS]
990 [SWITCHABLE_FILTERS];
995 typedef struct FRAME_COUNTS {
998 #if CONFIG_ENTROPY_STATS 999 unsigned int kf_y_mode[KF_MODE_CONTEXTS][KF_MODE_CONTEXTS][INTRA_MODES];
1000 unsigned int angle_delta[DIRECTIONAL_MODES][2 * MAX_ANGLE_DELTA + 1];
1001 unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
1002 unsigned int uv_mode[CFL_ALLOWED_TYPES][INTRA_MODES][UV_INTRA_MODES];
1003 unsigned int cfl_sign[CFL_JOINT_SIGNS];
1004 unsigned int cfl_alpha[CFL_ALPHA_CONTEXTS][CFL_ALPHABET_SIZE];
1005 unsigned int palette_y_mode[PALATTE_BSIZE_CTXS][PALETTE_Y_MODE_CONTEXTS][2];
1006 unsigned int palette_uv_mode[PALETTE_UV_MODE_CONTEXTS][2];
1007 unsigned int palette_y_size[PALATTE_BSIZE_CTXS][PALETTE_SIZES];
1008 unsigned int palette_uv_size[PALATTE_BSIZE_CTXS][PALETTE_SIZES];
1009 unsigned int palette_y_color_index[PALETTE_SIZES]
1010 [PALETTE_COLOR_INDEX_CONTEXTS]
1012 unsigned int palette_uv_color_index[PALETTE_SIZES]
1013 [PALETTE_COLOR_INDEX_CONTEXTS]
1015 unsigned int partition[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
1016 unsigned int txb_skip[TOKEN_CDF_Q_CTXS][TX_SIZES][TXB_SKIP_CONTEXTS][2];
1017 unsigned int eob_extra[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES]
1018 [EOB_COEF_CONTEXTS][2];
1019 unsigned int dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS][2];
1020 unsigned int coeff_lps[TX_SIZES][PLANE_TYPES][BR_CDF_SIZE - 1][LEVEL_CONTEXTS]
1022 unsigned int eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS][2];
1023 unsigned int eob_multi16[TOKEN_CDF_Q_CTXS][PLANE_TYPES][2][5];
1024 unsigned int eob_multi32[TOKEN_CDF_Q_CTXS][PLANE_TYPES][2][6];
1025 unsigned int eob_multi64[TOKEN_CDF_Q_CTXS][PLANE_TYPES][2][7];
1026 unsigned int eob_multi128[TOKEN_CDF_Q_CTXS][PLANE_TYPES][2][8];
1027 unsigned int eob_multi256[TOKEN_CDF_Q_CTXS][PLANE_TYPES][2][9];
1028 unsigned int eob_multi512[TOKEN_CDF_Q_CTXS][PLANE_TYPES][2][10];
1029 unsigned int eob_multi1024[TOKEN_CDF_Q_CTXS][PLANE_TYPES][2][11];
1030 unsigned int coeff_lps_multi[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES]
1031 [LEVEL_CONTEXTS][BR_CDF_SIZE];
1032 unsigned int coeff_base_multi[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES]
1033 [SIG_COEF_CONTEXTS][NUM_BASE_LEVELS + 2];
1034 unsigned int coeff_base_eob_multi[TOKEN_CDF_Q_CTXS][TX_SIZES][PLANE_TYPES]
1035 [SIG_COEF_CONTEXTS_EOB][NUM_BASE_LEVELS + 1];
1036 unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2];
1037 unsigned int zeromv_mode[GLOBALMV_MODE_CONTEXTS][2];
1038 unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2];
1039 unsigned int drl_mode[DRL_MODE_CONTEXTS][2];
1040 unsigned int inter_compound_mode[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
1041 unsigned int wedge_idx[BLOCK_SIZES_ALL][16];
1042 unsigned int interintra[BLOCK_SIZE_GROUPS][2];
1043 unsigned int interintra_mode[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
1044 unsigned int wedge_interintra[BLOCK_SIZES_ALL][2];
1045 unsigned int compound_type[BLOCK_SIZES_ALL][MASKED_COMPOUND_TYPES];
1046 unsigned int motion_mode[BLOCK_SIZES_ALL][MOTION_MODES];
1047 unsigned int obmc[BLOCK_SIZES_ALL][2];
1048 unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
1049 unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
1050 unsigned int comp_ref_type[COMP_REF_TYPE_CONTEXTS][2];
1051 unsigned int uni_comp_ref[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1][2];
1052 unsigned int single_ref[REF_CONTEXTS][SINGLE_REFS - 1][2];
1053 unsigned int comp_ref[REF_CONTEXTS][FWD_REFS - 1][2];
1054 unsigned int comp_bwdref[REF_CONTEXTS][BWD_REFS - 1][2];
1055 unsigned int intrabc[2];
1057 unsigned int txfm_partition[TXFM_PARTITION_CONTEXTS][2];
1058 unsigned int intra_tx_size[MAX_TX_CATS][TX_SIZE_CONTEXTS][MAX_TX_DEPTH + 1];
1059 unsigned int skip_mode[SKIP_MODE_CONTEXTS][2];
1060 unsigned int skip_txfm[SKIP_CONTEXTS][2];
1061 unsigned int compound_index[COMP_INDEX_CONTEXTS][2];
1062 unsigned int comp_group_idx[COMP_GROUP_IDX_CONTEXTS][2];
1063 unsigned int delta_q[DELTA_Q_PROBS][2];
1064 unsigned int delta_lf_multi[FRAME_LF_COUNT][DELTA_LF_PROBS][2];
1065 unsigned int delta_lf[DELTA_LF_PROBS][2];
1067 unsigned int inter_ext_tx[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
1068 unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
1070 unsigned int filter_intra_mode[FILTER_INTRA_MODES];
1071 unsigned int filter_intra[BLOCK_SIZES_ALL][2];
1073 unsigned int wiener_restore[2];
1074 unsigned int sgrproj_restore[2];
1075 #endif // CONFIG_ENTROPY_STATS 1077 unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
1078 [SWITCHABLE_FILTERS];
1081 #define INTER_MODE_RD_DATA_OVERALL_SIZE 6400 1090 double sse_sse_mean;
1106 #define MAX_INTER_MODES 1024 1164 uint32_t sum_square_error;
1177 VPVariance part_variances;
1182 VPVariance part_variances;
1187 VPVariance part_variances;
1192 VPVariance part_variances;
1197 VPVariance part_variances;
1202 VPVariance part_variances;
1220 int64_t thresholds[5];
1233 #if CONFIG_MULTITHREAD 1241 #endif // CONFIG_MULTITHREAD 1271 typedef struct TileDataEnc {
1273 DECLARE_ALIGNED(16, FRAME_CONTEXT, tctx);
1274 FRAME_CONTEXT *row_ctx;
1275 uint8_t allow_update_cdf;
1276 InterModeRdModel inter_mode_rd_models[BLOCK_SIZES_ALL];
1278 MV firstpass_top_mv;
1281 typedef struct RD_COUNTS {
1282 int64_t comp_pred_diff[REFERENCE_MODES];
1283 int compound_ref_used_flag;
1284 int skip_mode_used_flag;
1285 int tx_type_used[TX_SIZES_ALL][TX_TYPES];
1286 int obmc_used[BLOCK_SIZES_ALL][2];
1290 typedef struct ThreadData {
1292 RD_COUNTS rd_counts;
1293 FRAME_COUNTS *counts;
1294 PC_TREE_SHARED_BUFFERS shared_coeff_buf;
1295 SIMPLE_MOTION_DATA_TREE *sms_tree;
1296 SIMPLE_MOTION_DATA_TREE *sms_root;
1298 uint32_t *hash_value_buffer[2][2];
1302 CONV_BUF_TYPE *tmp_conv_dst;
1303 uint8_t *tmp_pred_bufs[2];
1306 FRAME_CONTEXT *tctx;
1308 int32_t num_64x64_blocks;
1309 PICK_MODE_CONTEXT *firstpass_ctx;
1310 TemporalFilterData tf_data;
1311 TplTxfmStats tpl_txfm_stats;
1314 struct EncWorkerData;
1348 int thread_id_to_tile_id[MAX_NUM_THREADS];
1350 #if CONFIG_MULTITHREAD 1453 typedef struct ActiveMap {
1469 double cs_rate_array[32];
1482 #if CONFIG_INTERNAL_STATS 1490 } UENUM1BYTE(StatType);
1492 typedef struct IMAGE_STAT {
1493 double stat[NUM_STAT_TYPES];
1496 #endif // CONFIG_INTERNAL_STATS 1528 #if CONFIG_COLLECT_PARTITION_STATS 1529 typedef struct FramePartitionTimingStats {
1530 int partition_decisions[6][EXT_PARTITION_TYPES];
1531 int partition_attempts[6][EXT_PARTITION_TYPES];
1532 int64_t partition_times[6][EXT_PARTITION_TYPES];
1535 } FramePartitionTimingStats;
1536 #endif // CONFIG_COLLECT_PARTITION_STATS 1538 #if CONFIG_COLLECT_COMPONENT_TIMING 1539 #include "aom_ports/aom_timer.h" 1542 av1_encode_strategy_time,
1543 av1_get_second_pass_params_time,
1544 denoise_and_encode_time,
1545 apply_filtering_time,
1546 av1_tpl_setup_stats_time,
1547 encode_frame_to_data_rate_time,
1548 encode_with_recode_loop_time,
1551 loop_restoration_time,
1552 av1_pack_bitstream_final_time,
1553 av1_encode_frame_time,
1554 av1_compute_global_motion_time,
1555 av1_setup_motion_field_time,
1558 rd_pick_partition_time,
1559 av1_prune_partitions_time,
1560 none_partition_search_time,
1561 split_partition_search_time,
1562 rectangular_partition_search_time,
1563 ab_partitions_search_time,
1564 rd_pick_4partition_time,
1567 rd_pick_sb_modes_time,
1568 av1_rd_pick_intra_mode_sb_time,
1569 av1_rd_pick_inter_mode_sb_time,
1570 handle_inter_mode_time,
1571 evaluate_motion_mode_for_winner_candidates_time,
1572 handle_intra_mode_time,
1574 av1_search_palette_mode_time,
1576 compound_type_rd_time,
1577 interpolation_filter_search_time,
1578 motion_mode_rd_time,
1580 } UENUM1BYTE(TIMING_COMPONENT);
1582 static INLINE
char const *get_component_name(
int index) {
1584 case av1_encode_strategy_time:
return "av1_encode_strategy_time";
1585 case av1_get_second_pass_params_time:
1586 return "av1_get_second_pass_params_time";
1587 case denoise_and_encode_time:
return "denoise_and_encode_time";
1588 case apply_filtering_time:
return "apply_filtering_time";
1589 case av1_tpl_setup_stats_time:
return "av1_tpl_setup_stats_time";
1590 case encode_frame_to_data_rate_time:
1591 return "encode_frame_to_data_rate_time";
1592 case encode_with_recode_loop_time:
return "encode_with_recode_loop_time";
1593 case loop_filter_time:
return "loop_filter_time";
1594 case cdef_time:
return "cdef_time";
1595 case loop_restoration_time:
return "loop_restoration_time";
1596 case av1_pack_bitstream_final_time:
return "av1_pack_bitstream_final_time";
1597 case av1_encode_frame_time:
return "av1_encode_frame_time";
1598 case av1_compute_global_motion_time:
1599 return "av1_compute_global_motion_time";
1600 case av1_setup_motion_field_time:
return "av1_setup_motion_field_time";
1601 case encode_sb_row_time:
return "encode_sb_row_time";
1603 case rd_pick_partition_time:
return "rd_pick_partition_time";
1604 case av1_prune_partitions_time:
return "av1_prune_partitions_time";
1605 case none_partition_search_time:
return "none_partition_search_time";
1606 case split_partition_search_time:
return "split_partition_search_time";
1607 case rectangular_partition_search_time:
1608 return "rectangular_partition_search_time";
1609 case ab_partitions_search_time:
return "ab_partitions_search_time";
1610 case rd_pick_4partition_time:
return "rd_pick_4partition_time";
1611 case encode_sb_time:
return "encode_sb_time";
1613 case rd_pick_sb_modes_time:
return "rd_pick_sb_modes_time";
1614 case av1_rd_pick_intra_mode_sb_time:
1615 return "av1_rd_pick_intra_mode_sb_time";
1616 case av1_rd_pick_inter_mode_sb_time:
1617 return "av1_rd_pick_inter_mode_sb_time";
1618 case handle_inter_mode_time:
return "handle_inter_mode_time";
1619 case evaluate_motion_mode_for_winner_candidates_time:
1620 return "evaluate_motion_mode_for_winner_candidates_time";
1621 case handle_intra_mode_time:
return "handle_intra_mode_time";
1622 case do_tx_search_time:
return "do_tx_search_time";
1623 case av1_search_palette_mode_time:
return "av1_search_palette_mode_time";
1624 case handle_newmv_time:
return "handle_newmv_time";
1625 case compound_type_rd_time:
return "compound_type_rd_time";
1626 case interpolation_filter_search_time:
1627 return "interpolation_filter_search_time";
1628 case motion_mode_rd_time:
return "motion_mode_rd_time";
1636 #define MAX_INTERNAL_ARFS (REF_FRAMES - BWDREF_FRAME - 1) 1666 int num_ref_frames[MAX_DIRECTIONS];
1674 FrameDistPair reference_frames[MAX_DIRECTIONS][REF_FRAMES - 1];
1694 int src_corners[2 * MAX_CORNERS];
1756 search_site_config search_site_cfg[SS_CFG_TOTAL][NUM_DISTINCT_SEARCH_METHODS];
1792 int ref_relative_dist[INTER_REFS_PER_FRAME];
1826 unsigned int coeff_opt_thresholds[MODE_EVAL_TYPES][2];
1832 TX_SIZE_SEARCH_METHOD tx_size_search_methods[MODE_EVAL_TYPES];
1840 unsigned int use_transform_domain_distortion[MODE_EVAL_TYPES];
1847 unsigned int tx_domain_dist_threshold[MODE_EVAL_TYPES];
1854 unsigned int skip_txfm_level[MODE_EVAL_TYPES];
1861 unsigned int predict_dc_level[MODE_EVAL_TYPES];
1933 int arf_stack[FRAME_BUFFERS];
1935 int lst_stack[FRAME_BUFFERS];
1937 int gld_stack[FRAME_BUFFERS];
1951 int mv_joint_count[4];
1953 int last_bit_nonzero;
1957 int hp_total_mv_rate;
1958 int lp_total_mv_rate;
1970 struct loopfilter lf;
1994 int show_frame_count;
2347 aom_variance_fn_ptr_t
fn_ptr[BLOCK_SIZES_ALL];
2385 #if CONFIG_INTERNAL_STATS 2387 uint64_t time_receive_data;
2388 uint64_t time_compress_data;
2390 unsigned int mode_chosen_counts[MAX_MODES];
2393 uint64_t total_sq_error[2];
2394 uint64_t total_samples[2];
2397 double total_blockiness;
2398 double worst_blockiness;
2401 double summed_quality;
2402 double summed_weights;
2403 double summed_quality_hbd;
2404 double summed_weights_hbd;
2405 unsigned int tot_recode_hits;
2407 double worst_ssim_hbd;
2412 int b_calculate_blockiness;
2413 int b_calculate_consistency;
2415 double total_inconsistency;
2416 double worst_consistency;
2427 #if CONFIG_SPEED_STATS 2431 unsigned int tx_search_count;
2432 #endif // CONFIG_SPEED_STATS 2560 #if CONFIG_COLLECT_PARTITION_STATS 2564 FramePartitionTimingStats partition_stats;
2565 #endif // CONFIG_COLLECT_PARTITION_STATS 2567 #if CONFIG_COLLECT_COMPONENT_TIMING 2571 uint64_t component_time[kTimingComponents];
2572 struct aom_usec_timer component_timer[kTimingComponents];
2576 uint64_t frame_component_time[kTimingComponents];
2615 #if CONFIG_TUNE_VMAF 2619 TuneVMAFInfo vmaf_info;
2622 #if CONFIG_TUNE_BUTTERAUGLI 2626 TuneButteraugliInfo butteraugli_info;
2681 #if CONFIG_AV1_TEMPORAL_DENOISING 2685 AV1_DENOISER denoiser;
2718 int64_t ts_duration;
2737 int primary_ref_frame;
2747 int refresh_frame_flags;
2749 int show_existing_frame;
2750 int existing_fb_idx_to_show;
2781 } EncodeFrameResults;
2784 void av1_initialize_enc(
void);
2787 BufferPool *
const pool,
2789 COMPRESSOR_STAGE stage,
2790 int num_lap_buffers,
2791 int lap_lag_in_frames,
2792 STATS_BUFFER_CTX *stats_buf_context);
2794 struct AV1_PRIMARY *av1_create_primary_compressor(
2795 struct aom_codec_pkt_list *pkt_list_head);
2799 void av1_remove_primary_compressor(
AV1_PRIMARY *ppi);
2803 void av1_check_initial_width(
AV1_COMP *
cpi,
int use_highbitdepth,
2804 int subsampling_x,
int subsampling_y);
2806 void av1_init_seq_coding_tools(SequenceHeader *seq,
AV1_COMMON *cm,
2829 int64_t end_time_stamp);
2856 size_t *size, uint8_t *dest, int64_t *time_stamp,
2857 int64_t *time_end,
int flush,
2858 const aom_rational64_t *timebase);
2869 EncodeFrameResults *
const frame_results);
2880 int av1_use_as_reference(
int *ext_ref_frame_flags,
int ref_frame_flags);
2886 int av1_set_size_literal(
AV1_COMP *
cpi,
int width,
int height);
2888 void av1_set_frame_size(
AV1_COMP *
cpi,
int width,
int height);
2890 int av1_set_active_map(
AV1_COMP *
cpi,
unsigned char *map,
int rows,
int cols);
2892 int av1_get_active_map(
AV1_COMP *
cpi,
unsigned char *map,
int rows,
int cols);
2896 AOM_SCALING horiz_mode, AOM_SCALING vert_mode);
2900 int av1_convert_sect5obus_to_annexb(uint8_t *buffer,
size_t *input_size);
2913 void av1_set_screen_content_options(
struct AV1_COMP *
cpi,
2920 static INLINE
void stack_push(
int *stack,
int *stack_size,
int item) {
2921 for (
int i = *stack_size - 1; i >= 0; --i) stack[i + 1] = stack[i];
2926 static INLINE
int stack_pop(
int *stack,
int *stack_size) {
2927 if (*stack_size <= 0)
return -1;
2929 int item = stack[0];
2930 for (
int i = 0; i < *stack_size; ++i) stack[i] = stack[i + 1];
2936 static INLINE
int stack_pop_end(
int *stack,
int *stack_size) {
2937 int item = stack[*stack_size - 1];
2938 stack[*stack_size - 1] = -1;
2944 static INLINE
void stack_reset(
int *stack,
int *stack_size) {
2945 for (
int i = 0; i < *stack_size; ++i) stack[i] = INVALID_IDX;
2950 #define TICKS_PER_SEC 10000000LL 2952 static INLINE int64_t
2953 timebase_units_to_ticks(
const aom_rational64_t *timestamp_ratio, int64_t n) {
2954 return n * timestamp_ratio->num / timestamp_ratio->den;
2957 static INLINE int64_t
2958 ticks_to_timebase_units(
const aom_rational64_t *timestamp_ratio, int64_t n) {
2959 int64_t round = timestamp_ratio->num / 2;
2960 if (round > 0) --round;
2961 return (n * timestamp_ratio->den + round) / timestamp_ratio->num;
2964 static INLINE
int frame_is_kf_gf_arf(
const AV1_COMP *
cpi) {
2966 const FRAME_UPDATE_TYPE update_type =
2969 return frame_is_intra_only(&
cpi->
common) || update_type == ARF_UPDATE ||
2970 update_type == GF_UPDATE;
2974 static INLINE
int av1_use_hash_me(
const AV1_COMP *
const cpi) {
2981 const AV1_COMMON *
const cm, MV_REFERENCE_FRAME ref_frame) {
2982 const RefCntBuffer *
const buf = get_ref_frame_buf(cm, ref_frame);
2983 return buf != NULL ? &buf->buf : NULL;
2986 static INLINE
void alloc_frame_mvs(
AV1_COMMON *
const cm, RefCntBuffer *buf) {
2987 assert(buf != NULL);
2988 ensure_mv_buffer(buf, cm);
2989 buf->width = cm->
width;
2990 buf->height = cm->
height;
2995 static INLINE
unsigned int allocated_tokens(TileInfo tile,
int sb_size_log2,
2997 int tile_mb_rows = (tile.mi_row_end - tile.mi_row_start + 2) >> 2;
2998 int tile_mb_cols = (tile.mi_col_end - tile.mi_col_start + 2) >> 2;
3000 return get_token_alloc(tile_mb_rows, tile_mb_cols, sb_size_log2, num_planes);
3003 static INLINE
void get_start_tok(
AV1_COMP *
cpi,
int tile_row,
int tile_col,
3004 int mi_row, TokenExtra **tok,
int sb_size_log2,
3008 TileDataEnc *this_tile = &
cpi->
tile_data[tile_row * tile_cols + tile_col];
3009 const TileInfo *
const tile_info = &this_tile->tile_info;
3011 const int tile_mb_cols =
3012 (tile_info->mi_col_end - tile_info->mi_col_start + 2) >> 2;
3013 const int tile_mb_row = (mi_row - tile_info->mi_row_start + 2) >> 2;
3016 get_token_alloc(tile_mb_row, tile_mb_cols, sb_size_log2, num_planes);
3021 #define ALT_MIN_LAG 3 3022 static INLINE
int is_altref_enabled(
int lag_in_frames,
bool enable_auto_arf) {
3023 return lag_in_frames >= ALT_MIN_LAG && enable_auto_arf;
3027 static INLINE
int is_stat_generation_stage(
const AV1_COMP *
const cpi) {
3033 static INLINE
int is_stat_consumption_stage_twopass(
const AV1_COMP *
const cpi) {
3038 static INLINE
int is_stat_consumption_stage(
const AV1_COMP *
const cpi) {
3039 return (is_stat_consumption_stage_twopass(
cpi) ||
3060 static INLINE
int get_stats_buf_size(
int num_lap_buffer,
int num_lag_buffer) {
3062 return (num_lap_buffer > 0 ? num_lap_buffer + 1 : num_lag_buffer);
3068 MV_REFERENCE_FRAME ref0,
3069 MV_REFERENCE_FRAME ref1) {
3071 get_ref_scale_factors_const(cm, ref0 >= LAST_FRAME ? ref0 : 1);
3073 get_ref_scale_factors_const(cm, ref1 >= LAST_FRAME ? ref1 : 1);
3076 static INLINE
int get_chessboard_index(
int frame_index) {
3077 return frame_index & 0x1;
3080 static INLINE
const int *cond_cost_list_const(
const struct AV1_COMP *
cpi,
3081 const int *cost_list) {
3082 const int use_cost_list =
cpi->
sf.
mv_sf.subpel_search_method != SUBPEL_TREE &&
3084 return use_cost_list ? cost_list : NULL;
3087 static INLINE
int *cond_cost_list(
const struct AV1_COMP *
cpi,
int *cost_list) {
3088 const int use_cost_list =
cpi->
sf.
mv_sf.subpel_search_method != SUBPEL_TREE &&
3090 return use_cost_list ? cost_list : NULL;
3094 double av1_get_compression_ratio(
const AV1_COMMON *
const cm,
3095 size_t encoded_frame_size);
3097 void av1_new_framerate(
AV1_COMP *
cpi,
double framerate);
3101 #define LAYER_IDS_TO_IDX(sl, tl, num_tl) ((sl) * (num_tl) + (tl)) 3104 static INLINE
int av1_resize_scaled(
const AV1_COMMON *cm) {
3109 static INLINE
int av1_frame_scaled(
const AV1_COMMON *cm) {
3110 return !av1_superres_scaled(cm) && av1_resize_scaled(cm);
3116 static INLINE
int encode_show_existing_frame(
const AV1_COMMON *cm) {
3123 static INLINE
int get_mi_ext_idx(
const int mi_row,
const int mi_col,
3124 const BLOCK_SIZE mi_alloc_bsize,
3125 const int mbmi_ext_stride) {
3126 const int mi_ext_size_1d = mi_size_wide[mi_alloc_bsize];
3127 const int mi_ext_row = mi_row / mi_ext_size_1d;
3128 const int mi_ext_col = mi_col / mi_ext_size_1d;
3129 return mi_ext_row * mbmi_ext_stride + mi_ext_col;
3134 static INLINE
void set_mode_info_offsets(
3138 set_mi_offsets(mi_params, xd, mi_row, mi_col);
3139 const int ext_idx = get_mi_ext_idx(mi_row, mi_col, mi_params->
mi_alloc_bsize,
3147 static INLINE BLOCK_SIZE find_partition_size(BLOCK_SIZE bsize,
int rows_left,
3148 int cols_left,
int *bh,
int *bw) {
3149 int int_size = (int)bsize;
3150 if (rows_left <= 0 || cols_left <= 0) {
3151 return AOMMIN(bsize, BLOCK_8X8);
3153 for (; int_size > 0; int_size -= 3) {
3154 *bh = mi_size_high[int_size];
3155 *bw = mi_size_wide[int_size];
3156 if ((*bh <= rows_left) && (*bw <= cols_left)) {
3161 return (BLOCK_SIZE)int_size;
3164 static const uint8_t av1_ref_frame_flag_list[REF_FRAMES] = { 0,
3175 static const MV_REFERENCE_FRAME disable_order[] = {
3182 static const MV_REFERENCE_FRAME
3183 ref_frame_priority_order[INTER_REFS_PER_FRAME] = {
3184 LAST_FRAME, ALTREF_FRAME, BWDREF_FRAME, GOLDEN_FRAME,
3185 ALTREF2_FRAME, LAST2_FRAME, LAST3_FRAME,
3188 static INLINE
int get_ref_frame_flags(
const SPEED_FEATURES *
const sf,
3190 const int ext_ref_frame_flags) {
3195 int flags = ext_ref_frame_flags;
3197 for (
int i = 1; i < INTER_REFS_PER_FRAME; ++i) {
3202 int index = (sf->
rt_sf.use_nonrd_pick_mode &&
3203 ref_frame_priority_order[i] == GOLDEN_FRAME)
3204 ? (1 + sf->
rt_sf.use_nonrd_altref_frame)
3206 for (
int j = 0; j < index; ++j) {
3207 if (this_ref == ref_frames[j]) {
3208 flags &= ~(1 << (ref_frame_priority_order[i] - 1));
3227 #define MAX_GFUBOOST_FACTOR 10.0 3228 #define MIN_GFUBOOST_FACTOR 4.0 3230 static INLINE
int is_frame_tpl_eligible(
const GF_GROUP *
const gf_group,
3232 const FRAME_UPDATE_TYPE update_type = gf_group->update_type[index];
3233 return update_type == ARF_UPDATE || update_type == GF_UPDATE ||
3234 update_type == KF_UPDATE;
3237 static INLINE
int is_frame_eligible_for_ref_pruning(
const GF_GROUP *gf_group,
3238 int selective_ref_frame,
3239 int prune_ref_frames,
3241 return (selective_ref_frame > 0) && (prune_ref_frames > 0) &&
3242 !is_frame_tpl_eligible(gf_group, gf_index);
3246 static INLINE FRAME_UPDATE_TYPE get_frame_update_type(
const GF_GROUP *gf_group,
3247 int gf_frame_index) {
3248 return gf_group->update_type[gf_frame_index];
3251 static INLINE
int av1_pixels_to_mi(
int pixels) {
3252 return ALIGN_POWER_OF_TWO(pixels, 3) >> MI_SIZE_LOG2;
3255 static AOM_INLINE
int is_psnr_calc_enabled(
const AV1_COMP *
cpi) {
3262 #if CONFIG_AV1_TEMPORAL_DENOISING 3263 static INLINE
int denoise_svc(
const struct AV1_COMP *
const cpi) {
3265 cpi->
svc.first_layer_denoise));
3269 #if CONFIG_COLLECT_PARTITION_STATS == 2 3270 static INLINE
void av1_print_fr_partition_timing_stats(
3271 const FramePartitionTimingStats *part_stats,
const char *filename) {
3272 FILE *f = fopen(filename,
"w");
3277 fprintf(f,
"bsize,redo,");
3278 for (
int part = 0; part < EXT_PARTITION_TYPES; part++) {
3279 fprintf(f,
"decision_%d,", part);
3281 for (
int part = 0; part < EXT_PARTITION_TYPES; part++) {
3282 fprintf(f,
"attempt_%d,", part);
3284 for (
int part = 0; part < EXT_PARTITION_TYPES; part++) {
3285 fprintf(f,
"time_%d,", part);
3289 static const int bsizes[6] = { 128, 64, 32, 16, 8, 4 };
3291 for (
int bsize_idx = 0; bsize_idx < 6; bsize_idx++) {
3292 fprintf(f,
"%d,%d,", bsizes[bsize_idx], part_stats->partition_redo);
3293 for (
int part = 0; part < EXT_PARTITION_TYPES; part++) {
3294 fprintf(f,
"%d,", part_stats->partition_decisions[bsize_idx][part]);
3296 for (
int part = 0; part < EXT_PARTITION_TYPES; part++) {
3297 fprintf(f,
"%d,", part_stats->partition_attempts[bsize_idx][part]);
3299 for (
int part = 0; part < EXT_PARTITION_TYPES; part++) {
3300 fprintf(f,
"%ld,", part_stats->partition_times[bsize_idx][part]);
3306 #endif // CONFIG_COLLECT_PARTITION_STATS == 2 3308 #if CONFIG_COLLECT_PARTITION_STATS 3309 static INLINE
int av1_get_bsize_idx_for_part_stats(BLOCK_SIZE bsize) {
3310 assert(bsize == BLOCK_128X128 || bsize == BLOCK_64X64 ||
3311 bsize == BLOCK_32X32 || bsize == BLOCK_16X16 || bsize == BLOCK_8X8 ||
3312 bsize == BLOCK_4X4);
3314 case BLOCK_128X128:
return 0;
3315 case BLOCK_64X64:
return 1;
3316 case BLOCK_32X32:
return 2;
3317 case BLOCK_16X16:
return 3;
3318 case BLOCK_8X8:
return 4;
3319 case BLOCK_4X4:
return 5;
3320 default: assert(0 &&
"Invalid bsize for partition_stats.");
return -1;
3323 #endif // CONFIG_COLLECT_PARTITION_STATS 3325 #if CONFIG_COLLECT_COMPONENT_TIMING 3326 static INLINE
void start_timing(
AV1_COMP *
cpi,
int component) {
3327 aom_usec_timer_start(&
cpi->component_timer[component]);
3329 static INLINE
void end_timing(
AV1_COMP *
cpi,
int component) {
3330 aom_usec_timer_mark(&
cpi->component_timer[component]);
3331 cpi->frame_component_time[component] +=
3332 aom_usec_timer_elapsed(&
cpi->component_timer[component]);
3334 static INLINE
char const *get_frame_type_enum(
int type) {
3336 case 0:
return "KEY_FRAME";
3337 case 1:
return "INTER_FRAME";
3338 case 2:
return "INTRA_ONLY_FRAME";
3339 case 3:
return "S_FRAME";
3352 #endif // AOM_AV1_ENCODER_ENCODER_H_ int seq_params_locked
Definition: encoder.h:2078
bool use_ref_frame_mvs
Definition: encoder.h:1911
int sb_counter
Definition: encoder.h:2708
bool enable_masked_comp
Definition: encoder.h:319
RATE_CONTROL rc
Definition: encoder.h:2294
CB_COEFF_BUFFER * coeff_buffer_base
Definition: encoder.h:2127
Encoder flags for intra prediction.
Definition: encoder.h:236
int key_freq_max
Definition: encoder.h:386
WinnerModeParams winner_mode_params
Definition: encoder.h:2284
int over_shoot_pct
Definition: encoder.h:495
Definition: encoder.h:181
int all_one_sided_refs
Definition: encoder.h:2325
bool enable_interintra_wedge
Definition: encoder.h:335
pthread_mutex_t * mutex_
Definition: encoder.h:1238
AV1_COMMON common
Definition: encoder.h:2138
MultiThreadInfo mt_info
Definition: encoder.h:2501
bool reduced_tx_type_set
Definition: encoder.h:289
int show_frame
Definition: av1_common_int.h:862
int allocated_cols
Definition: encoder.h:1343
bool enable_superres
Definition: encoder.h:371
int segment_map_w
Definition: encoder.h:1680
int * num_finished_cols
Definition: encoder.h:1247
uint8_t * entropy_ctx
Definition: encoder.h:2051
int speed
Definition: encoder.h:2772
int num_threads_working
Definition: encoder.h:1265
bool enable_smooth_intra
Definition: encoder.h:249
int cq_level
Definition: encoder.h:509
TplParams tpl_data
Definition: encoder.h:2202
RdIdxPair rd_idx_pair_arr[MAX_INTER_MODES]
Definition: encoder.h:1141
RateControlCfg rc_cfg
Definition: encoder.h:827
Rate Control parameters and status.
Definition: ratectrl.h:118
uint16_t * eobs
Definition: encoder.h:2047
unsigned int vbr_corpus_complexity_lap
Definition: encoder.h:460
RefreshFrameFlagsInfo refresh_frame
Definition: encoder.h:2767
aom_variance_fn_ptr_t fn_ptr[BLOCK_SIZES_ALL]
Definition: encoder.h:2347
int disable_trellis_quant
Definition: encoder.h:730
int superres_kf_qthresh
Definition: encoder.h:351
FRAME_TYPE frame_type
Definition: encoder.h:2734
InitialDimensions initial_dimensions
Definition: encoder.h:2453
Parameters related to temporal filtering.
Definition: temporal_filter.h:75
MV_STATS mv_stats
Definition: encoder.h:2651
double framerate
Definition: encoder.h:2299
FeatureFlags features
Definition: av1_common_int.h:882
CYCLIC_REFRESH * cyclic_refresh
Definition: encoder.h:2335
aom_rc_mode
Rate control mode.
Definition: aom_encoder.h:165
double * tpl_rdmult_scaling_factors
Definition: encoder.h:2602
Frame refresh flags set by the external interface.
Definition: encoder.h:1871
static int has_no_stats_stage(const AV1_COMP *const cpi)
Check if the current stage has statistics.
Definition: encoder.h:3053
MV_SPEED_FEATURES mv_sf
Definition: speed_features.h:1144
Definition: encoder.h:182
Encoder rate control configuration parameters.
Definition: encoder.h:430
AV1TemporalFilterSync tf_sync
Definition: encoder.h:1443
GF_STATE gf_state
Definition: encoder.h:2367
Contains color maps used in palette mode.
Definition: block.h:360
bool update_pending
Definition: encoder.h:1880
int sharpness
Definition: encoder.h:721
AV1GlobalMotionSync gm_sync
Definition: encoder.h:1438
CODING_CONTEXT coding_context
Definition: encoder.h:2274
fractional_mv_step_fp * find_fractional_mv_step
Definition: encoder.h:1749
int av1_get_compressed_data(AV1_COMP *cpi, unsigned int *frame_flags, size_t *size, uint8_t *dest, int64_t *time_stamp, int64_t *time_end, int flush, const aom_rational64_t *timebase)
Encode a frame.
Definition: encoder.c:3683
TokenInfo token_info
Definition: encoder.h:2481
Encoder flags for compound prediction modes.
Definition: encoder.h:310
bool enable_angle_delta
Definition: encoder.h:266
enum aom_color_primaries aom_color_primaries_t
List of supported color primaries.
Provides definitions for using AOM or AV1 encoder algorithm within the aom Codec Interface.
bool alt_ref_frame
Definition: encoder.h:1876
MotionVectorSearchParams mv_search_params
Definition: encoder.h:2319
Encoder config related to the coding of key frames.
Definition: encoder.h:377
struct aom_codec_pkt_list * output_pkt_list
Definition: encoder.h:2084
int rows
Definition: encoder.h:1257
int num_mod_workers[NUM_MT_MODULES]
Definition: encoder.h:1384
bool enable_interinter_wedge
Definition: encoder.h:331
enum aom_matrix_coefficients aom_matrix_coefficients_t
List of supported matrix coefficients.
Stores the transforms coefficients for the whole superblock.
Definition: block.h:180
struct AV1_COMP * cpi
Definition: encoder.h:2061
bool golden_frame
Definition: encoder.h:1768
bool enable_1to4_partitions
Definition: encoder.h:220
Definition: encoder.h:2039
AV1EncoderConfig oxcf
Definition: encoder.h:2143
RD_STATS rd_cost_uv_arr[MAX_INTER_MODES]
Definition: encoder.h:1153
struct EncodeFrameInput EncodeFrameInput
Input frames and last input frame.
int allocated_tiles
Definition: encoder.h:2476
bool enable_paeth_intra
Definition: encoder.h:253
MB_MODE_INFO_EXT_FRAME * frame_base
Definition: encoder.h:1515
TemporalFilterCtx tf_ctx
Definition: encoder.h:2207
bool use_intra_dct_only
Definition: encoder.h:294
FRAME_INDEX_SET frame_index_set
Definition: encoder.h:2448
int superres_upscaled_height
Definition: av1_common_int.h:773
aom_film_grain_table_t * film_grain_table
Definition: encoder.h:2528
int num
Definition: encoder.h:1121
Encoder flags for transform sizes and types.
Definition: encoder.h:272
aom_fixed_buf_t twopass_stats_in
Definition: encoder.h:844
int use_screen_content_tools
Definition: encoder.h:2550
bool enable_dist_wtd_comp
Definition: encoder.h:314
struct aom_denoise_and_model_t * denoise_and_model
Definition: encoder.h:2535
RefBufferStack ref_buffer_stack
Definition: encoder.h:2372
pthread_cond_t * cond_
Definition: encoder.h:1239
Contains buffers used by av1_compound_type_rd()
Definition: block.h:372
Parameters related to global motion search.
Definition: encoder.h:1643
YV12_BUFFER_CONFIG * unscaled_last_source
Definition: encoder.h:2186
Generic fixed size buffer structure.
Definition: aom_encoder.h:76
int64_t sse_arr[MAX_INTER_MODES]
Definition: encoder.h:1133
YV12_BUFFER_CONFIG * source
Definition: encoder.h:2161
int sync_range
Definition: encoder.h:1253
Frame time stamps.
Definition: encoder.h:2020
Data related to the current GF/ARF group and the individual frames within the group.
Definition: firstpass.h:171
Encoder info used for decision on forcing integer motion vectors.
Definition: encoder.h:1464
FRAME_INFO frame_info
Definition: encoder.h:2443
GlobalMotionInfo gm_info
Definition: encoder.h:2279
MB_MODE_INFO_EXT_FRAME * mbmi_ext_frame
Finalized mbmi_ext for the whole frame.
Definition: block.h:878
aom_superres_mode superres_mode
Definition: encoder.h:367
int stride
Definition: encoder.h:1523
int8_t nearest_future_ref
Definition: encoder.h:1800
AV1LrStruct lr_ctxt
Definition: encoder.h:2523
int alloc_size
Definition: encoder.h:1519
Definition: encoder.h:179
int num_tg
Definition: encoder.h:2662
Params related to temporal dependency model.
Definition: tpl_model.h:129
AV1LfSync lf_row_sync
Definition: encoder.h:1428
NOISE_ESTIMATE noise_estimate
Definition: encoder.h:2679
int num_workers
Definition: encoder.h:1379
bool allow_intrabc
Definition: av1_common_int.h:352
TileDataEnc * tile_data
Definition: encoder.h:2472
bool golden_frame
Definition: encoder.h:1873
struct EncWorkerData * tile_thr_data
Definition: encoder.h:1407
SVC svc
Definition: encoder.h:2636
int internal_altref_allowed
Definition: encoder.h:2089
int64_t starting_buffer_level_ms
Definition: encoder.h:439
int vbrmax_section
Definition: encoder.h:531
bool enable_ab_partitions
Definition: encoder.h:216
int key_freq_min
Definition: encoder.h:381
int under_shoot_pct
Definition: encoder.h:489
Encoder config related to resize.
Definition: encoder.h:188
Struct used to hold inter mode data for fast tx search.
Definition: encoder.h:1116
KeyFrameCfg kf_cfg
Definition: encoder.h:822
uint8_t resize_scale_denominator
Definition: encoder.h:197
bool allow_screen_content_tools
Definition: av1_common_int.h:351
double * tpl_sb_rdmult_scaling_factors
Definition: encoder.h:2607
Top level primary encoder structure.
Definition: encoder.h:2057
int vbrbias
Definition: encoder.h:521
TimeStamps time_stamps
Definition: encoder.h:2289
uint8_t superres_scale_denominator
Definition: encoder.h:357
bool bwd_ref_frame
Definition: encoder.h:1769
int64_t prev_ts_end
Definition: encoder.h:2028
Two pass status and control data.
Definition: firstpass.h:214
int mode_rate_arr[MAX_INTER_MODES]
Definition: encoder.h:1129
bool enable_rect_tx
Definition: encoder.h:284
Encoder-side probabilities for pruning of various AV1 tools.
Definition: encoder.h:960
COST_UPDATE_TYPE
This enum controls how often the entropy costs should be updated.
Definition: encoder.h:178
Encoder config for coding block partitioning.
Definition: encoder.h:208
BLOCK_SIZE max_partition_size
Definition: encoder.h:230
uint16_t interp_filter_search_mask
Definition: encoder.h:1723
enum aom_superblock_size aom_superblock_size_t
Superblock size selection.
#define FIXED_QP_OFFSET_COUNT
Number of fixed QP offsets.
Definition: aom_encoder.h:876
bool enable_overlay
Definition: encoder.h:759
SPEED_FEATURES sf
Definition: encoder.h:2314
int sframe_dist
Definition: encoder.h:397
int best_allowed_q
Definition: encoder.h:505
int ref_frame_flags
Definition: encoder.h:2756
Flags related to interpolation filter search.
Definition: encoder.h:1714
int width
Definition: av1_common_int.h:748
int64_t ambient_err
Definition: encoder.h:2263
int allocated_tile_rows
Definition: encoder.h:1325
int enable_keyframe_filtering
Definition: encoder.h:391
int use_svc
Definition: encoder.h:2632
int num_src_corners
Definition: encoder.h:1687
bool use_inter_dct_only
Definition: encoder.h:299
ThreadData td
Definition: encoder.h:2110
int worst_allowed_q
Definition: encoder.h:500
Thresholds for variance based partitioning.
Definition: encoder.h:1211
ResizePendingParams resize_pending_params
Definition: encoder.h:2466
int allocated_rows
Definition: encoder.h:1336
bool fwd_kf_enabled
Definition: encoder.h:414
contains per-frame encoding parameters decided upon by av1_encode_strategy() and passed down to av1_e...
Definition: encoder.h:2726
Params related to MB_MODE_INFO arrays and related info.
Definition: av1_common_int.h:477
int render_height
Definition: av1_common_int.h:760
BLOCK_SIZE min_partition_size
Definition: encoder.h:225
Top level speed vs quality trade off data struture.
Definition: speed_features.h:1120
int allocated_tile_cols
Definition: encoder.h:1329
int fp_mt_buf_init_done
Definition: encoder.h:1390
TWO_PASS twopass
Definition: encoder.h:2352
int rate_size
Definition: encoder.h:1477
int vaq_refresh
Definition: encoder.h:2486
bool enable_filter_intra
Definition: encoder.h:245
Contains buffers used to speed up rdopt for obmc.
Definition: block.h:335
Parameters for motion vector search process.
Definition: encoder.h:1729
BLOCK_SIZE fp_block_size
Definition: encoder.h:2702
Frame level features.
Definition: av1_common_int.h:334
const struct scale_factors * block_ref_scale_factors[2]
Definition: blockd.h:685
bool last_frame
Definition: encoder.h:1872
struct AV1_COMP * cpi_lap
Definition: encoder.h:2066
FrameProbInfo frame_probs
Definition: encoder.h:2496
RefCntBuffer * scaled_ref_buf[INTER_REFS_PER_FRAME]
Definition: encoder.h:2223
AV1_PRIMARY * ppi
Definition: encoder.h:2099
bool enable_tpl_model
Definition: encoder.h:753
AlgoCfg algo_cfg
Definition: encoder.h:817
unsigned int max_intra_bitrate_pct
Definition: encoder.h:465
int show_frame
Definition: encoder.h:2744
struct AV1_COMP AV1_COMP
Top level encoder structure.
double * ssim_rdmult_scaling_factors
Definition: encoder.h:2613
struct lookahead_ctx * lookahead
Definition: encoder.h:2071
bool enable_intrabc
Definition: encoder.h:424
AV1EncRowMultiThreadInfo enc_row_mt
Definition: encoder.h:1418
struct AV1EncoderConfig AV1EncoderConfig
Main encoder configuration data structure.
FirstPassData firstpass_data
Definition: encoder.h:2674
bool use_intra_default_tx_only
Definition: encoder.h:304
int existing_fb_idx_to_show
Definition: encoder.h:2508
EncQuantDequantParams enc_quant_dequant_params
Definition: encoder.h:2105
RESIZE_MODE resize_mode
Definition: encoder.h:192
aom_enc_pass
Multi-pass Encoding Pass.
Definition: aom_encoder.h:158
uint8_t resize_kf_scale_denominator
Definition: encoder.h:202
unsigned int gf_cbr_boost_pct
Definition: encoder.h:474
CommonTileParams tiles
Definition: av1_common_int.h:969
int superres_qthresh
Definition: encoder.h:346
CurrentFrame current_frame
Definition: av1_common_int.h:727
int render_width
Definition: av1_common_int.h:759
Describes look ahead buffer operations.
struct inter_modes_info InterModesInfo
Struct used to hold inter mode data for fast tx search.
InterpSearchFlags interp_search_flags
Definition: encoder.h:2541
int height
Definition: encoder.h:1708
int remapped_ref_idx[REF_FRAMES]
Definition: encoder.h:2761
The stucture of acummulated frame stats in the first pass.
Definition: firstpass.h:36
YV12 frame buffer data structure.
Definition: yv12config.h:38
YV12_BUFFER_CONFIG * unscaled_source
Definition: encoder.h:2176
Desired dimensions for an externally triggered resize.
Definition: encoder.h:1780
RefFrameDistanceInfo ref_frame_dist_info
Definition: encoder.h:2592
bool bwd_ref_frame
Definition: encoder.h:1874
FRAME_TYPE last_frame_type
Definition: encoder.h:2657
AVxWorker * workers
Definition: encoder.h:1401
int64_t threshold_minmax
Definition: encoder.h:1226
uint8_t superres_kf_scale_denominator
Definition: encoder.h:363
AV1CdefSync cdef_sync
Definition: encoder.h:1448
int error_resilient_mode
Definition: encoder.h:2730
int arnr_max_frames
Definition: encoder.h:735
bool enable_sframe
Definition: encoder.h:419
Parameters related to CDEF.
Definition: av1_common_int.h:194
int mv_step_param
Definition: encoder.h:1740
aom_tune_content
Definition: aomcx.h:1400
YV12_BUFFER_CONFIG trial_frame_rst
Definition: encoder.h:2258
uint8_t * consec_zero_mv
Definition: encoder.h:2692
bool enable_intra_edge_filter
Definition: encoder.h:240
bool search_done
Definition: encoder.h:1647
int av1_receive_raw_frame(AV1_COMP *cpi, aom_enc_frame_flags_t frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time_stamp)
Obtain the raw frame data.
Definition: encoder.c:3478
unsigned int min_cr
Definition: encoder.h:479
int deltaq_used
Definition: encoder.h:2587
bool refresh_frame_context
Definition: encoder.h:1900
Encoder data related to row-based multi-threading.
Definition: encoder.h:1321
int64_t maximum_buffer_size_ms
Definition: encoder.h:449
int max_mv_magnitude
Definition: encoder.h:1735
int height
Definition: encoder.h:1782
Variables related to current coding block.
Definition: blockd.h:568
bool alt_ref_frame
Definition: encoder.h:1770
TRELLIS_OPT_TYPE optimize_seg_arr[8]
Definition: encoder.h:2154
int64_t prev_ts_start
Definition: encoder.h:2024
Parameters used for winner mode processing.
Definition: encoder.h:1818
bool refresh_frame_context_pending
Definition: encoder.h:1906
Segmentation related information for the current frame.
Definition: encoder.h:2002
int droppable
Definition: encoder.h:2438
int64_t target_bandwidth
Definition: encoder.h:454
GF_GROUP gf_group
Definition: encoder.h:2357
enum aom_enc_pass pass
Definition: encoder.h:930
CoeffBufferPool coeff_buffer_pool
Definition: encoder.h:2133
uint8_t cdf_update_mode
Definition: encoder.h:748
bool enable_smooth_interintra
Definition: encoder.h:323
Top level encoder structure.
Definition: encoder.h:2095
int drop_frames_water_mark
Definition: encoder.h:483
int intrabc_used
Definition: encoder.h:2513
int b_calculate_psnr
Definition: encoder.h:2425
bool enable_flip_idtx
Definition: encoder.h:280
int initial_mbs
Definition: encoder.h:2461
int vbrmin_section
Definition: encoder.h:526
enum aom_color_range aom_color_range_t
List of supported color range.
int cols
Definition: av1_common_int.h:404
enum aom_bit_depth aom_bit_depth_t
Bit depth for codecThis enumeration determines the bit depth of the codec.
struct MultiThreadInfo MultiThreadInfo
Encoder parameters related to multi-threading.
VarBasedPartitionInfo vbp_info
Definition: encoder.h:2491
bool has_lossless_segment
Definition: encoder.h:2014
int8_t nearest_past_ref
Definition: encoder.h:1796
FRAME_COUNTS counts
Definition: encoder.h:2115
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:3389
ActiveMap active_map
Definition: encoder.h:2340
aom_codec_err_t
Algorithm return codes.
Definition: aom_codec.h:155
REAL_TIME_SPEED_FEATURES rt_sf
Definition: speed_features.h:1184
int frames_left
Definition: encoder.h:2697
EncSegmentationInfo enc_seg
Definition: encoder.h:2330
YV12_BUFFER_CONFIG last_frame_uf
Definition: encoder.h:2252
Top level common structure used by both encoder and decoder.
Definition: av1_common_int.h:723
int ref_frame_flags
Definition: encoder.h:1890
Algorithm configuration parameters.
Definition: encoder.h:717
aom_superres_mode superres_mode
Definition: encoder.h:2669
int segment_map_h
Definition: encoder.h:1681
Encoder config related to frame super-resolution.
Definition: encoder.h:341
enum aom_chroma_sample_position aom_chroma_sample_position_t
List of chroma sample positions.
Stores the prediction/txfm mode of the current coding block.
Definition: blockd.h:216
unsigned char * src_buffer
Definition: encoder.h:1659
bool enable_diagonal_intra
Definition: encoder.h:261
bool alt2_ref_frame
Definition: encoder.h:1875
int superres_upscaled_width
Definition: av1_common_int.h:772
Initial frame dimensions.
Definition: encoder.h:1706
bool enable_diff_wtd_comp
Definition: encoder.h:327
ExternalFlags ext_flags
Definition: encoder.h:2246
Refrence frame distance related variables.
Definition: encoder.h:1788
YV12_BUFFER_CONFIG scaled_last_source
Definition: encoder.h:2191
Encoder parameters related to multi-threading.
Definition: encoder.h:1375
uint8_t * map
Definition: encoder.h:2008
BLOCK_SIZE mi_alloc_bsize
Definition: av1_common_int.h:526
RefreshFrameFlagsInfo refresh_frame
Definition: encoder.h:2233
ExtRefreshFrameFlagsInfo refresh_frame
Definition: encoder.h:1895
Buffer to store mode information at mi_alloc_bsize (4x4 or 8x8) level.
Definition: encoder.h:1510
bool enable_rect_partitions
Definition: encoder.h:212
int speed
Definition: encoder.h:2309
YV12_BUFFER_CONFIG alt_ref_buffer
Definition: encoder.h:2378
int is_screen_content_type
Definition: encoder.h:2558
int partition_search_skippable_frame
Definition: encoder.h:2212
int lap_enabled
Definition: encoder.h:2641
RD_STATS rd_cost_arr[MAX_INTER_MODES]
Definition: encoder.h:1145
ForceIntegerMVInfo force_intpel_info
Definition: encoder.h:2217
bool use_s_frame
Definition: encoder.h:1921
int enc_mt_buf_init_done
Definition: encoder.h:1396
bool use_primary_ref_none
Definition: encoder.h:1927
RD_OPT rd
Definition: encoder.h:2268
int rate_index
Definition: encoder.h:1473
bool enable_tx64
Definition: encoder.h:276
MB_MODE_INFO mbmi_arr[MAX_INTER_MODES]
Definition: encoder.h:1125
aom_superres_mode
Frame super-resolution mode.
Definition: aom_encoder.h:187
int64_t est_rd_arr[MAX_INTER_MODES]
Definition: encoder.h:1137
unsigned int max_inter_bitrate_pct
Definition: encoder.h:470
enum aom_transfer_characteristics aom_transfer_characteristics_t
List of supported transfer functions.
The stucture of CYCLIC_REFRESH.
Definition: aq_cyclicrefresh.h:36
int64_t optimal_buffer_level_ms
Definition: encoder.h:444
int no_show_fwd_kf
Definition: encoder.h:2148
Encoder parameters for synchronization of row based multi-threading.
Definition: encoder.h:1232
long aom_enc_frame_flags_t
Encoded Frame Flags.
Definition: aom_encoder.h:357
Main encoder configuration data structure.
Definition: encoder.h:805
AV1TplRowMultiThreadInfo tpl_row_mt
Definition: encoder.h:1423
bool use_error_resilient
Definition: encoder.h:1916
RefCntBuffer * last_show_frame_buf
Definition: encoder.h:2228
Encoder's parameters related to the current coding block.
Definition: block.h:846
RD_STATS rd_cost_y_arr[MAX_INTER_MODES]
Definition: encoder.h:1149
int height
Definition: av1_common_int.h:749
MBMIExtFrameBufferInfo mbmi_ext_info
Definition: encoder.h:2120
bool auto_key
Definition: encoder.h:409
struct EncodeFrameParams EncodeFrameParams
contains per-frame encoding parameters decided upon by av1_encode_strategy() and passed down to av1_e...
bool error_resilient_mode
Definition: av1_common_int.h:376
int arnr_strength
Definition: encoder.h:740
int show_existing_alt_ref
Definition: encoder.h:2383
int fb_of_context_type[REF_FRAMES]
Definition: encoder.h:2241
aom_tune_metric
Model tuning parameters.
Definition: aomcx.h:1419
COMPRESSOR_STAGE compressor_stage
Definition: encoder.h:2645
Flags signalled by the external interface at frame level.
Definition: encoder.h:1886
struct AV1_PRIMARY AV1_PRIMARY
Top level primary encoder structure.
int default_interp_skip_flags
Definition: encoder.h:1719
int64_t first_ts_start
Definition: encoder.h:2032
tran_low_t * tcoeff
Definition: encoder.h:2043
int width
Definition: encoder.h:1707
unsigned char gf_frame_index
Definition: encoder.h:2362
bool row_mt_enabled
Definition: encoder.h:1413
int next_mi_row
Definition: encoder.h:1261
AV1LevelParams level_params
Definition: encoder.h:2582
int width
Definition: encoder.h:1781
bool enable_cfl_intra
Definition: encoder.h:257
int sframe_mode
Definition: encoder.h:404
pthread_mutex_t * mutex_
Definition: encoder.h:1354
int ref_frame_flags
Definition: encoder.h:2304
AV1LrSync lr_row_sync
Definition: encoder.h:1433
YV12_BUFFER_CONFIG * last_source
Definition: encoder.h:2170
The stucture of SVC.
Definition: svc_layercontext.h:91
YV12_BUFFER_CONFIG * unfiltered_source
Definition: encoder.h:2197
Refresh frame flags for different type of frames.
Definition: encoder.h:1767
YV12_BUFFER_CONFIG scaled_source
Definition: encoder.h:2181
Stores best extended mode information at frame level.
Definition: block.h:216
int prune_ref_frame_mask
Definition: encoder.h:2518
int show_existing_frame
Definition: av1_common_int.h:877
Definition: encoder.h:180