blob: 6c4bce4db57eabf72aaaa6350b42e3e56a5c6101 [file] [log] [blame]
Jingning Han3ee6db62015-08-05 19:00:31 -07001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Jingning Han3ee6db62015-08-05 19:00:31 -07003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * 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.
Jingning Han3ee6db62015-08-05 19:00:31 -070010 */
11
James Zerne1cbb132018-08-22 14:10:36 -070012#ifndef AOM_AV1_ENCODER_ETHREAD_H_
13#define AOM_AV1_ENCODER_ETHREAD_H_
Jingning Han3ee6db62015-08-05 19:00:31 -070014
James Zern55f5d552015-09-09 21:05:42 -070015#ifdef __cplusplus
16extern "C" {
17#endif
18
Yaowu Xuf883b422016-08-30 14:01:10 -070019struct AV1_COMP;
Jingning Han3ee6db62015-08-05 19:00:31 -070020struct ThreadData;
21
22typedef struct EncWorkerData {
Yaowu Xuf883b422016-08-30 14:01:10 -070023 struct AV1_COMP *cpi;
Jingning Han3ee6db62015-08-05 19:00:31 -070024 struct ThreadData *td;
Mufaddal Chakerabf4f3582021-07-25 19:32:40 +053025 struct ThreadData *original_td;
Deepa K G1a38c9c2022-09-23 15:53:18 +053026 AV1LfSync *lf_sync;
27 LFWorkerData *lf_data;
Jingning Han3ee6db62015-08-05 19:00:31 -070028 int start;
Ravi Chaudhary90a15f42018-10-11 18:56:35 +053029 int thread_id;
Jingning Han3ee6db62015-08-05 19:00:31 -070030} EncWorkerData;
31
Deepa K G74de2a02020-04-11 13:09:11 +053032void av1_row_mt_sync_read(AV1EncRowMultiThreadSync *row_mt_sync, int r, int c);
33void av1_row_mt_sync_write(AV1EncRowMultiThreadSync *row_mt_sync, int r, int c,
34 int cols);
Ravi Chaudharyc5e74692018-10-08 16:05:38 +053035
Deepa K G74de2a02020-04-11 13:09:11 +053036void av1_row_mt_sync_read_dummy(AV1EncRowMultiThreadSync *row_mt_sync, int r,
37 int c);
38void av1_row_mt_sync_write_dummy(AV1EncRowMultiThreadSync *row_mt_sync, int r,
39 int c, int cols);
Ravi Chaudhary40cdf132018-10-08 11:04:16 +053040
Yaowu Xuf883b422016-08-30 14:01:10 -070041void av1_encode_tiles_mt(struct AV1_COMP *cpi);
Ravi Chaudharyda4c8722018-10-05 17:55:20 +053042void av1_encode_tiles_row_mt(struct AV1_COMP *cpi);
Jingning Han3ee6db62015-08-05 19:00:31 -070043
Mufaddal Chakera65b69102020-05-01 04:07:13 +053044#if !CONFIG_REALTIME_ONLY
45void av1_fp_encode_tiles_row_mt(AV1_COMP *cpi);
Mufaddal Chakeraa5e3f022020-05-20 13:03:38 +053046
47int av1_fp_compute_num_enc_workers(AV1_COMP *cpi);
Mufaddal Chakera65b69102020-05-01 04:07:13 +053048#endif
49
Yue Chencc6a6ef2018-05-21 16:21:05 -070050void av1_accumulate_frame_counts(struct FRAME_COUNTS *acc_counts,
51 const struct FRAME_COUNTS *counts);
52
Vishesh70964102020-04-17 18:09:41 +053053void av1_row_mt_mem_dealloc(AV1_COMP *cpi);
54
Remya1a090d52020-05-04 11:52:10 +053055void av1_global_motion_estimation_mt(AV1_COMP *cpi);
56
57void av1_gm_dealloc(AV1GlobalMotionSync *gm_sync_data);
58
Sachin Kumar Garg194c57b2020-05-06 08:50:13 +053059#if !CONFIG_REALTIME_ONLY
60void av1_tpl_row_mt_sync_read_dummy(AV1TplRowMultiThreadSync *tpl_mt_sync,
61 int r, int c);
62void av1_tpl_row_mt_sync_write_dummy(AV1TplRowMultiThreadSync *tpl_mt_sync,
63 int r, int c, int cols);
64
65void av1_tpl_row_mt_sync_read(AV1TplRowMultiThreadSync *tpl_mt_sync, int r,
66 int c);
67void av1_tpl_row_mt_sync_write(AV1TplRowMultiThreadSync *tpl_mt_sync, int r,
68 int c, int cols);
69
70void av1_mc_flow_dispenser_mt(AV1_COMP *cpi);
71
72void av1_tpl_dealloc(AV1TplRowMultiThreadSync *tpl_sync);
73
74#endif // !CONFIG_REALTIME_ONLY
75
Wan-Teh Chang75fe5802022-12-02 15:08:58 -080076void av1_calc_mb_wiener_var_mt(AV1_COMP *cpi, int num_workers,
77 double *sum_rec_distortion,
Cheng Chenef49e872022-11-07 23:15:51 -080078 double *sum_est_rate);
79
Jayasanker J0761c692020-11-13 12:36:40 +053080void av1_tf_do_filtering_mt(AV1_COMP *cpi);
81
82void av1_tf_mt_dealloc(AV1TemporalFilterSync *tf_sync);
83
Nithya V Sb6871a72020-12-25 23:05:48 +053084void av1_compute_num_workers_for_mt(AV1_COMP *cpi);
85
Angie Chiang09543c12022-05-18 10:14:41 -070086int av1_get_max_num_workers(const AV1_COMP *cpi);
Sachin Kumar Garg194c57b2020-05-06 08:50:13 +053087
Mufaddal Chakera8c2d5172021-06-09 01:33:48 +053088void av1_create_workers(AV1_PRIMARY *ppi, int num_workers);
89
90void av1_init_frame_mt(AV1_PRIMARY *ppi, AV1_COMP *cpi);
Sachin Kumar Garg800e70a2020-05-15 19:19:51 +053091
Nithya V S75d5d072021-08-18 11:09:13 +053092void av1_init_cdef_worker(AV1_COMP *cpi);
93
94#if !CONFIG_REALTIME_ONLY
95void av1_init_lr_mt_buffers(AV1_COMP *cpi);
96#endif
97
Mufaddal Chakeraa3138882021-06-01 13:43:06 +053098#if CONFIG_MULTITHREAD
99void av1_init_mt_sync(AV1_COMP *cpi, int is_first_pass);
100#endif // CONFIG_MULTITHREAD
101
Nithya V Se6f0b272021-08-18 10:55:10 +0530102int av1_get_num_mod_workers_for_alloc(PrimaryMultiThreadInfo *const p_mt_info,
103 MULTI_THREADED_MODULES mod_name);
104
Mufaddal Chakera8c2d5172021-06-09 01:33:48 +0530105void av1_init_tile_thread_data(AV1_PRIMARY *ppi, int is_first_pass);
Nithya V Sb6871a72020-12-25 23:05:48 +0530106
venkat sanampudid7bf5502020-10-21 10:55:34 +0530107void av1_cdef_mse_calc_frame_mt(AV1_COMMON *cm, MultiThreadInfo *mt_info,
108 CdefSearchCtx *cdef_search_ctx);
109
110void av1_cdef_mt_dealloc(AV1CdefSync *cdef_sync);
111
Cherma Rajan Ace0c4232021-04-23 21:29:51 +0530112void av1_write_tile_obu_mt(
113 AV1_COMP *const cpi, uint8_t *const dst, uint32_t *total_size,
114 struct aom_write_bit_buffer *saved_wb, uint8_t obu_extn_header,
115 const FrameHeaderInfo *fh_info, int *const largest_tile_id,
116 unsigned int *max_tile_size, uint32_t *const obu_header_size,
Cherma Rajan A248e8d32021-06-15 09:06:38 +0530117 uint8_t **tile_data_start, const int num_workers);
Cherma Rajan Ace0c4232021-04-23 21:29:51 +0530118
Mufaddal Chakera92fbfed2021-06-25 10:18:05 +0530119int av1_compute_num_enc_workers(AV1_COMP *cpi, int max_workers);
120
Tarundeep Singh6107e332021-09-24 11:56:15 +0530121int av1_compute_num_fp_contexts(AV1_PRIMARY *ppi, AV1EncoderConfig *oxcf);
122
Tarundeep Singh0192bca2021-08-18 23:44:38 +0530123int av1_check_fpmt_config(AV1_PRIMARY *const ppi, AV1EncoderConfig *const oxcf);
124
Mufaddal Chakerad777f7b2021-07-26 02:13:20 +0530125int av1_compress_parallel_frames(AV1_PRIMARY *const ppi,
126 AV1_COMP_DATA *const first_cpi_data);
James Zern55f5d552015-09-09 21:05:42 -0700127#ifdef __cplusplus
128} // extern "C"
129#endif
130
James Zerne1cbb132018-08-22 14:10:36 -0700131#endif // AOM_AV1_ENCODER_ETHREAD_H_