There several error handling mechanisms in the VCU Control Software API. The most common mechanism is for functions to return a status value, such as a boolean or a pointer that is NULL in the failing case.
The encoder and decoder objects each store an error code to be accessed with
AL_Encoder_GetFrameError
and AL_Decoder_GetFrameError
, respectively.
User-defined callbacks are sometimes notified of unusual conditions by passing NULL for a pointer that is not normally NULL or do not provide any notification but assume the callback itself uses one of the accessor functions to retrieve the error status from an encoder object or a decoder object.
In unusual or unexpected circumstances, some functions may report errors directly to the console. These are system errors and the messages contain the messages in the following table.
Error Types | Description |
---|---|
AL_SUCCESS | The operation succeeded without encountering any error |
AL_ERROR | Unknown error |
AL_ERR_NO_MEMORY | No memory left so couldn't allocate resource. This can be dma memory, mcu specific memory if available or simply virtual memory shortage |
AL_ERR_STREAM_OVERFLOW | The generated stream couldn't fit inside the allocated stream buffer |
AL_ERR_TOO_MANY_SLICES | If SliceSize mode is supported, the constraint couldn't be respected as too many slices were required to respect it |
AL_ERR_CHAN_CREATION_NO_CHANNEL_AVAILABLE | The scheduler can't handle more channel (fixed limit of AL_SCHEDULER_MAX_CHANNEL) |
AL_ERR_CHAN_CREATION_RESOURCE_UNAVAILABLE | The processing power of the available cores is insufficient to handle this channel |
AL_ERR_CHAN_CREATION_NOT_ENOUGH_CORES | Couldn't spread the load on enough cores (a special case of ERROR_RESOURCE_UNAVAILABLE) or the load can't be spread so much (each core has a requirement on the minimal number of resources it can handle) |
AL_ERR_REQUEST_MALFORMED | Some parameters in the request have an invalid value |
AL_ERR_CMD_NOT_ALLOWED | The dynamic command is not allowed in some configuration |
AL_ERR_INVALID_CMD_VALUE | The value associated with the command is invalid (in the current configuration) |
There are various ways encoded bitstream can be corrupted and detecting those errors in a compressed bitstream is complex because of the syntax element coding and parsing dependencies. The errors are usually not detected on corrupted bit but more likely on the following syntax elements.
For example, an encoded bitstream has scaling matrices and "scaling matrices present bit" is corrupted in the stream. When a decoder reads this bitstream, it first assumes that there is no scaling matrices present in the stream and goes on parsing actual scaling matrix data as next syntax element which may cause an error. Ideally, the error was corruption of scaling matrix bit, but the decoder is not able to detect that, and such kind of scenarios are common in video codecs.
Refer VPS/SPS/PPS parsing function for more details on error handling and reporting:
https://github.com/Xilinx/vcu-ctrl-sw/tree/master/lib_parsing
lib_parsing/AvcParser.c and lib_parsing/HevcParser.c and check the calls to the macro COMPLY.
In addition, monitor the AL_AVC_ParseSliceHeader
and AL_HEVC_ParseSliceHeader
functions in lib_parsing/SliceHdrParsing.c and check the return false paths.