12 #ifndef AOM_AV1_ENCODER_TPL_MODEL_H_
13 #define AOM_AV1_ENCODER_TPL_MODEL_H_
27 static INLINE BLOCK_SIZE convert_length_to_bsize(
int length) {
29 case 64:
return BLOCK_64X64;
30 case 32:
return BLOCK_32X32;
31 case 16:
return BLOCK_16X16;
32 case 8:
return BLOCK_8X8;
33 case 4:
return BLOCK_4X4;
35 assert(0 &&
"Invalid block size for tpl model");
40 typedef struct AV1TplRowMultiThreadSync {
41 #if CONFIG_MULTITHREAD
43 pthread_mutex_t *mutex_;
44 pthread_cond_t *cond_;
49 int *num_finished_cols;
57 int num_threads_working;
58 } AV1TplRowMultiThreadSync;
60 typedef struct AV1TplRowMultiThreadInfo {
62 void (*sync_read_ptr)(AV1TplRowMultiThreadSync *tpl_mt_sync,
int r,
int c);
63 void (*sync_write_ptr)(AV1TplRowMultiThreadSync *tpl_mt_sync,
int r,
int c,
65 } AV1TplRowMultiThreadInfo;
78 #define MAX_TPL_FRAME_IDX (2 * MAX_LAG_BUFFERS)
81 #define MAX_LENGTH_TPL_FRAME_STATS (MAX_TPL_FRAME_IDX + REF_FRAMES + 1)
82 #define MAX_TPL_EXTEND (MAX_LAG_BUFFERS - MAX_GF_INTERVAL)
83 #define TPL_DEP_COST_SCALE_LOG2 4
85 typedef struct TplDepStats {
90 int64_t cmp_recrf_dist[2];
93 int64_t cmp_recrf_rate[2];
96 int_mv mv[INTER_REFS_PER_FRAME];
97 int ref_frame_index[2];
98 int64_t pred_error[INTER_REFS_PER_FRAME];
101 typedef struct TplDepFrame {
103 TplDepStats *tpl_stats_ptr;
106 int ref_map_index[REF_FRAMES];
113 uint32_t frame_display_index;
159 struct scale_factors
sf;
215 int av1_tpl_ptr_pos(
int mi_row,
int mi_col,
int stride, uint8_t right_shift);
217 void av1_init_tpl_stats(
TplParams *
const tpl_data);
219 void av1_tpl_rdmult_setup(
struct AV1_COMP *cpi);
222 BLOCK_SIZE sb_size,
int mi_row,
int mi_col);
225 BLOCK_SIZE bsize, TX_SIZE tx_size);
239 double av1_exponential_entropy(
double q_step,
double b);
254 double av1_laplace_entropy(
double q_step,
double b,
double zero_bin_ratio);
273 double av1_laplace_estimate_frame_rate(
int q_index,
int block_count,
274 const double *abs_coeff_mean,
Declares top-level encoder structures and functions.
int av1_tpl_setup_stats(struct AV1_COMP *cpi, int gop_eval, const struct EncodeFrameParams *const frame_params, const struct EncodeFrameInput *const frame_input)
Implements temporal dependency modelling for a GOP (GF/ARF group) and selects between 16 and 32 frame...
Top level encoder structure.
Definition: encoder.h:2042
contains per-frame encoding parameters decided upon by av1_encode_strategy() and passed down to av1_e...
Definition: encoder.h:2675
Params related to temporal dependency model.
Definition: tpl_model.h:120
const YV12_BUFFER_CONFIG * src_ref_frame[INTER_REFS_PER_FRAME]
Definition: tpl_model.h:171
struct scale_factors sf
Definition: tpl_model.h:159
TplDepFrame tpl_stats_buffer[MAX_LENGTH_TPL_FRAME_STATS]
Definition: tpl_model.h:136
uint8_t tpl_bsize_1d
Definition: tpl_model.h:129
AV1TplRowMultiThreadSync tpl_mt_sync
Definition: tpl_model.h:184
TplDepFrame * tpl_frame
Definition: tpl_model.h:154
int border_in_pixels
Definition: tpl_model.h:189
TplDepStats * tpl_stats_pool[MAX_LAG_BUFFERS]
Definition: tpl_model.h:143
YV12_BUFFER_CONFIG tpl_rec_pool[MAX_LAG_BUFFERS]
Definition: tpl_model.h:149
uint8_t tpl_stats_block_mis_log2
Definition: tpl_model.h:124
int frame_idx
Definition: tpl_model.h:164
int skip_tpl_setup_stats
Definition: tpl_model.h:194
const YV12_BUFFER_CONFIG * ref_frame[INTER_REFS_PER_FRAME]
Definition: tpl_model.h:178
Encoder's parameters related to the current coding block.
Definition: block.h:829
YV12 frame buffer data structure.
Definition: yv12config.h:38