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
127 for (chan = 0; chan < s->
channels; chan++) {
135 "s->blocksize + s->nwrap too large\n");
147 for (i = 0; i < s->
nwrap; i++)
194 for (chan = 0; chan < s->
channels; chan++)
195 for (i = 0; i < nblock; i++)
196 s->
offset[chan][i] = mean;
209 if (bytestream2_get_le32(&gb) !=
MKTAG(
'R',
'I',
'F',
'F')) {
216 if (bytestream2_get_le32(&gb) !=
MKTAG(
'W',
'A',
'V',
'E')) {
221 while (bytestream2_get_le32(&gb) !=
MKTAG(
'f',
'm',
't',
' ')) {
222 len = bytestream2_get_le32(&gb);
229 len = bytestream2_get_le32(&gb);
236 wave_format = bytestream2_get_le16(&gb);
238 switch (wave_format) {
250 bps = bytestream2_get_le16(&gb);
253 if (bps != 16 && bps != 8) {
273 int residual_size,
int32_t coffset)
275 int pred_order, sum, qshift, init_sum, i, j;
281 if (pred_order > s->
nwrap) {
287 for (i = 0; i < pred_order; i++)
305 if (command ==
FN_QLPC && coffset)
306 for (i = -pred_order; i < 0; i++)
307 s->
decoded[channel][i] -= coffset;
313 for (j = 0; j < pred_order; j++)
314 sum += coeffs[j] * s->
decoded[channel][i - j - 1];
320 if (command ==
FN_QLPC && coffset)
322 s->
decoded[channel][i] += coffset;
363 "invalid or unsupported block size: %d\n",
389 "missing verbatim section at beginning of stream\n");
416 int *got_frame_ptr,
AVPacket *avpkt)
420 int buf_size = avpkt->
size;
422 int i, input_buf_size = 0;
442 input_buf_size = buf_size;
459 if (buf_size < s->max_framesize && avpkt->
data) {
461 return input_buf_size;
522 "Increasing block size is not supported\n");
527 "block size: %d\n", blocksize);
543 int residual_size = 0;
558 coffset = s->
offset[channel][0];
562 sum += s->
offset[channel][i];
563 coffset = sum / s->
nmean;
574 residual_size, coffset)) < 0)
594 for (i = -s->
nwrap; i < 0; i++)
605 int16_t *samples_s16;
613 for (chan = 0; chan < s->
channels; chan++) {
619 *samples_u8++ = av_clip_uint8(s->
decoded[chan][i]);
623 *samples_s16++ = av_clip_int16(s->
decoded[chan][i]);
648 return input_buf_size;