36 #define MAX_CHANNELS 8
37 #define MAX_BLOCKSIZE 65535
39 #define OUT_BUFFER_SIZE 16384
43 #define WAVE_FORMAT_PCM 0x0001
45 #define DEFAULT_BLOCK_SIZE 256
51 #define BITSHIFTSIZE 2
60 #define V2LPCQOFFSET (1 << LPCQUANT)
68 #define FN_BLOCKSIZE 5
77 #define VERBATIM_CKSIZE_SIZE 5
78 #define VERBATIM_BYTE_SIZE 8
79 #define CANONICAL_HEADER_SIZE 44
130 for (chan = 0; chan < s->
channels; chan++) {
131 if (
FFMAX(1, s->
nmean) >= UINT_MAX /
sizeof(int32_t)) {
138 "s->blocksize + s->nwrap too large\n");
146 s->
offset[chan] = tmp_ptr;
153 for (i = 0; i < s->
nwrap; i++)
198 for (chan = 0; chan < s->
channels; chan++)
199 for (i = 0; i < nblock; i++)
200 s->
offset[chan][i] = mean;
213 if (bytestream2_get_le32(&gb) !=
MKTAG(
'R',
'I',
'F',
'F')) {
220 if (bytestream2_get_le32(&gb) !=
MKTAG(
'W',
'A',
'V',
'E')) {
225 while (bytestream2_get_le32(&gb) !=
MKTAG(
'f',
'm',
't',
' ')) {
226 len = bytestream2_get_le32(&gb);
233 len = bytestream2_get_le32(&gb);
240 wave_format = bytestream2_get_le16(&gb);
242 switch (wave_format) {
272 for (i=0; i<blocksize; i++)
273 for (chan=0; chan < nchan; chan++)
274 *samples++ = av_clip_int16(buffer[chan][i]);
284 int residual_size, int32_t coffset)
286 int pred_order, sum, qshift, init_sum, i, j;
292 if (pred_order > s->
nwrap) {
298 for (i = 0; i < pred_order; i++)
305 pred_order = command;
311 if (command ==
FN_QLPC && coffset)
312 for (i = -pred_order; i < 0; i++)
313 s->
decoded[channel][i] -= coffset;
319 for (j = 0; j < pred_order; j++)
320 sum += coeffs[j] * s->
decoded[channel][i - j - 1];
326 if (command ==
FN_QLPC && coffset)
328 s->
decoded[channel][i] += coffset;
369 "invalid or unsupported block size: %d\n",
379 for (i = 0; i < skip_bytes; i++)
395 "missing verbatim section at beginning of stream\n");
422 int *got_frame_ptr,
AVPacket *avpkt)
424 const uint8_t *buf = avpkt->
data;
425 int buf_size = avpkt->
size;
427 int i, input_buf_size = 0;
446 input_buf_size = buf_size;
463 if (buf_size < s->max_framesize && avpkt->
data) {
465 return input_buf_size;
519 "Increasing block size is not supported\n");
524 "block size: %d\n", blocksize);
540 int residual_size = 0;
554 coffset = s->
offset[channel][0];
558 sum += s->
offset[channel][i];
559 coffset = sum / s->
nmean;
570 residual_size, coffset)) < 0)
590 for (i = -s->
nwrap; i < 0; i++)
630 return input_buf_size;