• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #if CONFIG_FRAME_PARALLEL_ENCODE
26   struct ThreadData *original_td;
27 #endif  // CONFIG_FRAME_PARALLEL_ENCODE
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_tf_do_filtering_mt(AV1_COMP *cpi);
77 
78 void av1_tf_mt_dealloc(AV1TemporalFilterSync *tf_sync);
79 
80 void av1_compute_num_workers_for_mt(AV1_COMP *cpi);
81 
82 int av1_get_max_num_workers(AV1_COMP *cpi);
83 
84 void av1_create_workers(AV1_PRIMARY *ppi, int num_workers);
85 
86 void av1_init_frame_mt(AV1_PRIMARY *ppi, AV1_COMP *cpi);
87 
88 void av1_init_cdef_worker(AV1_COMP *cpi);
89 
90 #if !CONFIG_REALTIME_ONLY
91 void av1_init_lr_mt_buffers(AV1_COMP *cpi);
92 #endif
93 
94 #if CONFIG_MULTITHREAD
95 void av1_init_mt_sync(AV1_COMP *cpi, int is_first_pass);
96 #endif  // CONFIG_MULTITHREAD
97 
98 int av1_get_num_mod_workers_for_alloc(PrimaryMultiThreadInfo *const p_mt_info,
99                                       MULTI_THREADED_MODULES mod_name);
100 
101 void av1_init_tile_thread_data(AV1_PRIMARY *ppi, int is_first_pass);
102 
103 int av1_compute_num_fp_contexts(AV1_PRIMARY *ppi, AV1EncoderConfig *oxcf);
104 
105 void av1_cdef_mse_calc_frame_mt(AV1_COMMON *cm, MultiThreadInfo *mt_info,
106                                 CdefSearchCtx *cdef_search_ctx);
107 
108 void av1_cdef_mt_dealloc(AV1CdefSync *cdef_sync);
109 
110 void av1_write_tile_obu_mt(
111     AV1_COMP *const cpi, uint8_t *const dst, uint32_t *total_size,
112     struct aom_write_bit_buffer *saved_wb, uint8_t obu_extn_header,
113     const FrameHeaderInfo *fh_info, int *const largest_tile_id,
114     unsigned int *max_tile_size, uint32_t *const obu_header_size,
115     uint8_t **tile_data_start, const int num_workers);
116 
117 int av1_compute_num_enc_workers(AV1_COMP *cpi, int max_workers);
118 
119 #if CONFIG_FRAME_PARALLEL_ENCODE
120 int av1_compress_parallel_frames(AV1_PRIMARY *const ppi,
121                                  AV1_COMP_DATA *const first_cpi_data);
122 #endif
123 
124 #ifdef __cplusplus
125 }  // extern "C"
126 #endif
127 
128 #endif  // AOM_AV1_ENCODER_ETHREAD_H_
129