|
@@ -1868,85 +1868,6 @@ static int codebook_decode_deinterleave_repeat(vorb *f, Codebook *c, float **out
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
-#ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK
|
|
|
-static int codebook_decode_deinterleave_repeat_2(vorb *f, Codebook *c, float **outputs, int *c_inter_p, int *p_inter_p, int len, int total_decode)
|
|
|
-{
|
|
|
- int c_inter = *c_inter_p;
|
|
|
- int p_inter = *p_inter_p;
|
|
|
- int i,z, effective = c->dimensions;
|
|
|
-
|
|
|
- // type 0 is only legal in a scalar context
|
|
|
- if (c->lookup_type == 0) return error(f, VORBIS_invalid_stream);
|
|
|
-
|
|
|
- while (total_decode > 0) {
|
|
|
- float last = CODEBOOK_ELEMENT_BASE(c);
|
|
|
- DECODE_VQ(z,f,c);
|
|
|
-
|
|
|
- if (z < 0) {
|
|
|
- if (!f->bytes_in_seg)
|
|
|
- if (f->last_seg) return FALSE;
|
|
|
- return error(f, VORBIS_invalid_stream);
|
|
|
- }
|
|
|
-
|
|
|
- // if this will take us off the end of the buffers, stop short!
|
|
|
- // we check by computing the length of the virtual interleaved
|
|
|
- // buffer (len*ch), our current offset within it (p_inter*ch)+(c_inter),
|
|
|
- // and the length we'll be using (effective)
|
|
|
- if (c_inter + p_inter*2 + effective > len * 2) {
|
|
|
- effective = len*2 - (p_inter*2 - c_inter);
|
|
|
- }
|
|
|
-
|
|
|
- {
|
|
|
- z *= c->dimensions;
|
|
|
- if (c->sequence_p) {
|
|
|
- // haven't optimized this case because I don't have any examples
|
|
|
- for (i=0; i < effective; ++i) {
|
|
|
- float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last;
|
|
|
- if (outputs[c_inter])
|
|
|
- outputs[c_inter][p_inter] += val;
|
|
|
- if (++c_inter == 2) { c_inter = 0; ++p_inter; }
|
|
|
- last = val;
|
|
|
- }
|
|
|
- } else {
|
|
|
- i=0;
|
|
|
- if (c_inter == 1 && i < effective) {
|
|
|
- float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last;
|
|
|
- if (outputs[c_inter])
|
|
|
- outputs[c_inter][p_inter] += val;
|
|
|
- c_inter = 0; ++p_inter;
|
|
|
- ++i;
|
|
|
- }
|
|
|
- {
|
|
|
- float *z0 = outputs[0];
|
|
|
- float *z1 = outputs[1];
|
|
|
- for (; i+1 < effective;) {
|
|
|
- float v0 = CODEBOOK_ELEMENT_FAST(c,z+i) + last;
|
|
|
- float v1 = CODEBOOK_ELEMENT_FAST(c,z+i+1) + last;
|
|
|
- if (z0)
|
|
|
- z0[p_inter] += v0;
|
|
|
- if (z1)
|
|
|
- z1[p_inter] += v1;
|
|
|
- ++p_inter;
|
|
|
- i += 2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (i < effective) {
|
|
|
- float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last;
|
|
|
- if (outputs[c_inter])
|
|
|
- outputs[c_inter][p_inter] += val;
|
|
|
- if (++c_inter == 2) { c_inter = 0; ++p_inter; }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- total_decode -= effective;
|
|
|
- }
|
|
|
- *c_inter_p = c_inter;
|
|
|
- *p_inter_p = p_inter;
|
|
|
- return TRUE;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
static int predict_point(int x, int x0, int x1, int y0, int y1)
|
|
|
{
|
|
|
int dy = y1 - y0;
|
|
@@ -4429,7 +4350,7 @@ int stb_vorbis_decode_frame_pushdata(
|
|
|
while (get8_packet(f) != EOP)
|
|
|
if (f->eof) break;
|
|
|
*samples = 0;
|
|
|
- return f->stream - data;
|
|
|
+ return (int) (f->stream - data);
|
|
|
}
|
|
|
if (error == VORBIS_continued_packet_flag_invalid) {
|
|
|
if (f->previous_length == 0) {
|
|
@@ -4439,7 +4360,7 @@ int stb_vorbis_decode_frame_pushdata(
|
|
|
while (get8_packet(f) != EOP)
|
|
|
if (f->eof) break;
|
|
|
*samples = 0;
|
|
|
- return f->stream - data;
|
|
|
+ return (int) (f->stream - data);
|
|
|
}
|
|
|
}
|
|
|
// if we get an error while parsing, what to do?
|
|
@@ -4459,7 +4380,7 @@ int stb_vorbis_decode_frame_pushdata(
|
|
|
if (channels) *channels = f->channels;
|
|
|
*samples = len;
|
|
|
*output = f->outputs;
|
|
|
- return f->stream - data;
|
|
|
+ return (int) (f->stream - data);
|
|
|
}
|
|
|
|
|
|
stb_vorbis *stb_vorbis_open_pushdata(
|
|
@@ -4482,7 +4403,7 @@ stb_vorbis *stb_vorbis_open_pushdata(
|
|
|
f = vorbis_alloc(&p);
|
|
|
if (f) {
|
|
|
*f = p;
|
|
|
- *data_used = f->stream - data;
|
|
|
+ *data_used = (int) (f->stream - data);
|
|
|
*error = 0;
|
|
|
return f;
|
|
|
} else {
|
|
@@ -4497,9 +4418,9 @@ unsigned int stb_vorbis_get_file_offset(stb_vorbis *f)
|
|
|
#ifndef STB_VORBIS_NO_PUSHDATA_API
|
|
|
if (f->push_mode) return 0;
|
|
|
#endif
|
|
|
- if (USE_MEMORY(f)) return f->stream - f->stream_start;
|
|
|
+ if (USE_MEMORY(f)) return (unsigned int) (f->stream - f->stream_start);
|
|
|
#ifndef STB_VORBIS_NO_STDIO
|
|
|
- return ftell(f->f) - f->f_start;
|
|
|
+ return (unsigned int) (ftell(f->f) - f->f_start);
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -4995,7 +4916,7 @@ stb_vorbis * stb_vorbis_open_file_section(FILE *file, int close_on_free, int *er
|
|
|
stb_vorbis *f, p;
|
|
|
vorbis_init(&p, alloc);
|
|
|
p.f = file;
|
|
|
- p.f_start = ftell(file);
|
|
|
+ p.f_start = (uint32) ftell(file);
|
|
|
p.stream_len = length;
|
|
|
p.close_on_free = close_on_free;
|
|
|
if (start_decoder(&p)) {
|
|
@@ -5014,9 +4935,9 @@ stb_vorbis * stb_vorbis_open_file_section(FILE *file, int close_on_free, int *er
|
|
|
stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, const stb_vorbis_alloc *alloc)
|
|
|
{
|
|
|
unsigned int len, start;
|
|
|
- start = ftell(file);
|
|
|
+ start = (unsigned int) ftell(file);
|
|
|
fseek(file, 0, SEEK_END);
|
|
|
- len = ftell(file) - start;
|
|
|
+ len = (unsigned int) (ftell(file) - start);
|
|
|
fseek(file, start, SEEK_SET);
|
|
|
return stb_vorbis_open_file_section(file, close_on_free, error, alloc, len);
|
|
|
}
|