1 /* 2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved 3 * 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. 10 */ 11 12 #ifndef AOM_AV1_ENCODER_ETHREAD_H_ 13 #define AOM_AV1_ENCODER_ETHREAD_H_ 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 struct AV1_COMP; 20 struct ThreadData; 21 22 typedef struct EncWorkerData { 23 struct AV1_COMP *cpi; 24 struct ThreadData *td; 25 struct ThreadData *original_td; 26 AV1LfSync *lf_sync; 27 LFWorkerData *lf_data; 28 int start; 29 int thread_id; 30 } EncWorkerData; 31 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); 35 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); 40 41 void av1_encode_tiles_mt(struct AV1_COMP *cpi); 42 void av1_encode_tiles_row_mt(struct AV1_COMP *cpi); 43 44 #if !CONFIG_REALTIME_ONLY 45 void av1_fp_encode_tiles_row_mt(AV1_COMP *cpi); 46 47 int av1_fp_compute_num_enc_workers(AV1_COMP *cpi); 48 #endif 49 50 void av1_accumulate_frame_counts(struct FRAME_COUNTS *acc_counts, 51 const struct FRAME_COUNTS *counts); 52 53 void av1_row_mt_mem_dealloc(AV1_COMP *cpi); 54 55 void av1_global_motion_estimation_mt(AV1_COMP *cpi); 56 57 void av1_gm_dealloc(AV1GlobalMotionSync *gm_sync_data); 58 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 76 void av1_calc_mb_wiener_var_mt(AV1_COMP *cpi, int num_workers, 77 double *sum_rec_distortion, 78 double *sum_est_rate); 79 80 void av1_tf_do_filtering_mt(AV1_COMP *cpi); 81 82 void av1_tf_mt_dealloc(AV1TemporalFilterSync *tf_sync); 83 84 void av1_compute_num_workers_for_mt(AV1_COMP *cpi); 85 86 int av1_get_max_num_workers(const AV1_COMP *cpi); 87 88 void av1_create_workers(AV1_PRIMARY *ppi, int num_workers); 89 90 void av1_init_frame_mt(AV1_PRIMARY *ppi, AV1_COMP *cpi); 91 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 98 #if CONFIG_MULTITHREAD 99 void av1_init_mt_sync(AV1_COMP *cpi, int is_first_pass); 100 #endif // CONFIG_MULTITHREAD 101 102 int av1_get_num_mod_workers_for_alloc(PrimaryMultiThreadInfo *const p_mt_info, 103 MULTI_THREADED_MODULES mod_name); 104 105 void av1_init_tile_thread_data(AV1_PRIMARY *ppi, int is_first_pass); 106 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 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, 117 uint8_t **tile_data_start, const int num_workers); 118 119 int av1_compute_num_enc_workers(AV1_COMP *cpi, int max_workers); 120 121 int av1_compute_num_fp_contexts(AV1_PRIMARY *ppi, AV1EncoderConfig *oxcf); 122 123 int av1_check_fpmt_config(AV1_PRIMARY *const ppi, AV1EncoderConfig *const oxcf); 124 125 int av1_compress_parallel_frames(AV1_PRIMARY *const ppi, 126 AV1_COMP_DATA *const first_cpi_data); 127 #ifdef __cplusplus 128 } // extern "C" 129 #endif 130 131 #endif // AOM_AV1_ENCODER_ETHREAD_H_ 132