FastLED 3.9.15
Loading...
Searching...
No Matches

◆ vorbis_decode_initial()

static int32_t fl::third_party::vorbis::vorbis_decode_initial ( vorb * f,
int32_t * p_left_start,
int32_t * p_left_end,
int32_t * p_right_start,
int32_t * p_right_end,
int32_t * mode )
static

Definition at line 2854 of file stb_vorbis.cpp.hpp.

2855{
2856 Mode *m;
2857 int32_t i, n, prev, next, window_center;
2859
2860 retry:
2861 if (f->eof) return false;
2862 if (!maybe_start_packet(f))
2863 return false;
2864 // check packet type
2865 if (get_bits(f,1) != 0) {
2866 if (FL_STBV_IS_PUSH_MODE(f))
2867 return error(f,VORBIS_bad_packet_type);
2868 while (EOP != get8_packet(f));
2869 goto retry;
2870 }
2871
2872 if (f->alloc.alloc_buffer)
2873 FL_ASSERT(f->alloc.alloc_buffer_length_in_bytes == f->temp_offset, "alloc_buffer_length must equal temp_offset");
2874
2875 i = get_bits(f, ilog(f->mode_count-1));
2876 if (i == EOP) return false;
2877 if (i >= f->mode_count) return false;
2878 *mode = i;
2879 m = f->mode_config + i;
2880 if (m->blockflag) {
2881 n = f->blocksize_1;
2882 prev = get_bits(f,1);
2883 next = get_bits(f,1);
2884 } else {
2885 prev = next = 0;
2886 n = f->blocksize_0;
2887 }
2888
2889// WINDOWING
2890
2891 window_center = n >> 1;
2892 if (m->blockflag && !prev) {
2893 *p_left_start = (n - f->blocksize_0) >> 2;
2894 *p_left_end = (n + f->blocksize_0) >> 2;
2895 } else {
2896 *p_left_start = 0;
2897 *p_left_end = window_center;
2898 }
2899 if (m->blockflag && !next) {
2900 *p_right_start = (n*3 - f->blocksize_0) >> 2;
2901 *p_right_end = (n*3 + f->blocksize_0) >> 2;
2902 } else {
2903 *p_right_start = window_center;
2904 *p_right_end = n;
2905 }
2906
2907 return true;
2908}
#define FL_ASSERT(x, MSG)
Definition assert.h:6
static int32_t ilog(int32 n) FL_NOEXCEPT
static int32_t error(vorb *f, enum STBVorbisError e) FL_NOEXCEPT
static constexpr int32_t EOP
static int32_t maybe_start_packet(vorb *f) FL_NOEXCEPT
static uint32 get_bits(vorb *f, int32_t n) FL_NOEXCEPT
static int32_t get8_packet(vorb *f) FL_NOEXCEPT
fl::i32 int32_t
Definition coder.h:220
#define FL_STBV_IS_PUSH_MODE(f)

References fl::third_party::vorbis::Mode::blockflag, EOP, error(), FL_ASSERT, FL_NOEXCEPT, FL_STBV_IS_PUSH_MODE, get8_packet(), get_bits(), ilog(), maybe_start_packet(), and VORBIS_bad_packet_type.

Referenced by peek_decode_initial(), and vorbis_decode_packet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: