/src/libhevc/encoder/ihevce_error_check.c
Line | Count | Source (jump to first uncovered line) |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Copyright (C) 2018 The Android Open Source Project |
4 | | * |
5 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | | * you may not use this file except in compliance with the License. |
7 | | * You may obtain a copy of the License at: |
8 | | * |
9 | | * http://www.apache.org/licenses/LICENSE-2.0 |
10 | | * |
11 | | * Unless required by applicable law or agreed to in writing, software |
12 | | * distributed under the License is distributed on an "AS IS" BASIS, |
13 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 | | * See the License for the specific language governing permissions and |
15 | | * limitations under the License. |
16 | | * |
17 | | ***************************************************************************** |
18 | | * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore |
19 | | */ |
20 | | |
21 | | /*! |
22 | | ****************************************************************************** |
23 | | * \file ihevce_error_checks.c |
24 | | * |
25 | | * \brief |
26 | | * This file contains all the functions which checks the validity of the |
27 | | * parameters passed to the encoder. |
28 | | * |
29 | | * \date |
30 | | * 18/09/2012 |
31 | | * |
32 | | * \author |
33 | | * Ittiam |
34 | | * |
35 | | * List of Functions |
36 | | * ihevce_get_level_index() |
37 | | * ihevce_hle_validate_static_params() |
38 | | * ihevce_validate_tile_config_params() |
39 | | * |
40 | | ****************************************************************************** |
41 | | */ |
42 | | |
43 | | /*****************************************************************************/ |
44 | | /* File Includes */ |
45 | | /*****************************************************************************/ |
46 | | /* System include files */ |
47 | | #include <stdio.h> |
48 | | #include <string.h> |
49 | | #include <stdlib.h> |
50 | | #include <assert.h> |
51 | | #include <stdarg.h> |
52 | | #include <math.h> |
53 | | |
54 | | /* User include files */ |
55 | | #include "ihevc_typedefs.h" |
56 | | #include "itt_video_api.h" |
57 | | #include "ihevce_api.h" |
58 | | |
59 | | #include "rc_cntrl_param.h" |
60 | | #include "rc_frame_info_collector.h" |
61 | | #include "rc_look_ahead_params.h" |
62 | | |
63 | | #include "ihevc_defs.h" |
64 | | #include "ihevc_macros.h" |
65 | | #include "ihevc_debug.h" |
66 | | #include "ihevc_structs.h" |
67 | | #include "ihevc_platform_macros.h" |
68 | | #include "ihevc_deblk.h" |
69 | | #include "ihevc_itrans_recon.h" |
70 | | #include "ihevc_chroma_itrans_recon.h" |
71 | | #include "ihevc_chroma_intra_pred.h" |
72 | | #include "ihevc_intra_pred.h" |
73 | | #include "ihevc_inter_pred.h" |
74 | | #include "ihevc_mem_fns.h" |
75 | | #include "ihevc_padding.h" |
76 | | #include "ihevc_weighted_pred.h" |
77 | | #include "ihevc_sao.h" |
78 | | #include "ihevc_resi_trans.h" |
79 | | #include "ihevc_quant_iquant_ssd.h" |
80 | | #include "ihevc_cabac_tables.h" |
81 | | #include "ihevc_trans_tables.h" |
82 | | #include "ihevc_trans_macros.h" |
83 | | |
84 | | #include "ihevce_defs.h" |
85 | | #include "ihevce_lap_enc_structs.h" |
86 | | #include "ihevce_hle_interface.h" |
87 | | #include "ihevce_multi_thrd_structs.h" |
88 | | #include "ihevce_multi_thrd_funcs.h" |
89 | | #include "ihevce_me_common_defs.h" |
90 | | #include "ihevce_had_satd.h" |
91 | | #include "ihevce_error_codes.h" |
92 | | #include "ihevce_error_checks.h" |
93 | | #include "ihevce_bitstream.h" |
94 | | #include "ihevce_cabac.h" |
95 | | #include "ihevce_rdoq_macros.h" |
96 | | #include "ihevce_function_selector.h" |
97 | | #include "ihevce_enc_structs.h" |
98 | | #include "ihevce_global_tables.h" |
99 | | #include "ihevce_trace.h" |
100 | | |
101 | | /*****************************************************************************/ |
102 | | /* Function Definitions */ |
103 | | /*****************************************************************************/ |
104 | | |
105 | | /*! |
106 | | ****************************************************************************** |
107 | | * \if Function name : ihevce_validate_tile_config_params \endif |
108 | | * |
109 | | * \brief |
110 | | * This function validates the static parameters related to tiles |
111 | | * |
112 | | * \param[in] Encoder static config prms pointer |
113 | | * |
114 | | * \return |
115 | | * None |
116 | | * |
117 | | * \author |
118 | | * Ittiam |
119 | | * |
120 | | ***************************************************************************** |
121 | | */ |
122 | | WORD32 ihevce_validate_tile_config_params(ihevce_static_cfg_params_t *ps_static_cfg_prms) |
123 | 8.85k | { |
124 | 8.85k | WORD32 error_code = IHEVCE_SUCCESS; |
125 | 8.85k | ihevce_sys_api_t *ps_sys_api = &ps_static_cfg_prms->s_sys_api; |
126 | 8.85k | void *pv_cb_handle = ps_sys_api->pv_cb_handle; |
127 | | |
128 | | /* As of now tiles are not supported */ |
129 | 8.85k | if(ps_static_cfg_prms->s_app_tile_params.i4_tiles_enabled_flag != 0) |
130 | 0 | { |
131 | 0 | error_code = IHEVCE_BAD_TILE_CONFIGURATION; |
132 | 0 | ps_sys_api->ihevce_printf( |
133 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_tiles_enabled_flag should be set to 0 \n"); |
134 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
135 | 0 | } |
136 | | |
137 | 8.85k | return error_code; |
138 | 8.85k | } |
139 | | |
140 | | /*! |
141 | | ****************************************************************************** |
142 | | * \if Function name : ihevce_hle_validate_static_params \endif |
143 | | * |
144 | | * \brief |
145 | | * This function validates the static parameters before creating the encoder |
146 | | * instance. |
147 | | * |
148 | | * \param[in] Encoder context pointer |
149 | | * |
150 | | * \return |
151 | | * Error code |
152 | | * |
153 | | * \author |
154 | | * Ittiam |
155 | | * |
156 | | ***************************************************************************** |
157 | | */ |
158 | | WORD32 ihevce_hle_validate_static_params(ihevce_static_cfg_params_t *ps_static_cfg_prms) |
159 | 8.88k | { |
160 | 8.88k | WORD32 error_code; |
161 | 8.88k | WORD32 i4_resolution_id; |
162 | 8.88k | WORD32 ai4_num_bitrate_instances[IHEVCE_MAX_NUM_RESOLUTIONS] = { 1 }; |
163 | 8.88k | WORD32 i4_num_resolutions; |
164 | 8.88k | ihevce_sys_api_t *ps_sys_api = &ps_static_cfg_prms->s_sys_api; |
165 | 8.88k | void *pv_cb_handle = ps_sys_api->pv_cb_handle; |
166 | | |
167 | | /* derive local variables */ |
168 | 8.88k | i4_num_resolutions = ps_static_cfg_prms->s_tgt_lyr_prms.i4_num_res_layers; |
169 | 17.7k | for(i4_resolution_id = 0; i4_resolution_id < i4_num_resolutions; i4_resolution_id++) |
170 | 8.88k | { |
171 | 8.88k | ai4_num_bitrate_instances[i4_resolution_id] = |
172 | 8.88k | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id] |
173 | 8.88k | .i4_num_bitrate_instances; |
174 | 8.88k | } |
175 | | // clang-format off |
176 | 8.88k | if(0 != ps_static_cfg_prms->i4_log_dump_level) |
177 | 0 | { |
178 | | /* Print all the config params */ |
179 | 0 | if((0 == ps_static_cfg_prms->i4_res_id) && (0 == ps_static_cfg_prms->i4_br_id)) |
180 | 0 | { |
181 | 0 | WORD32 i4_resolution_id_loop, i4_i; |
182 | 0 | WORD32 i4_num_res_layers = ps_static_cfg_prms->s_tgt_lyr_prms.i4_num_res_layers; |
183 | |
|
184 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "**********************************************\n"); |
185 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "*********** STATIC PARAMS CONFIG *************\n"); |
186 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "**********************************************\n"); |
187 | |
|
188 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : ps_static_cfg_prms->s_src_prms \n"); |
189 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_width %d \n", ps_static_cfg_prms->s_src_prms.i4_width); |
190 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_height %d \n", ps_static_cfg_prms->s_src_prms.i4_height); |
191 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_frm_rate_num %d \n", ps_static_cfg_prms->s_src_prms.i4_frm_rate_num); |
192 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_frm_rate_denom %d \n", ps_static_cfg_prms->s_src_prms.i4_frm_rate_denom); |
193 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_field_pic %d \n", ps_static_cfg_prms->s_src_prms.i4_field_pic); |
194 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_chr_format %d \n", ps_static_cfg_prms->s_src_prms.i4_chr_format); |
195 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_input_bit_depth %d \n", ps_static_cfg_prms->s_src_prms.i4_input_bit_depth); |
196 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_topfield_first %d \n\n", ps_static_cfg_prms->s_src_prms.i4_topfield_first); |
197 | |
|
198 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : ps_static_cfg_prms->s_tgt_lyr_prms \n"); |
199 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_num_res_layers %d \n", i4_num_res_layers); |
200 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_multi_res_layer_reuse %d \n", ps_static_cfg_prms->s_tgt_lyr_prms.i4_multi_res_layer_reuse); |
201 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_mbr_quality_setting %d \n", ps_static_cfg_prms->s_tgt_lyr_prms.i4_mbr_quality_setting); |
202 | |
|
203 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : For Each resolution,"); |
204 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : i4_target_width "); |
205 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
206 | 0 | { |
207 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d ", i4_resolution_id_loop, ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].i4_width); |
208 | 0 | } |
209 | |
|
210 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : i4_target_width "); |
211 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
212 | 0 | { |
213 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d ", i4_resolution_id_loop, ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].i4_height); |
214 | 0 | } |
215 | |
|
216 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : i4_frm_rate_scale_factor "); |
217 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
218 | 0 | { |
219 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d ", i4_resolution_id_loop, |
220 | 0 | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].i4_frm_rate_scale_factor); |
221 | 0 | } |
222 | |
|
223 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : i4_codec_level "); |
224 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
225 | 0 | { |
226 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d ", i4_resolution_id_loop, ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].i4_codec_level); |
227 | 0 | } |
228 | |
|
229 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : i4_num_bitrate_instances "); |
230 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
231 | 0 | { |
232 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d", i4_resolution_id_loop, |
233 | 0 | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].i4_num_bitrate_instances); |
234 | 0 | } |
235 | |
|
236 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\n"); |
237 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
238 | 0 | { |
239 | 0 | WORD32 i4_num_bitrate_instances, i4_br_loop; |
240 | 0 | i4_num_bitrate_instances = ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].i4_num_bitrate_instances; |
241 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_tgt_bitrate res_id %d ", i4_resolution_id_loop); |
242 | 0 | for(i4_br_loop = 0; i4_br_loop < i4_num_bitrate_instances; i4_br_loop++) |
243 | 0 | { |
244 | 0 | PRINTF( |
245 | 0 | ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "br_id %d %d ", i4_br_loop, ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].ai4_tgt_bitrate[i4_br_loop]); |
246 | 0 | } |
247 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\n"); |
248 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_peak_bitrate res_id %d ", i4_resolution_id_loop); |
249 | 0 | for(i4_br_loop = 0; i4_br_loop < i4_num_bitrate_instances; i4_br_loop++) |
250 | 0 | { |
251 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "br_id %d %d ", i4_br_loop, |
252 | 0 | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].ai4_peak_bitrate[i4_br_loop]); |
253 | 0 | } |
254 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\n"); |
255 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : vbv_buffer_size res_id %d ", i4_resolution_id_loop); |
256 | 0 | for(i4_br_loop = 0; i4_br_loop < i4_num_bitrate_instances; i4_br_loop++) |
257 | 0 | { |
258 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "br_id %d %d ", i4_br_loop, |
259 | 0 | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].ai4_max_vbv_buffer_size[i4_br_loop]); |
260 | 0 | } |
261 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\n"); |
262 | 0 | } |
263 | |
|
264 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
265 | 0 | { |
266 | 0 | WORD32 i4_num_bitrate_instances, i4_br_loop; |
267 | |
|
268 | 0 | i4_num_bitrate_instances = ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].i4_num_bitrate_instances; |
269 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_frame_qp res_id %d ", i4_resolution_id_loop); |
270 | 0 | for(i4_br_loop = 0; i4_br_loop < i4_num_bitrate_instances; i4_br_loop++) |
271 | 0 | { |
272 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "br_id %d %d ", i4_br_loop, ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].ai4_frame_qp[i4_br_loop]); |
273 | 0 | } |
274 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\n"); |
275 | 0 | } |
276 | |
|
277 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_internal_bit_depth %d \n", ps_static_cfg_prms->s_tgt_lyr_prms.i4_internal_bit_depth); |
278 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_enable_temporal_scalability %d \n", ps_static_cfg_prms->s_tgt_lyr_prms.i4_enable_temporal_scalability); |
279 | |
|
280 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_quality_preset "); |
281 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
282 | 0 | { |
283 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d", i4_resolution_id_loop, ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id_loop].i4_quality_preset); |
284 | 0 | } |
285 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\n"); |
286 | |
|
287 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_coding_tools_prms \n"); |
288 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_idr_period %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period); |
289 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_min_idr_period %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_min_closed_gop_period); |
290 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_cra_period %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_max_cra_open_gop_period); |
291 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_i_cra_period %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_max_i_open_gop_period); |
292 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_temporal_layers %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers); |
293 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_reference_frames %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_max_reference_frames); |
294 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_deblocking_type %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_deblocking_type); |
295 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_use_default_sc_mtx %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_use_default_sc_mtx); |
296 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_enable_entropy_sync %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_enable_entropy_sync); |
297 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_cropping_mode %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_cropping_mode); |
298 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_vqet %d \n", ps_static_cfg_prms->s_coding_tools_prms.i4_vqet); |
299 | |
|
300 | 0 | switch(ps_static_cfg_prms->e_arch_type) |
301 | 0 | { |
302 | 0 | case ARCH_NA: |
303 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : archType %d \n", 0); |
304 | 0 | break; |
305 | | #ifdef ARM |
306 | | case ARCH_ARM_NONEON: |
307 | | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : archType %d \n", 4); |
308 | | break; |
309 | | #endif |
310 | 0 | default: |
311 | 0 | break; |
312 | 0 | } |
313 | | |
314 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_config_prms \n"); |
315 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_num_frms_to_encode %d \n", ps_static_cfg_prms->s_config_prms.i4_num_frms_to_encode); |
316 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_log2_cu_size %d \n", ps_static_cfg_prms->s_config_prms.i4_max_log2_cu_size); |
317 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_log2_cu_size %d \n", ps_static_cfg_prms->s_config_prms.i4_min_log2_cu_size); |
318 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_log2_cu_size %d \n", ps_static_cfg_prms->s_config_prms.i4_max_log2_tu_size); |
319 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_log2_cu_size %d \n", ps_static_cfg_prms->s_config_prms.i4_min_log2_cu_size); |
320 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_tr_tree_depth_I %d \n", ps_static_cfg_prms->s_config_prms.i4_max_tr_tree_depth_I); |
321 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_tr_tree_depth_nI %d \n", ps_static_cfg_prms->s_config_prms.i4_max_tr_tree_depth_nI); |
322 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_search_range_horz %d \n", ps_static_cfg_prms->s_config_prms.i4_max_search_range_horz); |
323 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_search_range_vert %d \n", ps_static_cfg_prms->s_config_prms.i4_max_search_range_vert); |
324 | |
|
325 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_multi_thrd_prms \n"); |
326 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_num_cores %d \n", ps_static_cfg_prms->s_multi_thrd_prms.i4_max_num_cores); |
327 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_use_thrd_affinity %d \n", ps_static_cfg_prms->s_multi_thrd_prms.i4_use_thrd_affinity); |
328 | |
|
329 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : rate control params \n"); |
330 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_rate_control_mode %d \n", ps_static_cfg_prms->s_config_prms.i4_rate_control_mode); |
331 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_cu_level_rc %d \n", ps_static_cfg_prms->s_config_prms.i4_cu_level_rc); |
332 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_pass %d \n", ps_static_cfg_prms->s_pass_prms.i4_pass); |
333 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_vbr_max_peak_rate_dur %d \n", ps_static_cfg_prms->s_config_prms.i4_vbr_max_peak_rate_dur); |
334 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_init_vbv_fullness %d \n", ps_static_cfg_prms->s_config_prms.i4_init_vbv_fullness); |
335 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_stuffing_enable %d \n", ps_static_cfg_prms->s_config_prms.i4_stuffing_enable); |
336 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_max_frame_qp %d \n", ps_static_cfg_prms->s_config_prms.i4_max_frame_qp); |
337 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_min_frame_qp %d \n", ps_static_cfg_prms->s_config_prms.i4_min_frame_qp); |
338 | |
|
339 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\n"); |
340 | |
|
341 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_lap_prms\n"); |
342 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_rc_look_ahead_pics %d \n", ps_static_cfg_prms->s_lap_prms.i4_rc_look_ahead_pics); |
343 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_enable_wts_ofsts %d \n", ps_static_cfg_prms->s_lap_prms.i4_enable_wts_ofsts); |
344 | |
|
345 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_out_strm_prms\n"); |
346 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_codec_type %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_codec_type); |
347 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_codec_profile %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_codec_profile); |
348 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_codec_tier %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_codec_tier); |
349 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_aud_enable_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_aud_enable_flags); |
350 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_interop_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_interop_flags); |
351 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sps_at_cdr_enable %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sps_at_cdr_enable); |
352 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_vui_enable %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_vui_enable); |
353 | 0 | #ifndef DISABLE_SEI |
354 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_enable_flag %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_enable_flag); |
355 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_payload_enable_flag %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_payload_enable_flag); |
356 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_buffer_period_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_buffer_period_flags); |
357 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_pic_timing_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_pic_timing_flags); |
358 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_cll_enable %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_cll_enable); |
359 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_sei_avg_cll %d \n", ps_static_cfg_prms->s_out_strm_prms.u2_sei_avg_cll); |
360 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_sei_max_cll %d \n", ps_static_cfg_prms->s_out_strm_prms.u2_sei_max_cll); |
361 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_recovery_point_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_recovery_point_flags); |
362 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_mastering_disp_colour_vol_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags); |
363 | 0 | for(i4_i = 0; i4_i < 3; i4_i++) |
364 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_display_primaries_x[i4_i] %d \n", ps_static_cfg_prms->s_out_strm_prms.au2_display_primaries_x[i4_i]); |
365 | 0 | for(i4_i = 0; i4_i < 3; i4_i++) |
366 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_display_primaries_y[i4_i] %d \n", ps_static_cfg_prms->s_out_strm_prms.au2_display_primaries_y[i4_i]); |
367 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_white_point_x %d \n", ps_static_cfg_prms->s_out_strm_prms.u2_white_point_x); |
368 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_white_point_y %d \n", ps_static_cfg_prms->s_out_strm_prms.u2_white_point_y); |
369 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u4_max_display_mastering_luminance %d \n", ps_static_cfg_prms->s_out_strm_prms.u4_max_display_mastering_luminance); |
370 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u4_min_display_mastering_luminance %d \n", ps_static_cfg_prms->s_out_strm_prms.u4_min_display_mastering_luminance); |
371 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_hash_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_decoded_pic_hash_sei_flag); |
372 | 0 | #endif |
373 | |
|
374 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_app_tile_params\n"); |
375 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_tiles_enabled_flag %d \n", ps_static_cfg_prms->s_app_tile_params.i4_tiles_enabled_flag); |
376 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_uniform_spacing_flag %d \n", ps_static_cfg_prms->s_app_tile_params.i4_uniform_spacing_flag); |
377 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_num_tile_cols %d \n", ps_static_cfg_prms->s_app_tile_params.i4_num_tile_cols); |
378 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_num_tile_rows %d \n", ps_static_cfg_prms->s_app_tile_params.i4_num_tile_rows); |
379 | |
|
380 | 0 | for(i4_i = 0; i4_i < ps_static_cfg_prms->s_app_tile_params.i4_num_tile_cols; i4_i++) |
381 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_column_width[i4_i] %d \n", ps_static_cfg_prms->s_app_tile_params.ai4_column_width[i4_i]); |
382 | |
|
383 | 0 | for(i4_i = 0; i4_i < ps_static_cfg_prms->s_app_tile_params.i4_num_tile_rows; i4_i++) |
384 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_row_height[i4_i] %d \n", ps_static_cfg_prms->s_app_tile_params.ai4_row_height[i4_i]); |
385 | |
|
386 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_slice_params\n"); |
387 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_slice_segment_mode %d \n", ps_static_cfg_prms->s_slice_params.i4_slice_segment_mode); |
388 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_slice_segment_argument %d \n", ps_static_cfg_prms->s_slice_params.i4_slice_segment_argument); |
389 | |
|
390 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_vui_sei_prms\n"); |
391 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_aspect_ratio_info_present_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_aspect_ratio_info_present_flag); |
392 | |
|
393 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_aspect_ratio_idc "); |
394 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
395 | 0 | { |
396 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d ", i4_resolution_id_loop, ps_static_cfg_prms->s_vui_sei_prms.au1_aspect_ratio_idc[i4_resolution_id_loop]); |
397 | 0 | } |
398 | |
|
399 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : au2_sar_width "); |
400 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
401 | 0 | { |
402 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d ", i4_resolution_id_loop, ps_static_cfg_prms->s_vui_sei_prms.au2_sar_width[i4_resolution_id_loop]); |
403 | 0 | } |
404 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : au2_sar_width "); |
405 | 0 | for(i4_resolution_id_loop = 0; i4_resolution_id_loop < i4_num_res_layers; i4_resolution_id_loop++) |
406 | 0 | { |
407 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "res_id %d %d ", i4_resolution_id_loop, ps_static_cfg_prms->s_vui_sei_prms.au2_sar_height[i4_resolution_id_loop]); |
408 | 0 | } |
409 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : u1_overscan_info_present_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_overscan_info_present_flag); |
410 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_overscan_appropriate_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_overscan_appropriate_flag); |
411 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_video_signal_type_present_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_video_signal_type_present_flag); |
412 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_video_format %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_video_format); |
413 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_video_full_range_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_video_full_range_flag); |
414 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_colour_description_present_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_colour_description_present_flag); |
415 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_colour_primaries %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_colour_primaries); |
416 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_transfer_characteristics %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_transfer_characteristics); |
417 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_matrix_coefficients %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_matrix_coefficients); |
418 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_chroma_loc_info_present_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_chroma_loc_info_present_flag); |
419 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_chroma_sample_loc_type_top_field %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_chroma_sample_loc_type_top_field); |
420 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_chroma_sample_loc_type_bottom_field %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_chroma_sample_loc_type_bottom_field); |
421 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_timing_info_present_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_timing_info_present_flag); |
422 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_vui_hrd_parameters_present_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_vui_hrd_parameters_present_flag); |
423 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u1_nal_hrd_parameters_present_flag %d \n", ps_static_cfg_prms->s_vui_sei_prms.u1_nal_hrd_parameters_present_flag); |
424 | 0 | } |
425 | | |
426 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms \n"); |
427 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_enable_logo %d \n", ps_static_cfg_prms->i4_enable_logo); |
428 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_log_dump_level %d \n", ps_static_cfg_prms->i4_log_dump_level); |
429 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_save_recon %d \n", ps_static_cfg_prms->i4_save_recon); |
430 | |
|
431 | 0 | PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "**********************************************\n"); |
432 | 0 | } |
433 | | // clang-format on |
434 | | |
435 | 8.88k | if(ps_static_cfg_prms->s_multi_thrd_prms.i4_num_proc_groups > MAX_NUMBER_PROC_GRPS) |
436 | 0 | { |
437 | 0 | error_code = IHEVCE_UNSUPPORTED_PROC_CONFIG; |
438 | 0 | ps_sys_api->ihevce_printf( |
439 | 0 | pv_cb_handle, "IHEVCE ERROR: Number of Processor Groups not supported \n"); |
440 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
441 | 0 | } |
442 | | |
443 | | /* Error check for system-api callback functions */ |
444 | 8.88k | if(NULL == ps_sys_api->ihevce_printf) |
445 | 0 | { |
446 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
447 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
448 | 0 | } |
449 | 8.88k | if(NULL == ps_sys_api->s_file_io_api.ihevce_fopen) |
450 | 0 | { |
451 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
452 | 0 | ps_sys_api->ihevce_printf( |
453 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_fopen callback function not initiallized\n"); |
454 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
455 | 0 | } |
456 | 8.88k | if(NULL == ps_sys_api->s_file_io_api.ihevce_fclose) |
457 | 0 | { |
458 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
459 | 0 | ps_sys_api->ihevce_printf( |
460 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_fclose callback function not initiallized\n"); |
461 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
462 | 0 | } |
463 | 8.88k | if(NULL == ps_sys_api->s_file_io_api.ihevce_fflush) |
464 | 0 | { |
465 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
466 | 0 | ps_sys_api->ihevce_printf( |
467 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_fflush callback function not initiallized\n"); |
468 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
469 | 0 | } |
470 | 8.88k | if(NULL == ps_sys_api->s_file_io_api.ihevce_fseek) |
471 | 0 | { |
472 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
473 | 0 | ps_sys_api->ihevce_printf( |
474 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_fseek callback function not initiallized\n"); |
475 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
476 | 0 | } |
477 | 8.88k | if(NULL == ps_sys_api->s_file_io_api.ihevce_fread) |
478 | 0 | { |
479 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
480 | 0 | ps_sys_api->ihevce_printf( |
481 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_fread callback function not initiallized\n"); |
482 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
483 | 0 | } |
484 | 8.88k | if(NULL == ps_sys_api->s_file_io_api.ihevce_fscanf) |
485 | 0 | { |
486 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
487 | 0 | ps_sys_api->ihevce_printf( |
488 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_fscanf callback function not initiallized\n"); |
489 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
490 | 0 | } |
491 | 8.88k | if(NULL == ps_sys_api->ihevce_sscanf) |
492 | 0 | { |
493 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
494 | 0 | ps_sys_api->ihevce_printf( |
495 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_sscanf callback function not initiallized\n"); |
496 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
497 | 0 | } |
498 | 8.88k | if(NULL == ps_sys_api->s_file_io_api.ihevce_fprintf) |
499 | 0 | { |
500 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
501 | 0 | ps_sys_api->ihevce_printf( |
502 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_fprintf callback function not initiallized\n"); |
503 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
504 | 0 | } |
505 | 8.88k | if(NULL == ps_sys_api->s_file_io_api.ihevce_fwrite) |
506 | 0 | { |
507 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
508 | 0 | ps_sys_api->ihevce_printf( |
509 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_fwrite callback function not initiallized\n"); |
510 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
511 | 0 | } |
512 | 8.88k | if(NULL == ps_sys_api->ihevce_sprintf) |
513 | 0 | { |
514 | 0 | error_code = IHEVCE_SYSTEM_APIS_NOT_INITIALLIZED; |
515 | 0 | ps_sys_api->ihevce_printf( |
516 | 0 | pv_cb_handle, "IHEVCE ERROR: ihevce_sprintf callback function not initiallized\n"); |
517 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
518 | 0 | } |
519 | | |
520 | | /* Error check for static source parameters */ |
521 | 8.88k | if((ps_static_cfg_prms->s_src_prms.i4_orig_width > HEVCE_MAX_WIDTH) || |
522 | 8.88k | (ps_static_cfg_prms->s_src_prms.i4_orig_width < 2)) |
523 | 6 | { |
524 | 6 | error_code = IHEVCE_WIDTH_NOT_SUPPORTED; |
525 | 6 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_src_width out of range \n"); |
526 | 6 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
527 | 6 | } |
528 | | |
529 | 8.87k | if((ps_static_cfg_prms->s_src_prms.i4_orig_height > HEVCE_MAX_HEIGHT) || |
530 | 8.87k | (ps_static_cfg_prms->s_src_prms.i4_orig_height < 2)) |
531 | 5 | { |
532 | 5 | error_code = IHEVCE_HEIGHT_NOT_SUPPORTED; |
533 | 5 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_src_height out of range \n"); |
534 | 5 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
535 | 5 | } |
536 | | /*check for odd resolution*/ |
537 | 8.87k | if(0 != (ps_static_cfg_prms->s_src_prms.i4_width & 1)) |
538 | 1 | { |
539 | 1 | error_code = IHEVCE_WIDTH_NOT_SUPPORTED; |
540 | 1 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_src_width not supported \n"); |
541 | 1 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
542 | 1 | } |
543 | 8.87k | if(0 != (ps_static_cfg_prms->s_src_prms.i4_height & 1)) |
544 | 1 | { |
545 | 1 | error_code = IHEVCE_HEIGHT_NOT_SUPPORTED; |
546 | 1 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_src_height not supported \n"); |
547 | 1 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
548 | 1 | } |
549 | | |
550 | 8.87k | if((ps_static_cfg_prms->s_src_prms.i4_frm_rate_denom != 1000) && |
551 | 8.87k | (ps_static_cfg_prms->s_src_prms.i4_frm_rate_denom != 1001)) |
552 | 0 | { |
553 | 0 | error_code = IHEVCE_FRAME_RATE_NOT_SUPPORTED; |
554 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: frame rate denom not supported \n"); |
555 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
556 | 0 | } |
557 | | |
558 | 8.87k | if((((ps_static_cfg_prms->s_src_prms.i4_frm_rate_num * 1.0) / |
559 | 8.87k | ps_static_cfg_prms->s_src_prms.i4_frm_rate_denom) > MAX_FRAME_RATE) || |
560 | 8.87k | (((ps_static_cfg_prms->s_src_prms.i4_frm_rate_num * 1.0) / |
561 | 8.87k | ps_static_cfg_prms->s_src_prms.i4_frm_rate_denom) < MIN_FRAME_RATE)) |
562 | 0 | { |
563 | 0 | error_code = IHEVCE_FRAME_RATE_NOT_SUPPORTED; |
564 | 0 | ps_sys_api->ihevce_printf( |
565 | 0 | pv_cb_handle, |
566 | 0 | "IHEVCE ERROR: Frame rate (%d / %d) is out of range [%.1f - %.1f]\n", |
567 | 0 | ps_static_cfg_prms->s_src_prms.i4_frm_rate_num, |
568 | 0 | ps_static_cfg_prms->s_src_prms.i4_frm_rate_denom, |
569 | 0 | MIN_FRAME_RATE, MAX_FRAME_RATE); |
570 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
571 | 0 | } |
572 | | |
573 | 8.87k | if(ps_static_cfg_prms->s_src_prms.i4_field_pic != 0) |
574 | 0 | { |
575 | 0 | error_code = IHEVCE_CONTENT_TYPE_NOT_SUPPORTED; |
576 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: Field encoding not supported \n"); |
577 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
578 | 0 | } |
579 | | |
580 | 8.87k | if(ps_static_cfg_prms->s_src_prms.inp_chr_format != IV_YUV_420SP_UV && |
581 | 8.87k | ps_static_cfg_prms->s_src_prms.inp_chr_format != IV_YUV_420P) |
582 | 0 | { |
583 | 0 | error_code = IHEVCE_CHROMA_FORMAT_NOT_SUPPORTED; |
584 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_input_chroma_format Invalid \n"); |
585 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
586 | 0 | } |
587 | | |
588 | 8.87k | if(ps_static_cfg_prms->s_src_prms.i4_chr_format != IV_YUV_420SP_UV) |
589 | 0 | { |
590 | 0 | error_code = IHEVCE_CHROMA_FORMAT_NOT_SUPPORTED; |
591 | 0 | ps_sys_api->ihevce_printf( |
592 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_internal_chroma_format Invalid \n"); |
593 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
594 | 0 | } |
595 | | |
596 | | /* Check error for interoperability flags */ |
597 | 8.87k | if(ps_static_cfg_prms->s_out_strm_prms.i4_interop_flags != 0) |
598 | 0 | { |
599 | 0 | error_code = IHEVCE_INTEROPERABILITY_FLAG_SUPPORTED; |
600 | 0 | ps_sys_api->ihevce_printf( |
601 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_interop_flags out of range, to be set to 0\n"); |
602 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
603 | 0 | } |
604 | | |
605 | | /* Error check for static output stream parameters */ |
606 | 8.87k | if(ps_static_cfg_prms->s_out_strm_prms.i4_codec_type != 0) |
607 | 0 | { |
608 | 0 | error_code = IHEVCE_CODEC_NOT_SUPPORTED; |
609 | 0 | ps_sys_api->ihevce_printf( |
610 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_codec_type should be set to 0 \n"); |
611 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
612 | 0 | } |
613 | | |
614 | 8.87k | if(ps_static_cfg_prms->s_out_strm_prms.i4_codec_profile != 1) |
615 | 0 | { |
616 | 0 | error_code = IHEVCE_CODEC_PROFILE_NOT_SUPPORTED; |
617 | 0 | ps_sys_api->ihevce_printf( |
618 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_codec_profile should be set to 1 \n"); |
619 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
620 | 0 | } |
621 | | |
622 | 8.87k | if(ps_static_cfg_prms->s_tgt_lyr_prms.i4_internal_bit_depth != 8) |
623 | 0 | { |
624 | 0 | error_code = IHEVCE_OUTPUT_BIT_DEPTH_OUT_OF_RANGE; |
625 | 0 | ps_sys_api->ihevce_printf( |
626 | 0 | pv_cb_handle, |
627 | 0 | "IHEVCE ERROR: (output_bit_depth = %d) not supported \n", |
628 | 0 | ps_static_cfg_prms->s_tgt_lyr_prms.i4_internal_bit_depth); |
629 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
630 | 0 | } |
631 | | |
632 | 8.87k | if(ps_static_cfg_prms->s_src_prms.i4_input_bit_depth != 8) |
633 | 0 | { |
634 | 0 | error_code = IHEVCE_INPUT_BIT_DEPTH_OUT_OF_RANGE; |
635 | 0 | ps_sys_api->ihevce_printf( |
636 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_input_bit_depth value not supported \n"); |
637 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
638 | 0 | } |
639 | | |
640 | 8.87k | if((ps_static_cfg_prms->s_out_strm_prms.i4_vui_enable > 1) || |
641 | 8.87k | (ps_static_cfg_prms->s_out_strm_prms.i4_vui_enable < 0)) |
642 | 0 | { |
643 | 0 | error_code = IHEVCE_VUI_ENABLE_OUT_OF_RANGE; |
644 | 0 | ps_sys_api->ihevce_printf( |
645 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_vui_enable should be set to 1 or 0 \n"); |
646 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
647 | 0 | } |
648 | | |
649 | 8.87k | #ifndef DISABLE_SEI |
650 | 8.87k | if((ps_static_cfg_prms->s_out_strm_prms.i4_sei_enable_flag > 1) || |
651 | 8.87k | (ps_static_cfg_prms->s_out_strm_prms.i4_sei_enable_flag < 0)) |
652 | 0 | { |
653 | 0 | error_code = IHEVCE_SEI_ENABLE_OUT_OF_RANGE; |
654 | 0 | ps_sys_api->ihevce_printf( |
655 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_sei_enable_flags should be set to 1 or 0 \n"); |
656 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
657 | 0 | } |
658 | | |
659 | 8.87k | if((ps_static_cfg_prms->s_out_strm_prms.i4_sei_payload_enable_flag > 1) || |
660 | 8.87k | (ps_static_cfg_prms->s_out_strm_prms.i4_sei_payload_enable_flag < 0)) |
661 | 0 | { |
662 | 0 | error_code = IHEVCE_SEI_PAYLOAD_ENABLE_OUT_OF_RANGE; |
663 | 0 | ps_sys_api->ihevce_printf( |
664 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_sei_payload_enable_flag should be set to 1 or 0 \n"); |
665 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
666 | 0 | } |
667 | 8.87k | #endif |
668 | 8.87k | if((ps_static_cfg_prms->s_multi_thrd_prms.i4_max_num_cores > MAX_NUM_CORES) || |
669 | 8.87k | (ps_static_cfg_prms->s_multi_thrd_prms.i4_max_num_cores < 1)) |
670 | 0 | { |
671 | 0 | error_code = IHEVCE_INVALID_CORE_CONFIG; |
672 | 0 | ps_sys_api->ihevce_printf( |
673 | 0 | pv_cb_handle, "IHEVCE ERROR: Invalid Number of Cores configured\n"); |
674 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
675 | 0 | } |
676 | | |
677 | 8.87k | if((ps_static_cfg_prms->e_arch_type != ARCH_NA) && |
678 | 8.87k | (ps_static_cfg_prms->e_arch_type != ARCH_ARM_NONEON)) |
679 | 0 | { |
680 | 0 | error_code = IHEVCE_ARCHITECTURE_TYPE_UNSUPPORTED; |
681 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: unsupported archType \n"); |
682 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
683 | 0 | } |
684 | | |
685 | 8.87k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_vqet != 0) |
686 | 0 | { |
687 | 0 | error_code = IHEVCE_VISUAL_QUALITY_ENHANCEMENTS_TOGGLER_VALUE_UNSUPPORTED; |
688 | 0 | ps_sys_api->ihevce_printf( |
689 | 0 | pv_cb_handle, |
690 | 0 | "IHEVCE ERROR: visual_quality_enhancements_toggler should be set to 0 \n"); |
691 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
692 | 0 | } |
693 | | |
694 | 8.87k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers < 0 || |
695 | 8.87k | ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers > 3) |
696 | 0 | { |
697 | 0 | error_code = IHEVCE_TEMPORAL_LAYERS_NOT_SUPPORTED; |
698 | 0 | ps_sys_api->ihevce_printf( |
699 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_max_temporal_layers out of range \n"); |
700 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
701 | 0 | } |
702 | | |
703 | 8.87k | if((ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period < 0) || |
704 | 8.87k | (ps_static_cfg_prms->s_coding_tools_prms.i4_max_cra_open_gop_period < 0) || |
705 | 8.87k | (ps_static_cfg_prms->s_coding_tools_prms.i4_max_i_open_gop_period < 0)) |
706 | 0 | { |
707 | 0 | error_code = IHEVCE_INVALID_GOP_PERIOD; |
708 | 0 | ps_sys_api->ihevce_printf( |
709 | 0 | pv_cb_handle, |
710 | 0 | "IHEVCE ERROR: gop period is not valid for the configured temporal layers\n"); |
711 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
712 | 0 | } |
713 | | |
714 | 8.87k | { |
715 | 8.87k | WORD32 i4_max_idr_period, i4_min_idr_period, i4_max_cra_period, i4_max_i_period; |
716 | 8.87k | WORD32 i4_max_i_distance; |
717 | 8.87k | WORD32 i4_min_i_distance = 0, i4_non_zero_idr_period = 0x7FFFFFFF, |
718 | 8.87k | i4_non_zero_cra_period = 0x7FFFFFFF, i4_non_zero_i_period = 0x7FFFFFFF; |
719 | 8.87k | i4_max_idr_period = ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period; |
720 | 8.87k | i4_min_idr_period = ps_static_cfg_prms->s_coding_tools_prms.i4_min_closed_gop_period; |
721 | 8.87k | i4_max_cra_period = ps_static_cfg_prms->s_coding_tools_prms.i4_max_cra_open_gop_period; |
722 | 8.87k | i4_max_i_period = ps_static_cfg_prms->s_coding_tools_prms.i4_max_i_open_gop_period; |
723 | 8.87k | i4_max_i_distance = MAX(MAX(i4_max_idr_period, i4_max_cra_period), i4_max_i_period); |
724 | 8.87k | WORD32 num_b_frms = |
725 | 8.87k | (1 << ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers) - 1; |
726 | 8.87k | if (i4_max_i_distance <= num_b_frms) |
727 | 1.35k | ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers = 0; |
728 | 8.87k | WORD32 sub_gop_size = (1 << ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers) |
729 | 8.87k | << ps_static_cfg_prms->s_src_prms.i4_field_pic; |
730 | | |
731 | 8.87k | if(sub_gop_size > 1) |
732 | 1.75k | { |
733 | 1.75k | switch(sub_gop_size) |
734 | 1.75k | { |
735 | 0 | case 2: |
736 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period = |
737 | 0 | ALIGN2(i4_max_idr_period); |
738 | |
|
739 | 0 | if(i4_max_idr_period > 1) |
740 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period = |
741 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period + 1; |
742 | |
|
743 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_cra_open_gop_period = |
744 | 0 | ALIGN2(i4_max_cra_period); |
745 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_i_open_gop_period = |
746 | 0 | ALIGN2(i4_max_i_period); |
747 | 0 | break; |
748 | 1.75k | case 4: |
749 | 1.75k | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period = |
750 | 1.75k | ALIGN4(i4_max_idr_period); |
751 | | |
752 | 1.75k | if(i4_max_idr_period > 1) |
753 | 1.63k | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period = |
754 | 1.63k | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period + 1; |
755 | | |
756 | 1.75k | ps_static_cfg_prms->s_coding_tools_prms.i4_max_cra_open_gop_period = |
757 | 1.75k | ALIGN4(i4_max_cra_period); |
758 | 1.75k | ps_static_cfg_prms->s_coding_tools_prms.i4_max_i_open_gop_period = |
759 | 1.75k | ALIGN4(i4_max_i_period); |
760 | 1.75k | break; |
761 | 0 | case 8: |
762 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period = |
763 | 0 | ALIGN8(i4_max_idr_period); |
764 | |
|
765 | 0 | if(i4_max_idr_period > 1) |
766 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period = |
767 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period + 1; |
768 | |
|
769 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_cra_open_gop_period = |
770 | 0 | ALIGN8(i4_max_cra_period); |
771 | 0 | ps_static_cfg_prms->s_coding_tools_prms.i4_max_i_open_gop_period = |
772 | 0 | ALIGN8(i4_max_i_period); |
773 | 0 | break; |
774 | 1.75k | } |
775 | 1.75k | } |
776 | | |
777 | 8.87k | if(0 != i4_max_idr_period) |
778 | 6.44k | { |
779 | 6.44k | i4_non_zero_idr_period = i4_max_idr_period; |
780 | 6.44k | } |
781 | 8.87k | if(0 != i4_max_cra_period) |
782 | 5.12k | { |
783 | 5.12k | i4_non_zero_cra_period = i4_max_cra_period; |
784 | 5.12k | } |
785 | 8.87k | if(0 != i4_max_i_period) |
786 | 5.30k | { |
787 | 5.30k | i4_non_zero_i_period = i4_max_i_period; |
788 | 5.30k | } |
789 | 8.87k | i4_min_i_distance = |
790 | 8.87k | MIN(MIN(i4_non_zero_idr_period, i4_non_zero_cra_period), i4_non_zero_i_period); |
791 | 8.87k | if(i4_min_i_distance < sub_gop_size && i4_min_i_distance) |
792 | 1 | { |
793 | 1 | error_code = IHEVCE_INVALID_GOP_PERIOD; |
794 | 1 | ps_sys_api->ihevce_printf( |
795 | 1 | pv_cb_handle, |
796 | 1 | "IHEVCE ERROR: gop period is not valid for the configured temporal layers\n"); |
797 | 1 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
798 | 1 | } |
799 | | |
800 | 8.86k | if((i4_min_idr_period > i4_max_idr_period) || (i4_min_idr_period < 0)) |
801 | 1 | { |
802 | 1 | error_code = IHEVCE_INVALID_GOP_PERIOD; |
803 | 1 | ps_sys_api->ihevce_printf( |
804 | 1 | pv_cb_handle, |
805 | 1 | "IHEVCE ERROR: gop period is not valid => min closed gop > max closed gop\n"); |
806 | 1 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
807 | 1 | } |
808 | 8.86k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers && i4_max_i_distance == 1) |
809 | 0 | { |
810 | 0 | error_code = IHEVCE_TEMPORAL_LAYERS_NOT_SUPPORTED; |
811 | 0 | ps_sys_api->ihevce_printf( |
812 | 0 | pv_cb_handle, "IHEVCE ERROR: Invalid max temporal layer for I only encoding\n"); |
813 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
814 | 0 | } |
815 | 8.86k | if((i4_max_idr_period < i4_max_cra_period || i4_max_idr_period < i4_max_i_period) && |
816 | 8.86k | i4_max_idr_period) |
817 | 1 | { |
818 | 1 | error_code = IHEVCE_INVALID_GOP_PERIOD; |
819 | 1 | ps_sys_api->ihevce_printf( |
820 | 1 | pv_cb_handle, |
821 | 1 | "IHEVCE ERROR: MAX IDR period can't be less than Max CRA or I period\n"); |
822 | 1 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
823 | 1 | } |
824 | 8.86k | if((i4_max_cra_period < i4_max_i_period) && i4_max_cra_period) |
825 | 1 | { |
826 | 1 | error_code = IHEVCE_INVALID_GOP_PERIOD; |
827 | 1 | ps_sys_api->ihevce_printf( |
828 | 1 | pv_cb_handle, "IHEVCE ERROR: MAX CRA period can't be less than Max I period\n"); |
829 | 1 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
830 | 1 | } |
831 | 8.86k | } |
832 | 8.86k | if(0 != ps_static_cfg_prms->s_tgt_lyr_prms.i4_enable_temporal_scalability) |
833 | 0 | { |
834 | 0 | error_code = IHEVCE_INVALID_TEMPORAL_SCALABILITY; |
835 | 0 | ps_sys_api->ihevce_printf( |
836 | 0 | pv_cb_handle, "IHEVCE ERROR: Temporal scalability is not supported \n"); |
837 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
838 | 0 | } |
839 | | |
840 | 8.86k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_max_reference_frames != -1) |
841 | 0 | { |
842 | 0 | error_code = IHEVCE_REF_FRAMES_NOT_SUPPORTED; |
843 | 0 | ps_sys_api->ihevce_printf( |
844 | 0 | pv_cb_handle, "IHEVCE ERROR: only supported value for i4_max_reference_frames is -1\n"); |
845 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
846 | 0 | } |
847 | | |
848 | 8.86k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_weighted_pred_enable != 0 && |
849 | 8.86k | ps_static_cfg_prms->s_coding_tools_prms.i4_weighted_pred_enable != 1) |
850 | 0 | { |
851 | 0 | error_code = IHEVCE_INVALID_WEIGHTED_PREDICTION_INPUT; |
852 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_weighted_pred_enable invalid \n"); |
853 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
854 | 0 | } |
855 | | |
856 | 8.86k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_deblocking_type != 0 && |
857 | 8.86k | ps_static_cfg_prms->s_coding_tools_prms.i4_deblocking_type != 1 && |
858 | 8.86k | ps_static_cfg_prms->s_coding_tools_prms.i4_deblocking_type != 2) |
859 | 0 | { |
860 | 0 | error_code = IHEVCE_INVALID_DEBLOCKING_TYPE_INPUT; |
861 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_deblocking_type invalid\n"); |
862 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
863 | 0 | } |
864 | | |
865 | 8.86k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_use_default_sc_mtx != 0 && |
866 | 8.86k | ps_static_cfg_prms->s_coding_tools_prms.i4_use_default_sc_mtx != 1) |
867 | 0 | { |
868 | 0 | error_code = IHEVCE_INVALID_DEFAULT_SC_MATRIX_ENABLE_INPUT; |
869 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_use_default_sc_mtx invalid \n"); |
870 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
871 | 0 | } |
872 | | |
873 | 8.86k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_cropping_mode != 0 && |
874 | 8.86k | ps_static_cfg_prms->s_coding_tools_prms.i4_cropping_mode != 1) |
875 | 0 | { |
876 | 0 | error_code = IHEVCE_INVALID_CROPPING_MODE; |
877 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_cropping_mode invalid \n"); |
878 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
879 | 0 | } |
880 | | |
881 | | /* Error checks for Static Config Parameters */ |
882 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_min_log2_cu_size != 3) |
883 | 0 | { |
884 | 0 | error_code = IHEVCE_MIN_CU_SIZE_INPUT_NOT_SUPPORTED; |
885 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_min_log2_cu_size invalid \n"); |
886 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
887 | 0 | } |
888 | | |
889 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_min_log2_tu_size != 2) |
890 | 0 | { |
891 | 0 | error_code = IHEVCE_MIN_TU_SIZE_INPUT_NOT_SUPPORTED; |
892 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_min_log2_tu_size invalid \n"); |
893 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
894 | 0 | } |
895 | | |
896 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_max_log2_cu_size < 4 || |
897 | 8.86k | ps_static_cfg_prms->s_config_prms.i4_max_log2_cu_size > 6) |
898 | 0 | { |
899 | 0 | error_code = IHEVCE_MAX_CU_SIZE_INPUT_NOT_SUPPORTED; |
900 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_max_log2_cu_size invalid \n"); |
901 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
902 | 0 | } |
903 | | |
904 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_max_log2_tu_size < 2 || |
905 | 8.86k | ps_static_cfg_prms->s_config_prms.i4_max_log2_tu_size > 5) |
906 | 0 | { |
907 | 0 | error_code = IHEVCE_MAX_TU_SIZE_INPUT_NOT_SUPPORTED; |
908 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_max_log2_tu_size invalid \n"); |
909 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
910 | 0 | } |
911 | | |
912 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_min_log2_cu_size == 4 && |
913 | 8.86k | ps_static_cfg_prms->s_config_prms.i4_max_log2_tu_size == 5) |
914 | 0 | { |
915 | | /* Because tu size should always be lesser than the cu size */ |
916 | 0 | error_code = IHEVCE_INVALID_MAX_TU_SIZE; |
917 | 0 | ps_sys_api->ihevce_printf( |
918 | 0 | pv_cb_handle, |
919 | 0 | "IHEVCE ERROR: Invalid combination of i4_min_log2_cu_size and i4_max_log2_tu_size\n"); |
920 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
921 | 0 | } |
922 | | |
923 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_max_tr_tree_depth_I < 1 || |
924 | 8.86k | ps_static_cfg_prms->s_config_prms.i4_max_tr_tree_depth_I > 3) |
925 | 0 | { |
926 | 0 | error_code = IHEVCE_INVALID_TR_TREE_DEPTH_FOR_I_FRAME; |
927 | 0 | ps_sys_api->ihevce_printf( |
928 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_max_tr_tree_depth_I out of range\n"); |
929 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
930 | 0 | } |
931 | | |
932 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_max_tr_tree_depth_nI < 1 || |
933 | 8.86k | ps_static_cfg_prms->s_config_prms.i4_max_tr_tree_depth_nI > 4) |
934 | 0 | { |
935 | 0 | error_code = IHEVCE_INVALID_TR_TREE_DEPTH; |
936 | 0 | ps_sys_api->ihevce_printf( |
937 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_max_tr_tree_depth_nI out of range\n"); |
938 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
939 | 0 | } |
940 | | |
941 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_max_search_range_horz < 64 || |
942 | 8.86k | ps_static_cfg_prms->s_config_prms.i4_max_search_range_horz > 512) |
943 | 0 | { |
944 | 0 | error_code = IHEVCE_UNSUPPORTED_HORIZONTAL_SEARCH_RANGE; |
945 | 0 | ps_sys_api->ihevce_printf( |
946 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_max_search_range_horz out of range\n"); |
947 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
948 | 0 | } |
949 | | |
950 | 8.86k | if(ps_static_cfg_prms->s_config_prms.i4_max_search_range_vert < 32 || |
951 | 8.86k | ps_static_cfg_prms->s_config_prms.i4_max_search_range_vert > 256) |
952 | 0 | { |
953 | 0 | error_code = IHEVCE_UNSUPPORTED_VERTICAL_SEARCH_RANGE; |
954 | 0 | ps_sys_api->ihevce_printf( |
955 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_max_search_range_vert out of range\n"); |
956 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
957 | 0 | } |
958 | | |
959 | 8.86k | if(ps_static_cfg_prms->s_lap_prms.i4_rc_look_ahead_pics > NUM_LAP2_LOOK_AHEAD || |
960 | 8.86k | ps_static_cfg_prms->s_lap_prms.i4_rc_look_ahead_pics < 0) |
961 | 0 | { |
962 | 0 | error_code = IHEVCE_UNSUPPORTED_LOOK_AHEAD; |
963 | 0 | ps_sys_api->ihevce_printf( |
964 | 0 | pv_cb_handle, |
965 | 0 | "IHEVCE ERROR: rc look ahead pc must be in range of 0 to NUM_LAP2_LOOK_AHEAD\n"); |
966 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
967 | 0 | } |
968 | | |
969 | | /* Num res instances should be less than equal to IHEVCE_MAX_NUM_RESOLUTIONS */ |
970 | 8.86k | if((i4_num_resolutions < 1) || (i4_num_resolutions > IHEVCE_MAX_NUM_RESOLUTIONS)) |
971 | 0 | { |
972 | 0 | error_code = IHEVCE_NUM_MAX_RESOLUTIONS_NOT_SUPPORTED; |
973 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: invalid i4_num_resolutions \n"); |
974 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
975 | 0 | } |
976 | | |
977 | 8.86k | if((ps_static_cfg_prms->i4_res_id < 0) || (ps_static_cfg_prms->i4_res_id >= i4_num_resolutions)) |
978 | 0 | { |
979 | 0 | error_code = IHEVCE_NUM_MAX_RESOLUTIONS_NOT_SUPPORTED; |
980 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: invalid i4_num_resolutions \n"); |
981 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
982 | 0 | } |
983 | | |
984 | 8.86k | if((ps_static_cfg_prms->s_tgt_lyr_prms.i4_mres_single_out < 0) || |
985 | 8.86k | (ps_static_cfg_prms->s_tgt_lyr_prms.i4_mres_single_out > 1)) |
986 | 0 | { |
987 | 0 | error_code = IHEVCE_INVALID_MRES_SINGLE_OUT; |
988 | 0 | ps_sys_api->ihevce_printf( |
989 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid i4_mres_single_out value \n"); |
990 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
991 | 0 | } |
992 | | |
993 | 8.86k | if((ps_static_cfg_prms->i4_save_recon) && |
994 | 8.86k | (1 == ps_static_cfg_prms->s_tgt_lyr_prms.i4_mres_single_out)) |
995 | 0 | { |
996 | 0 | ps_sys_api->ihevce_printf( |
997 | 0 | pv_cb_handle, |
998 | 0 | "IHEVCE WARNING: i4_save_recon not supported for mres single out case \n"); |
999 | 0 | ps_static_cfg_prms->i4_save_recon = 0; |
1000 | 0 | } |
1001 | | |
1002 | 8.86k | if((1 == i4_num_resolutions) && (1 == ps_static_cfg_prms->s_tgt_lyr_prms.i4_mres_single_out)) |
1003 | 0 | { |
1004 | 0 | ps_sys_api->ihevce_printf( |
1005 | 0 | pv_cb_handle, |
1006 | 0 | "IHEVCE WARNING: i4_mres_single_out value changed to 0 for single resolution case \n"); |
1007 | 0 | ps_static_cfg_prms->s_tgt_lyr_prms.i4_mres_single_out = 0; |
1008 | 0 | } |
1009 | | |
1010 | 8.86k | if(ps_static_cfg_prms->s_tgt_lyr_prms.i4_mbr_quality_setting < 0 || |
1011 | 8.86k | ps_static_cfg_prms->s_tgt_lyr_prms.i4_mbr_quality_setting > 3) |
1012 | 0 | { |
1013 | 0 | error_code = IHEVCE_INVALID_MBR_QUALITY_SETTING; |
1014 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: invalid mbr quality setting\n"); |
1015 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1016 | 0 | } |
1017 | | |
1018 | 8.86k | if(ps_static_cfg_prms->s_tgt_lyr_prms.i4_multi_res_layer_reuse != 0) |
1019 | 0 | { |
1020 | 0 | error_code = IHEVCE_MULTI_RES_LAYER_REUSE_NOT_SUPPORTED; |
1021 | 0 | ps_sys_api->ihevce_printf( |
1022 | 0 | pv_cb_handle, |
1023 | 0 | "IHEVCE ERROR: reuse of info across resolution is not currently supported \n"); |
1024 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1025 | 0 | } |
1026 | | |
1027 | 17.7k | for(i4_resolution_id = 0; i4_resolution_id < i4_num_resolutions; i4_resolution_id++) |
1028 | 8.86k | { |
1029 | 8.86k | WORD32 codec_level_index, quality_preset, height, width, frm_rate_scale_factor; |
1030 | 8.86k | WORD32 br_ctr; |
1031 | 8.86k | UWORD32 u4_luma_sample_rate; |
1032 | 8.86k | WORD32 max_dpb_size; |
1033 | 8.86k | WORD32 i4_field_pic = ps_static_cfg_prms->s_src_prms.i4_field_pic; |
1034 | | |
1035 | 8.86k | codec_level_index = ihevce_get_level_index( |
1036 | 8.86k | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id].i4_codec_level); |
1037 | 8.86k | quality_preset = |
1038 | 8.86k | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id].i4_quality_preset; |
1039 | 8.86k | height = ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id].i4_height; |
1040 | 8.86k | width = ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id].i4_width; |
1041 | 8.86k | frm_rate_scale_factor = ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id] |
1042 | 8.86k | .i4_frm_rate_scale_factor; |
1043 | | /* Check error for max picture size(luma) for the given level */ |
1044 | 8.86k | if((width * height) > g_as_level_data[codec_level_index].i4_max_luma_picture_size) |
1045 | 0 | { |
1046 | 0 | error_code = IHEVCE_PIC_SIZE_NOT_SUPPORTED; |
1047 | 0 | ps_sys_api->ihevce_printf( |
1048 | 0 | pv_cb_handle, |
1049 | 0 | "IHEVCE ERROR: (i4_tgt_width * i4_tgt_height) out of range for resolution number " |
1050 | 0 | "'%d' codec level %d " |
1051 | 0 | "\n", |
1052 | 0 | i4_resolution_id, |
1053 | 0 | codec_level_index); |
1054 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1055 | 0 | } |
1056 | | |
1057 | 8.86k | if((width * height) <= (g_as_level_data[codec_level_index].i4_max_luma_picture_size >> 2)) |
1058 | 8.86k | { |
1059 | 8.86k | max_dpb_size = 16; |
1060 | 8.86k | } |
1061 | 0 | else if((width * height) <= (g_as_level_data[codec_level_index].i4_max_luma_picture_size >> 1)) |
1062 | 0 | { |
1063 | 0 | max_dpb_size = 12; |
1064 | 0 | } |
1065 | 0 | else if( |
1066 | 0 | (width * height) <= |
1067 | 0 | (3 * g_as_level_data[codec_level_index].i4_max_luma_picture_size >> 2)) |
1068 | 0 | { |
1069 | 0 | max_dpb_size = 8; |
1070 | 0 | } |
1071 | 0 | else |
1072 | 0 | { |
1073 | 0 | max_dpb_size = 6; |
1074 | 0 | } |
1075 | | |
1076 | | /* DPB check */ |
1077 | 8.86k | if((((DEFAULT_MAX_REFERENCE_PICS - i4_field_pic) /*max reference*/ + 2) << i4_field_pic) > |
1078 | 8.86k | max_dpb_size) |
1079 | 0 | { |
1080 | 0 | error_code = IHEVCE_CODEC_LEVEL_NOT_SUPPORTED; |
1081 | 0 | ps_sys_api->ihevce_printf( |
1082 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_codec_level should be set correct \n"); |
1083 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1084 | 0 | } |
1085 | | |
1086 | 8.86k | if((quality_preset > IHEVCE_QUALITY_P7) || (quality_preset < 0) || (quality_preset == 1)) |
1087 | 0 | { |
1088 | 0 | error_code = IHEVCE_INVALID_QUALITY_PRESET_INPUT; |
1089 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_quality_preset invalid \n"); |
1090 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1091 | 0 | } |
1092 | | |
1093 | | /* Error checks for target width and height */ |
1094 | 8.86k | if((height > HEVCE_MAX_HEIGHT) || (height < HEVCE_MIN_HEIGHT) || |
1095 | 8.86k | (height != ps_static_cfg_prms->s_src_prms.i4_height)) |
1096 | 0 | { |
1097 | 0 | error_code = IHEVCE_TGT_HEIGHT_NOT_SUPPORTED; |
1098 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: Target height not supported\n"); |
1099 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1100 | 0 | } |
1101 | | |
1102 | 8.86k | if((width > HEVCE_MAX_WIDTH) || (width < HEVCE_MIN_WIDTH) || |
1103 | 8.86k | (width != ps_static_cfg_prms->s_src_prms.i4_width)) |
1104 | 0 | { |
1105 | 0 | error_code = IHEVCE_TGT_WIDTH_NOT_SUPPORTED; |
1106 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: Target width not supported\n"); |
1107 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1108 | 0 | } |
1109 | | |
1110 | | /* Error checks for the codec level */ |
1111 | 8.86k | if(ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id].i4_codec_level > |
1112 | 8.86k | LEVEL6) |
1113 | 0 | { |
1114 | 0 | error_code = IHEVCE_CODEC_LEVEL_NOT_SUPPORTED; |
1115 | 0 | ps_sys_api->ihevce_printf( |
1116 | 0 | pv_cb_handle, |
1117 | 0 | "IHEVCE ERROR: i4_codec_level should be set to a max value of 153 \n"); |
1118 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1119 | 0 | } |
1120 | | |
1121 | 8.86k | if(frm_rate_scale_factor != 1) |
1122 | 0 | { |
1123 | 0 | error_code = IHEVCE_TGT_FRAME_RATE_SCALING_NOT_SUPPORTED; |
1124 | 0 | ps_sys_api->ihevce_printf( |
1125 | 0 | pv_cb_handle, "IHEVCE ERROR: Target frame rate scaler should be 1 \n"); |
1126 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1127 | 0 | } |
1128 | | |
1129 | 8.86k | u4_luma_sample_rate = (UWORD32)(width * height); |
1130 | 8.86k | u4_luma_sample_rate *= (UWORD32)( |
1131 | 8.86k | ps_static_cfg_prms->s_src_prms.i4_frm_rate_num / |
1132 | 8.86k | (ps_static_cfg_prms->s_src_prms.i4_frm_rate_denom * frm_rate_scale_factor)); |
1133 | | /* Check error for max samples rate (frame rate * luma picture size) for the given level */ |
1134 | 8.86k | if(u4_luma_sample_rate > g_as_level_data[codec_level_index].u4_max_luma_sample_rate) |
1135 | 0 | { |
1136 | 0 | error_code = IHEVCE_LUMA_SAMPLE_RATE_NOT_SUPPORTED; |
1137 | 0 | ps_sys_api->ihevce_printf( |
1138 | 0 | pv_cb_handle, |
1139 | 0 | "IHEVCE ERROR: input sample rate (i4_src_width * i4_src_height * i4_frm_rate_num / " |
1140 | 0 | "i4_frm_rate_denom ) " |
1141 | 0 | "exceeds u4_max_luma_sample_rate\n"); |
1142 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1143 | 0 | } |
1144 | | |
1145 | | /* Num instances should be less than equal to IHEVCE_MAX_NUM_BITRATES */ |
1146 | 8.86k | if((ai4_num_bitrate_instances[i4_resolution_id] < 1) || |
1147 | 8.86k | (ai4_num_bitrate_instances[i4_resolution_id] > IHEVCE_MAX_NUM_BITRATES)) |
1148 | 0 | { |
1149 | 0 | error_code = IHEVCE_INVALID_NUM_BR_INSTANCES; |
1150 | 0 | ps_sys_api->ihevce_printf( |
1151 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid i4_num_bitrate_instances \n"); |
1152 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1153 | 0 | } |
1154 | | |
1155 | | /* check for codec tier */ |
1156 | 8.86k | if((ps_static_cfg_prms->s_out_strm_prms.i4_codec_tier > HIGH_TIER) || |
1157 | 8.86k | (ps_static_cfg_prms->s_out_strm_prms.i4_codec_tier < MAIN_TIER)) |
1158 | 0 | { |
1159 | 0 | error_code = IHEVC_CODEC_TIER_NOT_SUPPORTED; |
1160 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: Codec tier out of range\n"); |
1161 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1162 | 0 | } |
1163 | | |
1164 | 8.86k | if((ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id].i4_codec_level < |
1165 | 8.86k | 120) && |
1166 | 8.86k | (ps_static_cfg_prms->s_out_strm_prms.i4_codec_tier == HIGH_TIER)) |
1167 | 0 | { |
1168 | 0 | error_code = IHEVC_CODEC_TIER_NOT_SUPPORTED; |
1169 | 0 | ps_sys_api->ihevce_printf( |
1170 | 0 | pv_cb_handle, "IHEVCE ERROR: Codec tier = HIGH TIER Not supported below Level 4\n"); |
1171 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1172 | 0 | } |
1173 | | |
1174 | | /* Check error for max bitrate for the given level */ |
1175 | 17.7k | for(br_ctr = 0; br_ctr < ai4_num_bitrate_instances[i4_resolution_id]; br_ctr++) |
1176 | 8.86k | { |
1177 | 8.86k | WORD32 frame_qp = ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id] |
1178 | 8.86k | .ai4_frame_qp[br_ctr]; |
1179 | 8.86k | WORD32 tgt_bitrate = ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id] |
1180 | 8.86k | .ai4_tgt_bitrate[br_ctr]; |
1181 | 8.86k | WORD32 i4_max_bit_rate = |
1182 | 8.86k | g_as_level_data[codec_level_index] |
1183 | 8.86k | .i4_max_bit_rate[ps_static_cfg_prms->s_out_strm_prms.i4_codec_tier]; |
1184 | 8.86k | WORD32 peak_bitrate; |
1185 | | |
1186 | 8.86k | if(frame_qp > MAX_HEVC_QP || frame_qp < MIN_HEVC_QP) |
1187 | 0 | { |
1188 | 0 | error_code = IHEVCE_UNSUPPORTED_FRAME_QP; |
1189 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_frame_qp out of range\n"); |
1190 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1191 | 0 | } |
1192 | | |
1193 | 8.86k | if(tgt_bitrate > i4_max_bit_rate * CBP_VCL_FACTOR || tgt_bitrate < MIN_BITRATE) |
1194 | 10 | { |
1195 | 10 | error_code = IHEVCE_BITRATE_NOT_SUPPORTED; |
1196 | 10 | ps_sys_api->ihevce_printf( |
1197 | 10 | pv_cb_handle, |
1198 | 10 | "IHEVCE ERROR: i4_tgt_bitrate %d out of range for resolution %dX%d " |
1199 | 10 | "bitrate should be within [%d .. %d]\n", |
1200 | 10 | tgt_bitrate, |
1201 | 10 | width, height, |
1202 | 10 | MIN_BITRATE, i4_max_bit_rate * CBP_VCL_FACTOR); |
1203 | 10 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1204 | 10 | } |
1205 | | |
1206 | 8.85k | peak_bitrate = tgt_bitrate << 1; |
1207 | 8.85k | peak_bitrate = MIN(peak_bitrate, i4_max_bit_rate * 1000); |
1208 | 8.85k | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id] |
1209 | 8.85k | .ai4_peak_bitrate[br_ctr] = peak_bitrate; |
1210 | 8.85k | ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id] |
1211 | 8.85k | .ai4_max_vbv_buffer_size[br_ctr] = peak_bitrate; |
1212 | 8.85k | } |
1213 | 8.86k | } |
1214 | | |
1215 | 8.85k | if((ps_static_cfg_prms->i4_br_id < 0) || |
1216 | 8.85k | (ps_static_cfg_prms->i4_br_id >= ai4_num_bitrate_instances[ps_static_cfg_prms->i4_res_id])) |
1217 | 0 | { |
1218 | 0 | error_code = IHEVCE_INVALID_NUM_BR_INSTANCES; |
1219 | 0 | ps_sys_api->ihevce_printf( |
1220 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid i4_num_bitrate_instances \n"); |
1221 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1222 | 0 | } |
1223 | | |
1224 | | /* Check error for rate control mode for the given level */ |
1225 | 8.85k | if(ps_static_cfg_prms->s_config_prms.i4_rate_control_mode != 2 && |
1226 | 8.85k | ps_static_cfg_prms->s_config_prms.i4_rate_control_mode != 3 && |
1227 | 8.85k | ps_static_cfg_prms->s_config_prms.i4_rate_control_mode != 5) |
1228 | 0 | { |
1229 | 0 | error_code = IHEVCE_RATE_CONTROL_MDOE_NOT_SUPPORTED; |
1230 | 0 | ps_sys_api->ihevce_printf( |
1231 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_rate_control_mode out of range\n"); |
1232 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1233 | 0 | } |
1234 | | |
1235 | | /* Check error for pass number */ |
1236 | 8.85k | if(ps_static_cfg_prms->s_pass_prms.i4_pass != 0) |
1237 | 0 | { |
1238 | 0 | error_code = IHEVCE_RATE_CONTROL_PASS_INVALID; |
1239 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_pass out of range\n"); |
1240 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1241 | 0 | } |
1242 | | |
1243 | | /* Check error for cu level qp modultion for the given level */ |
1244 | 8.85k | if(ps_static_cfg_prms->s_config_prms.i4_cu_level_rc != 0 && |
1245 | 8.85k | ps_static_cfg_prms->s_config_prms.i4_cu_level_rc != 1) |
1246 | 0 | { |
1247 | 0 | error_code = IHEVCE_RATE_CONTROL_MDOE_NOT_SUPPORTED; |
1248 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: i4_cu_level_rc out of range\n"); |
1249 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1250 | 0 | } |
1251 | | |
1252 | | /* size error checks for the api structures */ |
1253 | 8.85k | if(ps_static_cfg_prms->i4_size != sizeof(ihevce_static_cfg_params_t)) |
1254 | 0 | { |
1255 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1256 | 0 | ps_sys_api->ihevce_printf( |
1257 | 0 | pv_cb_handle, |
1258 | 0 | "IHEVCE ERROR: Size element of ihevce_static_cfg_params_t is not matching with actual " |
1259 | 0 | "size"); |
1260 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1261 | 0 | } |
1262 | 8.85k | if(ps_static_cfg_prms->s_src_prms.i4_size != sizeof(ihevce_src_params_t)) |
1263 | 0 | { |
1264 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1265 | 0 | ps_sys_api->ihevce_printf( |
1266 | 0 | pv_cb_handle, |
1267 | 0 | "IHEVCE ERROR: Size element of ihevce_src_params_t is not matching with actual size"); |
1268 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1269 | 0 | } |
1270 | 8.85k | if(ps_static_cfg_prms->s_tgt_lyr_prms.i4_size != sizeof(ihevce_tgt_layer_params_t)) |
1271 | 0 | { |
1272 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1273 | 0 | ps_sys_api->ihevce_printf( |
1274 | 0 | pv_cb_handle, |
1275 | 0 | "IHEVCE ERROR: Size element of ihevce_tgt_layer_params_t is not matching with actual " |
1276 | 0 | "size"); |
1277 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1278 | 0 | } |
1279 | 8.85k | if(ps_static_cfg_prms->s_out_strm_prms.i4_size != sizeof(ihevce_out_strm_params_t)) |
1280 | 0 | { |
1281 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1282 | 0 | ps_sys_api->ihevce_printf( |
1283 | 0 | pv_cb_handle, |
1284 | 0 | "IHEVCE ERROR: Size element of ihevce_out_strm_params_t is not matching with actual " |
1285 | 0 | "size"); |
1286 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1287 | 0 | } |
1288 | 8.85k | if(ps_static_cfg_prms->s_coding_tools_prms.i4_size != sizeof(ihevce_coding_params_t)) |
1289 | 0 | { |
1290 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1291 | 0 | ps_sys_api->ihevce_printf( |
1292 | 0 | pv_cb_handle, |
1293 | 0 | "IHEVCE ERROR: Size element of ihevce_coding_params_t is not matching with actual " |
1294 | 0 | "size"); |
1295 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1296 | 0 | } |
1297 | 8.85k | if(ps_static_cfg_prms->s_config_prms.i4_size != sizeof(ihevce_config_prms_t)) |
1298 | 0 | { |
1299 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1300 | 0 | ps_sys_api->ihevce_printf( |
1301 | 0 | pv_cb_handle, |
1302 | 0 | "IHEVCE ERROR: Size element of ihevce_config_prms_t is not matching with actual size"); |
1303 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1304 | 0 | } |
1305 | 8.85k | if(ps_static_cfg_prms->s_multi_thrd_prms.i4_size != sizeof(ihevce_static_multi_thread_params_t)) |
1306 | 0 | { |
1307 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1308 | 0 | ps_sys_api->ihevce_printf( |
1309 | 0 | pv_cb_handle, |
1310 | 0 | "IHEVCE ERROR: Size element of ihevce_static_multi_thread_params_t is not matching " |
1311 | 0 | "with actual size"); |
1312 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1313 | 0 | } |
1314 | 17.7k | for(i4_resolution_id = 0; i4_resolution_id < i4_num_resolutions; i4_resolution_id++) |
1315 | 8.85k | { |
1316 | 8.85k | if(ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id].i4_size != |
1317 | 8.85k | sizeof(ihevce_tgt_params_t)) |
1318 | 0 | { |
1319 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1320 | 0 | ps_sys_api->ihevce_printf( |
1321 | 0 | pv_cb_handle, |
1322 | 0 | "IHEVCE ERROR: Size element of ihevce_tgt_params_t is not matching with actual " |
1323 | 0 | "size"); |
1324 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1325 | 0 | } |
1326 | 8.85k | } |
1327 | | |
1328 | 8.85k | if(ps_static_cfg_prms->s_lap_prms.i4_size != sizeof(ihevce_lap_params_t)) |
1329 | 0 | { |
1330 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1331 | 0 | ps_sys_api->ihevce_printf( |
1332 | 0 | pv_cb_handle, |
1333 | 0 | "IHEVCE ERROR: Size element of ihevce_lap_params_t is not matching with actual size"); |
1334 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1335 | 0 | } |
1336 | | |
1337 | 17.7k | for(i4_resolution_id = 0; i4_resolution_id < i4_num_resolutions; i4_resolution_id++) |
1338 | 8.85k | { |
1339 | 8.85k | if(ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_resolution_id].i4_size != |
1340 | 8.85k | sizeof(ihevce_tgt_params_t)) |
1341 | 0 | { |
1342 | 0 | error_code = IHEVCE_INVALID_SIZE; |
1343 | 0 | ps_sys_api->ihevce_printf( |
1344 | 0 | pv_cb_handle, |
1345 | 0 | "IHEVCE ERROR: Size element of ihevce_tgt_params_t is not matching with actual " |
1346 | 0 | "size"); |
1347 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1348 | 0 | } |
1349 | 8.85k | } |
1350 | | |
1351 | 8.85k | #ifndef DISABLE_SEI |
1352 | | /* Check SEI related error checks */ |
1353 | 8.85k | if(1 == ps_static_cfg_prms->s_out_strm_prms.i4_sei_enable_flag) |
1354 | 2.69k | { |
1355 | 2.69k | WORD32 i; |
1356 | | /* Check values for i4_sei_hash_flags */ |
1357 | 2.69k | if(!((ps_static_cfg_prms->s_out_strm_prms.i4_decoded_pic_hash_sei_flag == 2) || |
1358 | 2.69k | (ps_static_cfg_prms->s_out_strm_prms.i4_decoded_pic_hash_sei_flag == 3) || |
1359 | 2.69k | (ps_static_cfg_prms->s_out_strm_prms.i4_decoded_pic_hash_sei_flag == 0))) |
1360 | 0 | { |
1361 | 0 | error_code = IHEVCE_SEI_HASH_VALUE_NOT_SUPPORTED; |
1362 | 0 | ps_sys_api->ihevce_printf( |
1363 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_sei_hash_flags out of range\n"); |
1364 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1365 | 0 | } |
1366 | | |
1367 | | /* Content Light Level Info error check */ |
1368 | 2.69k | if((ps_static_cfg_prms->s_out_strm_prms.i4_sei_cll_enable > 1) || |
1369 | 2.69k | (ps_static_cfg_prms->s_out_strm_prms.i4_sei_cll_enable < 0)) |
1370 | 0 | { |
1371 | 0 | error_code = IHEVCE_SEI_CLL_ENABLE_OUT_OF_RANGE; |
1372 | 0 | ps_sys_api->ihevce_printf( |
1373 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_sei_cll_enable out of range\n"); |
1374 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1375 | 0 | } |
1376 | | |
1377 | 2.69k | if((ps_static_cfg_prms->s_out_strm_prms.i4_sei_buffer_period_flags || |
1378 | 2.69k | ps_static_cfg_prms->s_out_strm_prms.i4_sei_pic_timing_flags) && |
1379 | 2.69k | (!ps_static_cfg_prms->s_out_strm_prms.i4_vui_enable)) |
1380 | 0 | { |
1381 | 0 | error_code = IHEVCE_SEI_ENABLED_VUI_DISABLED; |
1382 | 0 | ps_sys_api->ihevce_printf( |
1383 | 0 | pv_cb_handle, |
1384 | 0 | "IHEVCE ERROR: Both SEI and VUI ought to be enabled when either " |
1385 | 0 | "'i4_sei_buffer_period_flags' or " |
1386 | 0 | "'i4_sei_pic_timing_flags' are enabled\n"); |
1387 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1388 | 0 | } |
1389 | | |
1390 | 2.69k | if((1 == ps_static_cfg_prms->s_out_strm_prms.i4_sei_buffer_period_flags) && |
1391 | 2.69k | (3 == ps_static_cfg_prms->s_config_prms.i4_rate_control_mode)) |
1392 | 0 | { |
1393 | 0 | error_code = IHEVCE_SEI_MESSAGES_DEPENDENCY; |
1394 | 0 | ps_sys_api->ihevce_printf( |
1395 | 0 | pv_cb_handle, |
1396 | 0 | "IHEVCE ERROR: i4_sei_buffer_period_flags should be disabled for CQP mode of Rate " |
1397 | 0 | "control \n"); |
1398 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1399 | 0 | } |
1400 | | |
1401 | | /* Check values for i4_sei_mastering_disp_colour_vol_flags */ |
1402 | 2.69k | if((ps_static_cfg_prms->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags != 0) && |
1403 | 2.69k | (ps_static_cfg_prms->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags != 1)) |
1404 | 0 | { |
1405 | 0 | error_code = IHEVCE_MASTERING_DISP_COL_VOL_OUT_OF_RANGE; |
1406 | 0 | ps_sys_api->ihevce_printf( |
1407 | 0 | pv_cb_handle, |
1408 | 0 | "IHEVCE ERROR: i4_sei_mastering_disp_colour_vol_flags out of range\n"); |
1409 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1410 | 0 | } |
1411 | | |
1412 | 2.69k | if(1 == ps_static_cfg_prms->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags) |
1413 | 0 | { |
1414 | | /* Check values for u2_display_primaries_x and u2_display_primaries_y */ |
1415 | 0 | for(i = 0; i < 3; i++) |
1416 | 0 | { |
1417 | 0 | if((ps_static_cfg_prms->s_out_strm_prms.au2_display_primaries_x[i] > 50000)) |
1418 | 0 | { |
1419 | 0 | error_code = IHEVCE_DISPLAY_PRIMARY_X_OUT_OF_RANGE; |
1420 | 0 | ps_sys_api->ihevce_printf( |
1421 | 0 | pv_cb_handle, "IHEVCE ERROR: au2_display_primaries_x out of range\n"); |
1422 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1423 | 0 | } |
1424 | | |
1425 | 0 | if((ps_static_cfg_prms->s_out_strm_prms.au2_display_primaries_y[i] > 50000)) |
1426 | 0 | { |
1427 | 0 | error_code = IHEVCE_DISPLAY_PRIMARY_Y_OUT_OF_RANGE; |
1428 | 0 | ps_sys_api->ihevce_printf( |
1429 | 0 | pv_cb_handle, "IHEVCE ERROR: au2_display_primaries_y out of range\n"); |
1430 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1431 | 0 | } |
1432 | 0 | } |
1433 | | |
1434 | 0 | if((ps_static_cfg_prms->s_out_strm_prms.u2_white_point_x > 50000)) |
1435 | 0 | { |
1436 | 0 | error_code = IHEVCE_WHITE_POINT_X_OUT_OF_RANGE; |
1437 | 0 | ps_sys_api->ihevce_printf( |
1438 | 0 | pv_cb_handle, "IHEVCE ERROR: u2_white_point_x out of range\n"); |
1439 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1440 | 0 | } |
1441 | | |
1442 | 0 | if((ps_static_cfg_prms->s_out_strm_prms.u2_white_point_y > 50000)) |
1443 | 0 | { |
1444 | 0 | error_code = IHEVCE_WHITE_POINT_Y_OUT_OF_RANGE; |
1445 | 0 | ps_sys_api->ihevce_printf( |
1446 | 0 | pv_cb_handle, "IHEVCE ERROR: u2_white_point_y out of range\n"); |
1447 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1448 | 0 | } |
1449 | | |
1450 | 0 | if(ps_static_cfg_prms->s_out_strm_prms.u4_max_display_mastering_luminance <= |
1451 | 0 | ps_static_cfg_prms->s_out_strm_prms.u4_min_display_mastering_luminance) |
1452 | 0 | { |
1453 | 0 | error_code = IHEVCE_MAX_DISP_MATERING_LUM_OUT_OF_RANGE; |
1454 | 0 | ps_sys_api->ihevce_printf( |
1455 | 0 | pv_cb_handle, |
1456 | 0 | "IHEVCE ERROR: u4_max_display_mastering_luminance should be greater then " |
1457 | 0 | "u4_min_display_mastering_luminance \n"); |
1458 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1459 | 0 | } |
1460 | 0 | } |
1461 | 2.69k | } |
1462 | 8.85k | #endif |
1463 | | |
1464 | 8.85k | if(1 == ps_static_cfg_prms->s_out_strm_prms.i4_vui_enable) |
1465 | 2.92k | { |
1466 | | /* validate static vui parameters */ |
1467 | 2.92k | if(((ps_static_cfg_prms->s_vui_sei_prms.u1_aspect_ratio_info_present_flag & 0xFE) > 0)) |
1468 | 0 | { |
1469 | 0 | error_code = IHEVC_INVALID_ASPECT_RATIO_PARAMS; |
1470 | 0 | ps_sys_api->ihevce_printf( |
1471 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid aspect ratio parameters\n"); |
1472 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1473 | 0 | } |
1474 | | |
1475 | 2.92k | if(((ps_static_cfg_prms->s_vui_sei_prms.u1_overscan_info_present_flag & 0xFE) > 0) || |
1476 | 2.92k | ((ps_static_cfg_prms->s_vui_sei_prms.u1_overscan_appropriate_flag & 0xFE) > 0)) |
1477 | 0 | { |
1478 | 0 | error_code = IHEVC_INVALID_OVERSCAN_PARAMS; |
1479 | 0 | ps_sys_api->ihevce_printf(pv_cb_handle, "IHEVCE ERROR: invalid overscan parameters\n"); |
1480 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1481 | 0 | } |
1482 | | |
1483 | 2.92k | if(((ps_static_cfg_prms->s_vui_sei_prms.u1_video_signal_type_present_flag & 0xFE) > 0) || |
1484 | 2.92k | (ps_static_cfg_prms->s_vui_sei_prms.u1_video_format > 5) || |
1485 | 2.92k | ((ps_static_cfg_prms->s_vui_sei_prms.u1_video_full_range_flag & 0xFE) > 0)) |
1486 | 0 | { |
1487 | 0 | error_code = IHEVC_INVALID_VIDEO_PARAMS; |
1488 | 0 | ps_sys_api->ihevce_printf( |
1489 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid video signal type parameters\n"); |
1490 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1491 | 0 | } |
1492 | | |
1493 | 2.92k | if(((ps_static_cfg_prms->s_vui_sei_prms.u1_colour_description_present_flag & 0xFE) > 0)) |
1494 | 0 | { |
1495 | 0 | error_code = IHEVC_INVALID_COLOUR_PARAMS; |
1496 | 0 | ps_sys_api->ihevce_printf( |
1497 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid colour description parameters\n"); |
1498 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1499 | 0 | } |
1500 | | |
1501 | 2.92k | if(((ps_static_cfg_prms->s_vui_sei_prms.u1_chroma_loc_info_present_flag & 0xFE) > 0) || |
1502 | 2.92k | (ps_static_cfg_prms->s_vui_sei_prms.u1_chroma_sample_loc_type_top_field > 5) || |
1503 | 2.92k | (ps_static_cfg_prms->s_vui_sei_prms.u1_chroma_sample_loc_type_bottom_field > 5)) |
1504 | 0 | { |
1505 | 0 | error_code = IHEVC_INVALID_CHROMA_PARAMS; |
1506 | 0 | ps_sys_api->ihevce_printf( |
1507 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid chroma info parameters\n"); |
1508 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1509 | 0 | } |
1510 | | |
1511 | 2.92k | if((ps_static_cfg_prms->s_vui_sei_prms.u1_timing_info_present_flag & 0xFE) > 0) |
1512 | 0 | { |
1513 | 0 | error_code = IHEVC_INVALID_TIMING_INFO_PARAM; |
1514 | 0 | ps_sys_api->ihevce_printf( |
1515 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid timing info present flag\n"); |
1516 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1517 | 0 | } |
1518 | | |
1519 | 2.92k | if(((ps_static_cfg_prms->s_vui_sei_prms.u1_vui_hrd_parameters_present_flag & 0xFE) > 0) || |
1520 | 2.92k | ((ps_static_cfg_prms->s_vui_sei_prms.u1_nal_hrd_parameters_present_flag & 0xFE) > 0)) |
1521 | 0 | { |
1522 | 0 | error_code = IHEVC_INVALID_HRD_PRESENT_PARAMS; |
1523 | 0 | ps_sys_api->ihevce_printf( |
1524 | 0 | pv_cb_handle, "IHEVCE ERROR: invalid vui or vcl hrd parameters present flag\n"); |
1525 | 0 | return (IHEVCE_SETUNSUPPORTEDINPUT(error_code)); |
1526 | 0 | } |
1527 | 2.92k | } |
1528 | | |
1529 | 8.85k | error_code = ihevce_validate_tile_config_params(ps_static_cfg_prms); |
1530 | 8.85k | if(IHEVCE_SUCCESS != error_code) |
1531 | 0 | { |
1532 | 0 | return error_code; |
1533 | 0 | } |
1534 | | |
1535 | 8.85k | if(ps_static_cfg_prms->s_slice_params.i4_slice_segment_mode != 0) |
1536 | 0 | { |
1537 | 0 | error_code = IHEVCE_BAD_SLICE_PARAMS; |
1538 | 0 | ps_sys_api->ihevce_printf( |
1539 | 0 | pv_cb_handle, "IHEVCE ERROR: i4_slice_segment_mode should be 0 \n"); |
1540 | 0 | return IHEVCE_SETUNSUPPORTEDINPUT(error_code); |
1541 | 0 | } |
1542 | | |
1543 | 8.85k | return IHEVCE_SUCCESS; |
1544 | 8.85k | } |
1545 | | |
1546 | | /*! |
1547 | | ****************************************************************************** |
1548 | | * \if Function name : ihevce_get_level_index \endif |
1549 | | * |
1550 | | * \brief |
1551 | | * This function returns the index of level based on codec_level value |
1552 | | * Please see the LEVEL_T enum def |
1553 | | * |
1554 | | * \param[in] Codec Level |
1555 | | * |
1556 | | * \return |
1557 | | * Index of Codec level |
1558 | | * |
1559 | | * \author |
1560 | | * Ittiam |
1561 | | * |
1562 | | ***************************************************************************** |
1563 | | */ |
1564 | | WORD32 ihevce_get_level_index(WORD32 i4_codec_level) |
1565 | 233k | { |
1566 | 233k | switch(i4_codec_level) |
1567 | 233k | { |
1568 | 0 | case LEVEL1: |
1569 | 0 | return 0; |
1570 | 0 | case LEVEL2: |
1571 | 0 | return 1; |
1572 | 0 | case LEVEL2_1: |
1573 | 0 | return 2; |
1574 | 0 | case LEVEL3: |
1575 | 0 | return 3; |
1576 | 0 | case LEVEL3_1: |
1577 | 0 | return 4; |
1578 | 0 | case LEVEL4: |
1579 | 0 | return 5; |
1580 | 0 | case LEVEL4_1: |
1581 | 0 | return 6; |
1582 | 0 | case LEVEL5: |
1583 | 0 | return 7; |
1584 | 0 | case LEVEL5_1: |
1585 | 0 | return 8; |
1586 | 233k | case LEVEL5_2: |
1587 | 233k | return 9; |
1588 | 0 | case LEVEL6: |
1589 | 0 | return 10; |
1590 | 0 | case LEVEL6_1: |
1591 | 0 | return 11; |
1592 | 0 | case LEVEL6_2: |
1593 | 0 | return 12; |
1594 | 0 | default: |
1595 | 0 | return 0; |
1596 | 233k | } |
1597 | 233k | } |