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;
515 "Increasing block size is not supported\n");
520 "block size: %d\n", blocksize);
536 int residual_size = 0;
551 coffset = s->
offset[channel][0];
555 sum += s->
offset[channel][i];
556 coffset = sum / s->
nmean;
567 residual_size, coffset)) < 0)
587 for (i = -s->
nwrap; i < 0; i++)
598 int16_t *samples_s16;
606 for (chan = 0; chan < s->
channels; chan++) {
612 *samples_u8++ = av_clip_uint8(s->
decoded[chan][i]);
616 *samples_s16++ = av_clip_int16(s->
decoded[chan][i]);
641 return input_buf_size;