|
|
#define | FLAC_MAX_SEQUENTIAL_HEADERS 4 |
| | maximum number of adjacent headers that compare CRCs against each other
|
| |
|
#define | FLAC_MIN_HEADERS 10 |
| | minimum number of headers buffered and checked before returning frames
|
| |
|
#define | FLAC_AVG_FRAME_SIZE 8192 |
| | estimate for average size of a FLAC frame
|
| |
|
#define | FLAC_HEADER_BASE_SCORE 10 |
| | scoring settings for score_header
|
| |
|
#define | FLAC_HEADER_CHANGED_PENALTY 7 |
| |
|
#define | FLAC_HEADER_CRC_FAIL_PENALTY 50 |
| |
|
#define | FLAC_HEADER_NOT_PENALIZED_YET 100000 |
| |
|
#define | FLAC_HEADER_NOT_SCORED_YET -100000 |
| |
|
#define | MAX_FRAME_HEADER_SIZE 16 |
| | largest possible size of flac header
|
| |
FLAC parser.
The FLAC parser buffers input until FLAC_MIN_HEADERS has been found. Each time it finds and verifies a CRC-8 header it sees which of the FLAC_MAX_SEQUENTIAL_HEADERS that came before it have a valid CRC-16 footer that ends at the newly found header. Headers are scored by FLAC_HEADER_BASE_SCORE plus the max of its crc-verified children, penalized by changes in sample rate, frame number, etc. The parser returns the frame with the highest score.