1 /*
2 * Copyright(c) 2019 Intel Corporation
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 https://www.aomedia.org/license/software-license. 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 https://www.aomedia.org/license/patent-license.
10 */
11 
12 #ifndef EbEncHandle_h
13 #define EbEncHandle_h
14 
15 #include "EbDefinitions.h"
16 #include "EbSvtAv1Enc.h"
17 #include "EbPictureBufferDesc.h"
18 #include "EbSystemResourceManager.h"
19 #include "EbSequenceControlSet.h"
20 #include "EbObject.h"
21 
22 struct _EbThreadContext {
23     EbDctor dctor;
24     EbPtr   priv;
25 };
26 
27 /**************************************
28  * Component Private Data
29  **************************************/
30 struct _EbEncHandle {
31     EbDctor dctor;
32     // Encode Instances & Compute Segments
33     uint32_t encode_instance_total_count;
34     uint32_t compute_segments_total_count_array;
35 
36     // Config Set Counts
37     uint32_t scs_pool_total_count;
38 
39     // Full Results Count
40     uint32_t pcs_pool_total_count;
41 
42     // Picture Buffer Count
43     uint32_t ref_pic_pool_total_count;
44 
45     // Config Set Pool & Active Array
46     EbSystemResource *             scs_pool_ptr; // sequence_control_set_pool
47     EbSequenceControlSetInstance **scs_instance_array;
48 
49     // Full Results
50     EbSystemResource **picture_control_set_pool_ptr_array;
51 
52     EbSystemResource **enc_dec_pool_ptr_array;
53 
54 
55     //ParentControlSet
56     EbSystemResource **picture_parent_control_set_pool_ptr_array;
57     EbSystemResource **me_pool_ptr_array;
58     // Picture Buffers
59     EbSystemResource **reference_picture_pool_ptr_array;
60     EbSystemResource **pa_reference_picture_pool_ptr_array;
61 
62     // Overlay input picture
63     EbSystemResource **overlay_input_picture_pool_ptr_array;
64 
65     // Thread Handles
66     EbHandle  resource_coordination_thread_handle;
67     EbHandle *picture_analysis_thread_handle_array;
68     EbHandle  picture_decision_thread_handle;
69     EbHandle *motion_estimation_thread_handle_array;
70     EbHandle  initial_rate_control_thread_handle;
71     EbHandle *source_based_operations_thread_handle_array;
72     EbHandle *tpl_disp_thread_handle_array;
73     EbHandle  picture_manager_thread_handle;
74     EbHandle  rate_control_thread_handle;
75     EbHandle *mode_decision_configuration_thread_handle_array;
76     EbHandle *enc_dec_thread_handle_array;
77     EbHandle *entropy_coding_thread_handle_array;
78     EbHandle *dlf_thread_handle_array;
79     EbHandle *cdef_thread_handle_array;
80     EbHandle *rest_thread_handle_array;
81 
82     EbHandle packetization_thread_handle;
83 
84     // Contexts
85     EbThreadContext * resource_coordination_context_ptr;
86     EbThreadContext **picture_analysis_context_ptr_array;
87     EbThreadContext * picture_decision_context_ptr;
88     EbThreadContext **motion_estimation_context_ptr_array;
89     EbThreadContext * initial_rate_control_context_ptr;
90     EbThreadContext **source_based_operations_context_ptr_array;
91     EbThreadContext **tpl_disp_context_ptr_array;
92     EbThreadContext * picture_manager_context_ptr;
93     EbThreadContext * rate_control_context_ptr;
94     EbThreadContext **mode_decision_configuration_context_ptr_array;
95     EbThreadContext **enc_dec_context_ptr_array;
96     EbThreadContext **entropy_coding_context_ptr_array;
97     EbThreadContext **dlf_context_ptr_array;
98     EbThreadContext **cdef_context_ptr_array;
99     EbThreadContext **rest_context_ptr_array;
100     EbThreadContext * packetization_context_ptr;
101 
102     // System Resource Managers
103     EbSystemResource * input_buffer_resource_ptr;
104     EbSystemResource **output_stream_buffer_resource_ptr_array;
105     EbSystemResource **output_recon_buffer_resource_ptr_array;
106     EbSystemResource **output_statistics_buffer_resource_ptr_array;
107     EbSystemResource * resource_coordination_results_resource_ptr;
108     EbSystemResource * picture_analysis_results_resource_ptr;
109     EbSystemResource * picture_decision_results_resource_ptr;
110     EbSystemResource * motion_estimation_results_resource_ptr;
111     EbSystemResource * initial_rate_control_results_resource_ptr;
112     EbSystemResource * picture_demux_results_resource_ptr;
113     EbSystemResource * tpl_disp_res_srm;
114     EbSystemResource * rate_control_tasks_resource_ptr;
115     EbSystemResource * rate_control_results_resource_ptr;
116     EbSystemResource * enc_dec_tasks_resource_ptr;
117     EbSystemResource * enc_dec_results_resource_ptr;
118     EbSystemResource * entropy_coding_results_resource_ptr;
119     EbSystemResource * dlf_results_resource_ptr;
120     EbSystemResource * cdef_results_resource_ptr;
121     EbSystemResource * rest_results_resource_ptr;
122 
123     // Callbacks
124     EbCallback **app_callback_ptr_array;
125 
126     EbFifo *input_buffer_producer_fifo_ptr;
127     EbFifo *output_stream_buffer_consumer_fifo_ptr;
128     EbFifo *output_recon_buffer_consumer_fifo_ptr;
129 };
130 
131 #endif // EbEncHandle_h
132