LCOV - code coverage report
Current view: top level - lib_com - ivas_error.h (source / functions) Hit Total Coverage
Test: Coverage on main -- short test vectors @ 6c9ddc4024a9c0e1ecb8f643f114a84a0e26ec6b Lines: 0 113 0.0 %
Date: 2025-05-23 08:37:30 Functions: 0 1 0.0 %

          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             : 
     138             :     /*----------------------------------------*
     139             :      *    renderer (lib_rend only)            *
     140             :      *----------------------------------------*/
     141             :     IVAS_ERR_NUM_CHANNELS_UNKNOWN = 0x6000,
     142             :     IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT,
     143             :     IVAS_ERR_INVALID_INPUT_ID,
     144             :     IVAS_ERR_WRONG_NUM_CHANNELS,
     145             :     IVAS_ERR_INVALID_BUFFER_SIZE,
     146             :     IVAS_ERR_INVALID_RENDER_CONFIG,
     147             :     IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING,
     148             :     IVAS_ERR_INVALID_ER_PARAM,
     149             :     IVAS_ERR_DIRECTIVITY_PATTERN_ID_MISSING,
     150             :     IVAS_ERR_LC3PLUS_INVALID_BITRATE,
     151             :     IVAS_ERR_INVALID_SPLIT_REND_CONFIG,
     152             : 
     153             :     /*----------------------------------------*
     154             :      *              unknown error             *
     155             :      *----------------------------------------*/
     156             :     IVAS_ERR_UNKNOWN = 0xF000, /* fallback error code */
     157             : 
     158             : } ivas_error;
     159             : 
     160             : 
     161           0 : static inline const char *ivas_error_to_string( ivas_error error_code )
     162             : {
     163             :     /* Try to match to a specific string */
     164           0 :     switch ( error_code )
     165             :     {
     166           0 :         case IVAS_ERR_OK:
     167           0 :             return "No error";
     168           0 :         case IVAS_ERR_FAILED_ALLOC:
     169           0 :             return "Failed allocation error";
     170           0 :         case IVAS_ERR_INTERNAL:
     171           0 :             return "Internal error";
     172           0 :         case IVAS_ERR_INTERNAL_FATAL:
     173           0 :             return "Internal fatal error";
     174           0 :         case IVAS_ERR_INVALID_SAMPLING_RATE:
     175           0 :             return "Invalid sampling rate";
     176           0 :         case IVAS_ERR_INVALID_OUTPUT_FORMAT:
     177           0 :             return "Invalid output format";
     178           0 :         case IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT:
     179           0 :             return "Invalid custom loudspeaker layout";
     180           0 :         case IVAS_ERR_INVALID_INPUT_ID:
     181           0 :             return "Invalid input ID";
     182           0 :         case IVAS_ERR_WRONG_NUM_CHANNELS:
     183           0 :             return "Wrong number of channels";
     184           0 :         case IVAS_ERR_INVALID_BUFFER_SIZE:
     185           0 :             return "Invalid buffer size";
     186           0 :         case IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED:
     187           0 :             return "Unsupported input/output config pair";
     188           0 :         case IVAS_ERR_FAILED_FILE_OPEN:
     189           0 :             return "File open error";
     190           0 :         case IVAS_ERR_FAILED_FILE_WRITE:
     191           0 :             return "File write error";
     192           0 :         case IVAS_ERR_FAILED_FILE_READ:
     193           0 :             return "File read error";
     194           0 :         case IVAS_ERR_FAILED_FILE_PARSE:
     195           0 :             return "Parse error";
     196           0 :         case IVAS_ERR_END_OF_FILE:
     197           0 :             return "End of file";
     198           0 :         case IVAS_ERR_WRONG_PARAMS:
     199           0 :             return "Wrong function parameters";
     200           0 :         case IVAS_ERR_INVALID_BANDWIDTH:
     201           0 :             return "Invalid bandwidth";
     202           0 :         case IVAS_ERR_INVALID_DTX_UPDATE_RATE:
     203           0 :             return "Invalid DTX update rate";
     204           0 :         case IVAS_ERR_NOT_CONFIGURED:
     205           0 :             return "Handle has not been configured";
     206           0 :         case IVAS_ERR_INVALID_STEREO_MODE:
     207           0 :             return "Invalid stereo mode";
     208           0 :         case IVAS_ERR_INVALID_MC_LAYOUT:
     209           0 :             return "Invalid speaker layout";
     210           0 :         case IVAS_ERR_INVALID_BITRATE:
     211           0 :             return "Invalid bitrate";
     212           0 :         case IVAS_ERR_INVALID_MASA_CONFIG:
     213           0 :             return "Invalid MASA config";
     214           0 :         case IVAS_ERR_TOO_MANY_INPUTS:
     215           0 :             return "Too many object inputs provided";
     216           0 :         case IVAS_ERR_RECONFIGURE_NOT_SUPPORTED:
     217           0 :             return "Reconfigure not supported";
     218           0 :         case IVAS_ERR_INVALID_FEC_OFFSET:
     219           0 :             return "Invalid FEC offset";
     220           0 :         case IVAS_ERR_INVALID_INPUT_BUFFER_SIZE:
     221           0 :             return "Invalid input buffer size";
     222           0 :         case IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE:
     223           0 :             return "Invalid output buffer size";
     224           0 :         case IVAS_ERR_DTX_NOT_SUPPORTED:
     225           0 :             return "DTX is not supported in this IVAS format and element mode";
     226           0 :         case IVAS_ERR_UNEXPECTED_NULL_POINTER:
     227           0 :             return "Unexpected NULL pointer";
     228           0 :         case IVAS_ERR_METADATA_NOT_EXPECTED:
     229           0 :             return "Metadata input not expected for current configuration";
     230             : #ifdef DEBUGGING
     231             :         case IVAS_ERR_INVALID_FORCE_MODE:
     232             :             return "Invalid force mode";
     233             : #endif
     234           0 :         case IVAS_ERR_NOT_IMPLEMENTED:
     235           0 :             return "Not implemented";
     236           0 :         case IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT:
     237           0 :             return "Invalid metadata file format";
     238           0 :         case IVAS_ERR_ISM_INVALID_METADATA_VALUE:
     239           0 :             return "Invalid metadata value provided";
     240           0 :         case IVAS_ERR_NOT_SUPPORTED_OPTION:
     241           0 :             return "Option not supported in this set-up";
     242           0 :         case IVAS_ERR_INIT_ERROR:
     243           0 :             return "Initialization error";
     244           0 :         case IVAS_ERR_INVALID_BITSTREAM:
     245           0 :             return "Invalid bitstream";
     246           0 :         case IVAS_ERR_WRONG_MODE:
     247           0 :             return "Wrong mode";
     248           0 :         case IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED:
     249           0 :             return "Head rotation not supported";
     250           0 :         case IVAS_ERR_LC3PLUS_INVALID_BITRATE:
     251           0 :             return "Specified split rendering bit rate is not supported";
     252           0 :         case IVAS_ERR_INVALID_SPLIT_REND_CONFIG:
     253           0 :             return "Specified split rendering configuration is invalid";
     254           0 :         case IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED:
     255           0 :             return "External orientation not supported";
     256           0 :         case IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED:
     257           0 :             return "Directivity not supported";
     258           0 :         case IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED:
     259           0 :             return "Acoustic environment not supported";
     260           0 :         case IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED:
     261           0 :             return "Objects editing not supported";
     262           0 :         case IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED:
     263           0 :             return "Wrong use of both Object editing and Non-diegetic panning";
     264           0 :         case IVAS_ERR_INVALID_HRTF:
     265           0 :             return "Unsupported HRTF filter set";
     266           0 :         case IVAS_ERR_INVALID_HRTF_SAMPLING_RATE:
     267           0 :             return "Wrong sampling rate in HRTF binary file";
     268           0 :         case IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA:
     269           0 :             return "Renderer data missing in HRTF binary file";
     270           0 :         case IVAS_ERR_INVALID_INPUT_FORMAT:
     271           0 :             return "Invalid input format";
     272           0 :         case IVAS_ERR_INVALID_INDEX:
     273           0 :             return "Invalid index";
     274           0 :         default:
     275           0 :             break;
     276             :     }
     277             : 
     278             :     /* For error categories that are likely to still have many changes to
     279             :      * specific error codes, return one string per category */
     280           0 :     if ( ( error_code & 0xF000 ) == 0x1000 )
     281             :     {
     282           0 :         return "API error";
     283             :     }
     284           0 :     if ( ( error_code & 0xF000 ) == 0x2000 )
     285             :     {
     286           0 :         return "data error";
     287             :     }
     288             : 
     289           0 :     return "Unknown error";
     290             : }
     291             : 
     292             : #endif /* IVAS_ERROR_H */

Generated by: LCOV version 1.14