|
Nugget
Bare-metal libraries and examples for the original PlayStation
|
#include <stdint.h>

Go to the source code of this file.
Classes | |
| struct | BsdecProf |
| struct | BsdecResult |
Enumerations | |
| enum | BsdecError { BSDEC_OK = 0 , BSDEC_SHORT , BSDEC_NOT_BS , BSDEC_BAD_VERSION , BSDEC_OUTPUT_TOO_SMALL , BSDEC_TRUNCATED , BSDEC_OVERLONG } |
Functions | |
| uint32_t | bsdecRlHalfwords (const void *in, uint32_t inBytes) |
| How many run-level halfwords a frame decodes to. | |
| struct BsdecResult | bsdecFrame (const void *in, uint32_t inBytes, uint16_t *out, uint32_t outHalfwords) |
| Decode one BS frame into MDEC run-level halfwords. | |
| enum BsdecError |
| struct BsdecResult bsdecFrame | ( | const void * | in, |
| uint32_t | inBytes, | ||
| uint16_t * | out, | ||
| uint32_t | outHalfwords | ||
| ) |
Decode one BS frame into MDEC run-level halfwords.
in must be halfword aligned - the bit reader walks the payload in halfword pairs - and in practice it is, since a frame arrives in sector payloads. out needs bsdecRlHalfwords(in, inBytes) entries.
The output is always a complete frame of exactly that many halfwords whenever bsdecUsable() holds, whatever the bitstream did: a partially decoded block is discarded, a short bitstream is padded with end-of-block markers, and a bitstream carrying more than its header declares is cut at the declared length. That is deliberate - a video decoder that refuses a damaged frame outright drops a frame where it could have shown most of one.