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
64 #define V2LPCQOFFSET (1 << LPCQUANT)
72 #define FN_BLOCKSIZE 5
81 #define VERBATIM_CKSIZE_SIZE 5
82 #define VERBATIM_BYTE_SIZE 8
83 #define CANONICAL_HEADER_SIZE 44
133 for (chan = 0; chan < s->
channels; chan++) {
141 "s->blocksize + s->nwrap too large\n");
149 s->
offset[chan] = tmp_ptr;
156 for (i = 0; i < s->
nwrap; i++)
205 for (chan = 0; chan < s->
channels; chan++)
206 for (i = 0; i < nblock; i++)
207 s->
offset[chan][i] = mean;
218 if (bytestream_get_le32(&header) !=
MKTAG(
'R',
'I',
'F',
'F')) {
225 if (bytestream_get_le32(&header) !=
MKTAG(
'W',
'A',
'V',
'E')) {
230 while (bytestream_get_le32(&header) !=
MKTAG(
'f',
'm',
't',
' ')) {
231 len = bytestream_get_le32(&header);
232 if (len<0 || end - header - 8 < len)
236 len = bytestream_get_le32(&header);
243 wave_format = bytestream_get_le16(&header);
245 switch (wave_format) {
257 bps = bytestream_get_le16(&header);
260 if (bps != 16 && bps != 8) {
279 int residual_size,
int32_t coffset)
281 int pred_order, sum, qshift, init_sum, i, j;
287 if (pred_order > s->
nwrap) {
293 for (i = 0; i < pred_order; i++)
306 if (command ==
FN_QLPC && coffset)
307 for (i = -pred_order; i < 0; i++)
308 s->
decoded[channel][i] -= coffset;
314 for (j = 0; j < pred_order; j++)
315 sum += coeffs[j] * s->
decoded[channel][i - j - 1];
321 if (command ==
FN_QLPC && coffset)
323 s->
decoded[channel][i] += coffset;
364 "invalid or unsupported block size: %d\n",
374 for (i = 0; i < skip_bytes; i++)
390 "missing verbatim section at beginning of stream\n");
417 int *got_frame_ptr,
AVPacket *avpkt)
420 int buf_size = avpkt->
size;
422 int i, input_buf_size = 0;
441 input_buf_size = buf_size;
458 if (buf_size < s->max_framesize && avpkt->
data) {
460 return input_buf_size;
514 "Increasing block size is not supported\n");
519 "block size: %d\n", blocksize);
535 int residual_size = 0;
550 coffset = s->
offset[channel][0];
554 sum += s->
offset[channel][i];
555 coffset = sum / s->
nmean;
566 residual_size, coffset)) < 0)
586 for (i = -s->
nwrap; i < 0; i++)
597 int16_t *samples_s16;
607 for (chan = 0; chan < s->
channels; chan++) {
613 *samples_u8++ = av_clip_uint8(s->
decoded[chan][i]);
617 *samples_s16++ = av_clip_int16(s->
decoded[chan][i]);
644 return input_buf_size;