Line data Source code
1 : /******************************************************************************************************
2 :
3 : (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
4 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
5 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
6 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
7 : contributors to this repository. All Rights Reserved.
8 :
9 : This software is protected by copyright law and by international treaties.
10 : The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
11 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
12 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
13 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
14 : contributors to this repository retain full ownership rights in their respective contributions in
15 : the software. This notice grants no license of any kind, including but not limited to patent
16 : license, nor is any license granted by implication, estoppel or otherwise.
17 :
18 : Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
19 : contributions.
20 :
21 : This software is provided "AS IS", without any express or implied warranties. The software is in the
22 : development stage. It is intended exclusively for experts who have experience with such software and
23 : solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
24 : and fitness for a particular purpose are hereby disclaimed and excluded.
25 :
26 : Any dispute, controversy or claim arising under or in relation to providing this software shall be
27 : submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
28 : accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
29 : the United Nations Convention on Contracts on the International Sales of Goods.
30 :
31 : *******************************************************************************************************/
32 :
33 : /*====================================================================================
34 : EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
35 : ====================================================================================*/
36 :
37 : /* options.h needed for debugging/development features
38 : * It should be stripped for delivery along with debugging switches */
39 : #include "options.h"
40 :
41 : #ifndef IVAS_ERROR_H
42 : #define IVAS_ERROR_H
43 :
44 : typedef enum
45 : {
46 : /*----------------------------------------*
47 : * no error *
48 : *----------------------------------------*/
49 : IVAS_ERR_OK = 0x0000,
50 :
51 : /*----------------------------------------*
52 : * API errors *
53 : *----------------------------------------*/
54 : IVAS_ERR_INVALID_BANDWIDTH = 0x1000,
55 : IVAS_ERR_INVALID_DTX_UPDATE_RATE,
56 : IVAS_ERR_INVALID_SAMPLING_RATE,
57 : IVAS_ERR_NOT_CONFIGURED,
58 : IVAS_ERR_INVALID_STEREO_MODE,
59 : IVAS_ERR_INVALID_MC_LAYOUT,
60 : IVAS_ERR_INVALID_BITRATE,
61 : IVAS_ERR_INVALID_MASA_CONFIG,
62 : IVAS_ERR_TOO_MANY_INPUTS,
63 : IVAS_ERR_MISSING_METADATA,
64 : IVAS_ERR_RECONFIGURE_NOT_SUPPORTED,
65 : IVAS_ERR_INVALID_FEC_CONFIG,
66 : IVAS_ERR_INVALID_FEC_OFFSET,
67 : IVAS_ERR_INVALID_INPUT_BUFFER_SIZE,
68 : IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE,
69 : IVAS_ERR_DTX_NOT_SUPPORTED,
70 : IVAS_ERR_UNEXPECTED_NULL_POINTER,
71 : IVAS_ERR_METADATA_NOT_EXPECTED,
72 : IVAS_ERR_WRONG_PARAMS,
73 : IVAS_ERR_INIT_ERROR,
74 : IVAS_ERR_WRONG_MODE,
75 : IVAS_ERR_INVALID_OUTPUT_FORMAT,
76 : IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED,
77 : IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED,
78 : IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED,
79 : IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED,
80 : IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED,
81 : IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED,
82 : IVAS_ERR_INVALID_HRTF,
83 : IVAS_ERR_INVALID_HRTF_SAMPLING_RATE,
84 : IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA,
85 : IVAS_ERR_INVALID_INPUT_FORMAT,
86 : IVAS_ERR_INVALID_INDEX,
87 : IVAS_ERR_NOT_SUPPORTED_OPTION,
88 : IVAS_ERR_NOT_IMPLEMENTED,
89 : IVAS_ERR_WAITING_FOR_BITSTREAM,
90 : IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT,
91 : IVAS_ERR_ISM_INVALID_METADATA_VALUE,
92 : IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE,
93 : IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED,
94 : IVAS_ERR_TSM_NOT_ENABLED,
95 : IVAS_ERR_FETCH_SIZE_NO_MULTIPLE_OF_5MS,
96 : #ifdef DEBUGGING
97 : IVAS_ERR_INVALID_FORCE_MODE,
98 : #ifdef DEBUG_AGC_ENCODER_CMD_OPTION
99 : IVAS_ERR_INVALID_AGC,
100 : #endif
101 : #ifdef VARIABLE_SPEED_DECODING
102 : IVAS_ERR_VS_FRAME_NEEDED,
103 : #endif
104 : #endif
105 :
106 : /*----------------------------------------*
107 : * input data errors *
108 : *----------------------------------------*/
109 : IVAS_ERR_INVALID_BITSTREAM = 0x2000,
110 : IVAS_ERR_UNEXPECTED_LC3PLUS_BITSTREAM,
111 : IVAS_ERR_UNEXPECTED_LC3PLUS_BITSTREAM_CONFIG,
112 :
113 : /*----------------------------------------*
114 : * hardware errors *
115 : *----------------------------------------*/
116 : IVAS_ERR_FAILED_ALLOC = 0x3000,
117 :
118 : /*----------------------------------------*
119 : * internal errors *
120 : *----------------------------------------*/
121 : IVAS_ERR_INTERNAL = 0x4000,
122 : IVAS_ERR_INTERNAL_FATAL,
123 :
124 : /*----------------------------------------*
125 : * file I/O errors (lib_util only) *
126 : *----------------------------------------*/
127 : IVAS_ERR_FAILED_FILE_OPEN = 0x5000,
128 : IVAS_ERR_FAILED_FILE_WRITE,
129 : IVAS_ERR_FAILED_FILE_READ,
130 : IVAS_ERR_FAILED_FILE_PARSE,
131 : IVAS_ERR_END_OF_FILE,
132 : IVAS_ERR_BITSTREAM_WRITER_INVALID_FORMAT,
133 : IVAS_ERR_BITSTREAM_READER_INVALID_DATA,
134 : IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT,
135 : IVAS_ERR_NO_FILE_OPEN,
136 : IVAS_ERR_SAMPLING_RATE_UNKNOWN,
137 : IVAS_ERR_EXTERNAL_ORIENTATION_INVALID_FORMAT,
138 :
139 : /*----------------------------------------*
140 : * renderer (lib_rend only) *
141 : *----------------------------------------*/
142 : IVAS_ERR_NUM_CHANNELS_UNKNOWN = 0x6000,
143 : IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT,
144 : IVAS_ERR_INVALID_INPUT_ID,
145 : IVAS_ERR_WRONG_NUM_CHANNELS,
146 : IVAS_ERR_INVALID_BUFFER_SIZE,
147 : IVAS_ERR_INVALID_RENDER_CONFIG,
148 : IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING,
149 : IVAS_ERR_INVALID_ER_PARAM,
150 : IVAS_ERR_DIRECTIVITY_PATTERN_ID_MISSING,
151 : IVAS_ERR_LC3PLUS_INVALID_BITRATE,
152 : IVAS_ERR_INVALID_SPLIT_REND_CONFIG,
153 :
154 : /*----------------------------------------*
155 : * unknown error *
156 : *----------------------------------------*/
157 : IVAS_ERR_UNKNOWN = 0xF000, /* fallback error code */
158 :
159 : } ivas_error;
160 :
161 :
162 0 : static inline const char *ivas_error_to_string( ivas_error error_code )
163 : {
164 : /* Try to match to a specific string */
165 0 : switch ( error_code )
166 : {
167 0 : case IVAS_ERR_OK:
168 0 : return "No error";
169 0 : case IVAS_ERR_FAILED_ALLOC:
170 0 : return "Failed allocation error";
171 0 : case IVAS_ERR_INTERNAL:
172 0 : return "Internal error";
173 0 : case IVAS_ERR_INTERNAL_FATAL:
174 0 : return "Internal fatal error";
175 0 : case IVAS_ERR_INVALID_SAMPLING_RATE:
176 0 : return "Invalid sampling rate";
177 0 : case IVAS_ERR_INVALID_OUTPUT_FORMAT:
178 0 : return "Invalid output format";
179 0 : case IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT:
180 0 : return "Invalid custom loudspeaker layout";
181 0 : case IVAS_ERR_INVALID_INPUT_ID:
182 0 : return "Invalid input ID";
183 0 : case IVAS_ERR_WRONG_NUM_CHANNELS:
184 0 : return "Wrong number of channels";
185 0 : case IVAS_ERR_INVALID_BUFFER_SIZE:
186 0 : return "Invalid buffer size";
187 0 : case IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED:
188 0 : return "Unsupported input/output config pair";
189 0 : case IVAS_ERR_FAILED_FILE_OPEN:
190 0 : return "File open error";
191 0 : case IVAS_ERR_FAILED_FILE_WRITE:
192 0 : return "File write error";
193 0 : case IVAS_ERR_FAILED_FILE_READ:
194 0 : return "File read error";
195 0 : case IVAS_ERR_FAILED_FILE_PARSE:
196 0 : return "Parse error";
197 0 : case IVAS_ERR_END_OF_FILE:
198 0 : return "End of file";
199 0 : case IVAS_ERR_WRONG_PARAMS:
200 0 : return "Wrong function parameters";
201 0 : case IVAS_ERR_INVALID_BANDWIDTH:
202 0 : return "Invalid bandwidth";
203 0 : case IVAS_ERR_INVALID_DTX_UPDATE_RATE:
204 0 : return "Invalid DTX update rate";
205 0 : case IVAS_ERR_NOT_CONFIGURED:
206 0 : return "Handle has not been configured";
207 0 : case IVAS_ERR_INVALID_STEREO_MODE:
208 0 : return "Invalid stereo mode";
209 0 : case IVAS_ERR_INVALID_MC_LAYOUT:
210 0 : return "Invalid speaker layout";
211 0 : case IVAS_ERR_INVALID_BITRATE:
212 0 : return "Invalid bitrate";
213 0 : case IVAS_ERR_INVALID_MASA_CONFIG:
214 0 : return "Invalid MASA config";
215 0 : case IVAS_ERR_TOO_MANY_INPUTS:
216 0 : return "Too many object inputs provided";
217 0 : case IVAS_ERR_RECONFIGURE_NOT_SUPPORTED:
218 0 : return "Reconfigure not supported";
219 0 : case IVAS_ERR_INVALID_FEC_OFFSET:
220 0 : return "Invalid FEC offset";
221 0 : case IVAS_ERR_INVALID_INPUT_BUFFER_SIZE:
222 0 : return "Invalid input buffer size";
223 0 : case IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE:
224 0 : return "Invalid output buffer size";
225 0 : case IVAS_ERR_DTX_NOT_SUPPORTED:
226 0 : return "DTX is not supported in this IVAS format and element mode";
227 0 : case IVAS_ERR_UNEXPECTED_NULL_POINTER:
228 0 : return "Unexpected NULL pointer";
229 0 : case IVAS_ERR_METADATA_NOT_EXPECTED:
230 0 : return "Metadata input not expected for current configuration";
231 : #ifdef DEBUGGING
232 : case IVAS_ERR_INVALID_FORCE_MODE:
233 : return "Invalid force mode";
234 : #endif
235 0 : case IVAS_ERR_NOT_IMPLEMENTED:
236 0 : return "Not implemented";
237 0 : case IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT:
238 0 : return "Invalid metadata file format";
239 0 : case IVAS_ERR_ISM_INVALID_METADATA_VALUE:
240 0 : return "Invalid metadata value provided";
241 0 : case IVAS_ERR_NOT_SUPPORTED_OPTION:
242 0 : return "Option not supported in this set-up";
243 0 : case IVAS_ERR_INIT_ERROR:
244 0 : return "Initialization error";
245 0 : case IVAS_ERR_INVALID_BITSTREAM:
246 0 : return "Invalid bitstream";
247 0 : case IVAS_ERR_WRONG_MODE:
248 0 : return "Wrong mode";
249 0 : case IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED:
250 0 : return "Head rotation not supported";
251 0 : case IVAS_ERR_LC3PLUS_INVALID_BITRATE:
252 0 : return "Specified split rendering bit rate is not supported";
253 0 : case IVAS_ERR_INVALID_SPLIT_REND_CONFIG:
254 0 : return "Specified split rendering configuration is invalid";
255 0 : case IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED:
256 0 : return "External orientation not supported";
257 0 : case IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED:
258 0 : return "Directivity not supported";
259 0 : case IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED:
260 0 : return "Acoustic environment not supported";
261 0 : case IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED:
262 0 : return "Objects editing not supported";
263 0 : case IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED:
264 0 : return "Wrong use of both Object editing and Non-diegetic panning";
265 0 : case IVAS_ERR_INVALID_HRTF:
266 0 : return "Unsupported HRTF filter set";
267 0 : case IVAS_ERR_INVALID_HRTF_SAMPLING_RATE:
268 0 : return "Wrong sampling rate in HRTF binary file";
269 0 : case IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA:
270 0 : return "Renderer data missing in HRTF binary file";
271 0 : case IVAS_ERR_INVALID_INPUT_FORMAT:
272 0 : return "Invalid input format";
273 0 : case IVAS_ERR_INVALID_INDEX:
274 0 : return "Invalid index";
275 0 : case IVAS_ERR_EXTERNAL_ORIENTATION_INVALID_FORMAT:
276 0 : return "Euler angles were detected in the input but only Quaternions are supported";
277 0 : default:
278 0 : break;
279 : }
280 :
281 : /* For error categories that are likely to still have many changes to
282 : * specific error codes, return one string per category */
283 0 : if ( ( error_code & 0xF000 ) == 0x1000 )
284 : {
285 0 : return "API error";
286 : }
287 0 : if ( ( error_code & 0xF000 ) == 0x2000 )
288 : {
289 0 : return "data error";
290 : }
291 :
292 0 : return "Unknown error";
293 : }
294 :
295 : #endif /* IVAS_ERROR_H */
|