FLAC FRAME MAGIC NUMBER: Difference between revisions
Jump to navigation
Jump to search
(Created page with "* High order bit on error * 0 subframe constant * 2 sub frame verbatim * < 16 error * <= 24 predictor order (x>>1)&7 * < 64 error * '''else predictor order ((x>>1)&31)+1 = 8;''' We are 78 for test case. <nowiki> if(x & 0x80) { send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; return true; } else if(x == 0) { if(!read_subframe_constant_(decoder, channel, bps,...") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
* < 64 error | * < 64 error | ||
* '''else predictor order ((x>>1)&31)+1 = 8;''' We are 78 for test case. | * '''else predictor order ((x>>1)&31)+1 = 8;''' We are 78 for test case. | ||
<nowiki> | <nowiki> | ||
if(x & 0x80) { | if(x & 0x80) { | ||
send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); | send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); | ||
Line 54: | Line 54: | ||
return true; | return true; | ||
} | } | ||
</nowiki> |
Latest revision as of 19:19, 22 January 2025
- High order bit on error
- 0 subframe constant
- 2 sub frame verbatim
- < 16 error
- <= 24 predictor order (x>>1)&7
- < 64 error
- else predictor order ((x>>1)&31)+1 = 8; We are 78 for test case.
if(x & 0x80) { send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; return true; } else if(x == 0) { if(!read_subframe_constant_(decoder, channel, bps, do_full_decode)) return false; } else if(x == 2) { if(!read_subframe_verbatim_(decoder, channel, bps, do_full_decode)) return false; } else if(x < 16) { send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; return true; } else if(x <= 24) { uint32_t predictor_order = (x>>1)&7; if(decoder->private_->frame.header.blocksize <= predictor_order){ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; return true; } if(!read_subframe_fixed_(decoder, channel, bps, predictor_order, do_full_decode)) return false; if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */ return true; } else if(x < 64) { send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; return true; } else { uint32_t predictor_order = ((x>>1)&31)+1; if(decoder->private_->frame.header.blocksize <= predictor_order){ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; return true; } if(!read_subframe_lpc_(decoder, channel, bps, predictor_order, do_full_decode)) return false; if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */ return true; }