35 #define MAX_CHANNELS 8
36 #define MAX_BLOCKSIZE 65535
38 #define OUT_BUFFER_SIZE 16384
42 #define WAVE_FORMAT_PCM 0x0001
44 #define DEFAULT_BLOCK_SIZE 256
50 #define BITSHIFTSIZE 2
59 #define V2LPCQOFFSET (1 << LPCQUANT)
67 #define FN_BLOCKSIZE 5
76 #define VERBATIM_CKSIZE_SIZE 5
77 #define VERBATIM_BYTE_SIZE 8
78 #define CANONICAL_HEADER_SIZE 44
129 for (chan = 0; chan < s->
channels; chan++) {
130 if (
FFMAX(1, s->
nmean) >= UINT_MAX /
sizeof(int32_t)) {
137 "s->blocksize + s->nwrap too large\n");
145 s->
offset[chan] = tmp_ptr;
152 for (i = 0; i < s->
nwrap; i++)
197 for (chan = 0; chan < s->
channels; chan++)
198 for (i = 0; i < nblock; i++)
199 s->
offset[chan][i] = mean;
212 if (bytestream2_get_le32(&gb) !=
MKTAG(
'R',
'I',
'F',
'F')) {
219 if (bytestream2_get_le32(&gb) !=
MKTAG(
'W',
'A',
'V',
'E')) {
224 while (bytestream2_get_le32(&gb) !=
MKTAG(
'f',
'm',
't',
' ')) {
225 len = bytestream2_get_le32(&gb);
232 len = bytestream2_get_le32(&gb);
239 wave_format = bytestream2_get_le16(&gb);
241 switch (wave_format) {
271 for (i=0; i<blocksize; i++)
272 for (chan=0; chan < nchan; chan++)
273 *samples++ = av_clip_int16(buffer[chan][i]);
283 int residual_size, int32_t coffset)
285 int pred_order, sum, qshift, init_sum, i, j;
291 if (pred_order > s->
nwrap) {
297 for (i = 0; i < pred_order; i++)
304 pred_order = command;
310 if (command ==
FN_QLPC && coffset)
311 for (i = -pred_order; i < 0; i++)
312 s->
decoded[channel][i] -= coffset;
318 for (j = 0; j < pred_order; j++)
319 sum += coeffs[j] * s->
decoded[channel][i - j - 1];
325 if (command ==
FN_QLPC && coffset)
327 s->
decoded[channel][i] += coffset;
368 "invalid or unsupported block size: %d\n",
378 for (i = 0; i < skip_bytes; i++)
394 "missing verbatim section at beginning of stream\n");
421 int *got_frame_ptr,
AVPacket *avpkt)
423 const uint8_t *buf = avpkt->
data;
424 int buf_size = avpkt->
size;
426 int i, input_buf_size = 0;
445 input_buf_size = buf_size;
462 if (buf_size < s->max_framesize && avpkt->
data) {
464 return input_buf_size;
518 "Increasing block size is not supported\n");
523 "block size: %d\n", blocksize);
539 int residual_size = 0;
553 coffset = s->
offset[channel][0];
557 sum += s->
offset[channel][i];
558 coffset = sum / s->
nmean;
569 residual_size, coffset)) < 0)
589 for (i = -s->
nwrap; i < 0; i++)
629 return input_buf_size;