Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 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. |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 12 | #ifndef AOM_AV1_ENCODER_ETHREAD_H_ |
| 13 | #define AOM_AV1_ENCODER_ETHREAD_H_ |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 14 | |
James Zern | 55f5d55 | 2015-09-09 21:05:42 -0700 | [diff] [blame] | 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 19 | struct AV1_COMP; |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 20 | struct ThreadData; |
| 21 | |
| 22 | typedef struct EncWorkerData { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 23 | struct AV1_COMP *cpi; |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 24 | struct ThreadData *td; |
Mufaddal Chakera | bf4f358 | 2021-07-25 19:32:40 +0530 | [diff] [blame] | 25 | struct ThreadData *original_td; |
Deepa K G | 1a38c9c | 2022-09-23 15:53:18 +0530 | [diff] [blame] | 26 | AV1LfSync *lf_sync; |
| 27 | LFWorkerData *lf_data; |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 28 | int start; |
Ravi Chaudhary | 90a15f4 | 2018-10-11 18:56:35 +0530 | [diff] [blame] | 29 | int thread_id; |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 30 | } EncWorkerData; |
| 31 | |
Deepa K G | 74de2a0 | 2020-04-11 13:09:11 +0530 | [diff] [blame] | 32 | void av1_row_mt_sync_read(AV1EncRowMultiThreadSync *row_mt_sync, int r, int c); |
| 33 | void av1_row_mt_sync_write(AV1EncRowMultiThreadSync *row_mt_sync, int r, int c, |
| 34 | int cols); |
Ravi Chaudhary | c5e7469 | 2018-10-08 16:05:38 +0530 | [diff] [blame] | 35 | |
Deepa K G | 74de2a0 | 2020-04-11 13:09:11 +0530 | [diff] [blame] | 36 | void av1_row_mt_sync_read_dummy(AV1EncRowMultiThreadSync *row_mt_sync, int r, |
| 37 | int c); |
| 38 | void av1_row_mt_sync_write_dummy(AV1EncRowMultiThreadSync *row_mt_sync, int r, |
| 39 | int c, int cols); |
Ravi Chaudhary | 40cdf13 | 2018-10-08 11:04:16 +0530 | [diff] [blame] | 40 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 41 | void av1_encode_tiles_mt(struct AV1_COMP *cpi); |
Ravi Chaudhary | da4c872 | 2018-10-05 17:55:20 +0530 | [diff] [blame] | 42 | void av1_encode_tiles_row_mt(struct AV1_COMP *cpi); |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 43 | |
Mufaddal Chakera | 65b6910 | 2020-05-01 04:07:13 +0530 | [diff] [blame] | 44 | #if !CONFIG_REALTIME_ONLY |
| 45 | void av1_fp_encode_tiles_row_mt(AV1_COMP *cpi); |
Mufaddal Chakera | a5e3f02 | 2020-05-20 13:03:38 +0530 | [diff] [blame] | 46 | |
| 47 | int av1_fp_compute_num_enc_workers(AV1_COMP *cpi); |
Mufaddal Chakera | 65b6910 | 2020-05-01 04:07:13 +0530 | [diff] [blame] | 48 | #endif |
| 49 | |
Yue Chen | cc6a6ef | 2018-05-21 16:21:05 -0700 | [diff] [blame] | 50 | void av1_accumulate_frame_counts(struct FRAME_COUNTS *acc_counts, |
| 51 | const struct FRAME_COUNTS *counts); |
| 52 | |
Vishesh | 7096410 | 2020-04-17 18:09:41 +0530 | [diff] [blame] | 53 | void av1_row_mt_mem_dealloc(AV1_COMP *cpi); |
| 54 | |
Remya | 1a090d5 | 2020-05-04 11:52:10 +0530 | [diff] [blame] | 55 | void av1_global_motion_estimation_mt(AV1_COMP *cpi); |
| 56 | |
| 57 | void av1_gm_dealloc(AV1GlobalMotionSync *gm_sync_data); |
| 58 | |
Sachin Kumar Garg | 194c57b | 2020-05-06 08:50:13 +0530 | [diff] [blame] | 59 | #if !CONFIG_REALTIME_ONLY |
| 60 | void av1_tpl_row_mt_sync_read_dummy(AV1TplRowMultiThreadSync *tpl_mt_sync, |
| 61 | int r, int c); |
| 62 | void av1_tpl_row_mt_sync_write_dummy(AV1TplRowMultiThreadSync *tpl_mt_sync, |
| 63 | int r, int c, int cols); |
| 64 | |
| 65 | void av1_tpl_row_mt_sync_read(AV1TplRowMultiThreadSync *tpl_mt_sync, int r, |
| 66 | int c); |
| 67 | void av1_tpl_row_mt_sync_write(AV1TplRowMultiThreadSync *tpl_mt_sync, int r, |
| 68 | int c, int cols); |
| 69 | |
| 70 | void av1_mc_flow_dispenser_mt(AV1_COMP *cpi); |
| 71 | |
| 72 | void av1_tpl_dealloc(AV1TplRowMultiThreadSync *tpl_sync); |
| 73 | |
| 74 | #endif // !CONFIG_REALTIME_ONLY |
| 75 | |
Wan-Teh Chang | 75fe580 | 2022-12-02 15:08:58 -0800 | [diff] [blame] | 76 | void av1_calc_mb_wiener_var_mt(AV1_COMP *cpi, int num_workers, |
| 77 | double *sum_rec_distortion, |
Cheng Chen | ef49e87 | 2022-11-07 23:15:51 -0800 | [diff] [blame] | 78 | double *sum_est_rate); |
| 79 | |
Jayasanker J | 0761c69 | 2020-11-13 12:36:40 +0530 | [diff] [blame] | 80 | void av1_tf_do_filtering_mt(AV1_COMP *cpi); |
| 81 | |
| 82 | void av1_tf_mt_dealloc(AV1TemporalFilterSync *tf_sync); |
| 83 | |
Nithya V S | b6871a7 | 2020-12-25 23:05:48 +0530 | [diff] [blame] | 84 | void av1_compute_num_workers_for_mt(AV1_COMP *cpi); |
| 85 | |
Angie Chiang | 09543c1 | 2022-05-18 10:14:41 -0700 | [diff] [blame] | 86 | int av1_get_max_num_workers(const AV1_COMP *cpi); |
Sachin Kumar Garg | 194c57b | 2020-05-06 08:50:13 +0530 | [diff] [blame] | 87 | |
Mufaddal Chakera | 8c2d517 | 2021-06-09 01:33:48 +0530 | [diff] [blame] | 88 | void av1_create_workers(AV1_PRIMARY *ppi, int num_workers); |
| 89 | |
| 90 | void av1_init_frame_mt(AV1_PRIMARY *ppi, AV1_COMP *cpi); |
Sachin Kumar Garg | 800e70a | 2020-05-15 19:19:51 +0530 | [diff] [blame] | 91 | |
Nithya V S | 75d5d07 | 2021-08-18 11:09:13 +0530 | [diff] [blame] | 92 | void av1_init_cdef_worker(AV1_COMP *cpi); |
| 93 | |
| 94 | #if !CONFIG_REALTIME_ONLY |
| 95 | void av1_init_lr_mt_buffers(AV1_COMP *cpi); |
| 96 | #endif |
| 97 | |
Mufaddal Chakera | a313888 | 2021-06-01 13:43:06 +0530 | [diff] [blame] | 98 | #if CONFIG_MULTITHREAD |
| 99 | void av1_init_mt_sync(AV1_COMP *cpi, int is_first_pass); |
| 100 | #endif // CONFIG_MULTITHREAD |
| 101 | |
Nithya V S | e6f0b27 | 2021-08-18 10:55:10 +0530 | [diff] [blame] | 102 | int av1_get_num_mod_workers_for_alloc(PrimaryMultiThreadInfo *const p_mt_info, |
| 103 | MULTI_THREADED_MODULES mod_name); |
| 104 | |
Mufaddal Chakera | 8c2d517 | 2021-06-09 01:33:48 +0530 | [diff] [blame] | 105 | void av1_init_tile_thread_data(AV1_PRIMARY *ppi, int is_first_pass); |
Nithya V S | b6871a7 | 2020-12-25 23:05:48 +0530 | [diff] [blame] | 106 | |
venkat sanampudi | d7bf550 | 2020-10-21 10:55:34 +0530 | [diff] [blame] | 107 | void av1_cdef_mse_calc_frame_mt(AV1_COMMON *cm, MultiThreadInfo *mt_info, |
| 108 | CdefSearchCtx *cdef_search_ctx); |
| 109 | |
| 110 | void av1_cdef_mt_dealloc(AV1CdefSync *cdef_sync); |
| 111 | |
Cherma Rajan A | ce0c423 | 2021-04-23 21:29:51 +0530 | [diff] [blame] | 112 | void 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 A | 248e8d3 | 2021-06-15 09:06:38 +0530 | [diff] [blame] | 117 | uint8_t **tile_data_start, const int num_workers); |
Cherma Rajan A | ce0c423 | 2021-04-23 21:29:51 +0530 | [diff] [blame] | 118 | |
Mufaddal Chakera | 92fbfed | 2021-06-25 10:18:05 +0530 | [diff] [blame] | 119 | int av1_compute_num_enc_workers(AV1_COMP *cpi, int max_workers); |
| 120 | |
Tarundeep Singh | 6107e33 | 2021-09-24 11:56:15 +0530 | [diff] [blame] | 121 | int av1_compute_num_fp_contexts(AV1_PRIMARY *ppi, AV1EncoderConfig *oxcf); |
| 122 | |
Tarundeep Singh | 0192bca | 2021-08-18 23:44:38 +0530 | [diff] [blame] | 123 | int av1_check_fpmt_config(AV1_PRIMARY *const ppi, AV1EncoderConfig *const oxcf); |
| 124 | |
Mufaddal Chakera | d777f7b | 2021-07-26 02:13:20 +0530 | [diff] [blame] | 125 | int av1_compress_parallel_frames(AV1_PRIMARY *const ppi, |
| 126 | AV1_COMP_DATA *const first_cpi_data); |
James Zern | 55f5d55 | 2015-09-09 21:05:42 -0700 | [diff] [blame] | 127 | #ifdef __cplusplus |
| 128 | } // extern "C" |
| 129 | #endif |
| 130 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 131 | #endif // AOM_AV1_ENCODER_ETHREAD_H_ |