293{
294 int offset, bitOffset, mainBits, gr, ch, fhBytes, siBytes, freeFrameBytes;
295 int prevBitOffset, sfBlockBits, huffBlockBits;
296 const unsigned char *mainPtr;
298
299 #ifdef PROFILE
301 #endif
302
303 if (!mp3DecInfo)
305
306
308 if (fhBytes < 0)
310 *inbuf += fhBytes;
311
312#ifdef PROFILE
313 time = systime_get();
314#endif
315
317 if (siBytes < 0) {
320 }
321 *inbuf += siBytes;
322 *bytesLeft -= (fhBytes + siBytes);
323#ifdef PROFILE
326#endif
327
328
329
332
338 }
341 }
343 }
344
345
346
347
348
349
350
351 if (useSize) {
352 mp3DecInfo->
nSlots = *bytesLeft;
354
357 }
358
359
361 mainPtr = *inbuf;
362 *inbuf += mp3DecInfo->
nSlots;
363 *bytesLeft -= (mp3DecInfo->
nSlots);
364 } else {
365
366 if (mp3DecInfo->
nSlots > (
int)*bytesLeft) {
369 }
370
371#ifdef PROFILE
372 time = systime_get();
373#endif
374
376
379
381 *inbuf += mp3DecInfo->
nSlots;
382 *bytesLeft -= (mp3DecInfo->
nSlots);
384 } else {
385
388 *inbuf += mp3DecInfo->
nSlots;
389 *bytesLeft -= (mp3DecInfo->
nSlots);
392 }
393#ifdef PROFILE
396#endif
397
398 }
399 bitOffset = 0;
401
402
403 for (gr = 0; gr < mp3DecInfo->
nGrans; gr++) {
404 for (ch = 0; ch < mp3DecInfo->
nChans; ch++) {
405
406 #ifdef PROFILE
407 time = systime_get();
408 #endif
409
410 prevBitOffset = bitOffset;
412 #ifdef PROFILE
415 #endif
416
417 sfBlockBits = 8*
offset - prevBitOffset + bitOffset;
418 huffBlockBits = mp3DecInfo->
part23Length[gr][ch] - sfBlockBits;
420 mainBits -= sfBlockBits;
421
422 if (
offset < 0 || mainBits < huffBlockBits) {
425 }
426
427 #ifdef PROFILE
428 time = systime_get();
429 #endif
430
431 prevBitOffset = bitOffset;
436 }
437 #ifdef PROFILE
440 #endif
441
443 mainBits -= (8*
offset - prevBitOffset + bitOffset);
444 }
445
446 #ifdef PROFILE
447 time = systime_get();
448 #endif
449
453 }
454 #ifdef PROFILE
457 #endif
458
459
460 for (ch = 0; ch < mp3DecInfo->
nChans; ch++)
461 {
462 #ifdef PROFILE
463 time = systime_get();
464 #endif
465 if (
IMDCT(mp3DecInfo, gr, ch) < 0) {
468 }
469 #ifdef PROFILE
472 #endif
473 }
474
475 #ifdef PROFILE
476 time = systime_get();
477 #endif
478
482 }
483 #ifdef PROFILE
486 #endif
487
488 }
490}
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
struct _MP3DecInfo MP3DecInfo
int part23Length[MAX_NGRAN][MAX_NCHAN]
unsigned char mainBuf[MAINBUF_SIZE]
@ ERR_MP3_INVALID_SCALEFACT
@ ERR_MP3_INDATA_UNDERFLOW
@ ERR_MP3_MAINDATA_UNDERFLOW
@ ERR_MP3_INVALID_HUFFCODES
@ ERR_MP3_INVALID_FRAMEHEADER
@ ERR_MP3_INVALID_SUBBAND
@ ERR_MP3_INVALID_DEQUANTIZE
@ ERR_MP3_FREE_BITRATE_SYNC
@ ERR_MP3_INVALID_SIDEINFO
int Dequantize(MP3DecInfo *mp3DecInfo, int gr) FL_NOEXCEPT
static void MP3ClearBadFrame(MP3DecInfo *mp3DecInfo, short *outbuf) FL_NOEXCEPT
int UnpackFrameHeader(MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT
int UnpackScaleFactors(MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch) FL_NOEXCEPT
static int MP3FindFreeSync(const unsigned char *buf, const unsigned char firstFH[4], int nBytes) FL_NOEXCEPT
int UnpackSideInfo(MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT
int DecodeHuffman(MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch) FL_NOEXCEPT
int IMDCT(MP3DecInfo *mp3DecInfo, int gr, int ch) FL_NOEXCEPT
int Subband(MP3DecInfo *mp3DecInfo, short *pcmBuf) FL_NOEXCEPT
int CheckPadBit(MP3DecInfo *mp3DecInfo) FL_NOEXCEPT
fl::u64 time() FL_NOEXCEPT
Alias for millis64() - returns 64-bit millisecond time.
void printf(const char *format, const Args &... args) FL_NOEXCEPT
Printf-like formatting function that prints directly to the platform output.
void * memcopy(void *dest, const void *src, size_t n) FL_NOEXCEPT
void * memmove(void *dest, const void *src, size_t n) FL_NOEXCEPT