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
129 for (chan = 0; chan < s->
channels; chan++) {
137 "s->blocksize + s->nwrap too large\n");
145 s->
offset[chan] = tmp_ptr;
152 for (i = 0; i < s->
nwrap; i++)
201 for (chan = 0; chan < s->
channels; chan++)
202 for (i = 0; i < nblock; i++)
203 s->
offset[chan][i] = mean;
214 if (bytestream_get_le32(&header) !=
MKTAG(
'R',
'I',
'F',
'F')) {
221 if (bytestream_get_le32(&header) !=
MKTAG(
'W',
'A',
'V',
'E')) {
226 while (bytestream_get_le32(&header) !=
MKTAG(
'f',
'm',
't',
' ')) {
227 len = bytestream_get_le32(&header);
228 if (len<0 || end - header - 8 < len)
232 len = bytestream_get_le32(&header);
239 wave_format = bytestream_get_le16(&header);
241 switch (wave_format) {
253 bps = bytestream_get_le16(&header);
256 if (bps != 16 && bps != 8) {
275 int residual_size,
int32_t coffset)
277 int pred_order, sum, qshift, init_sum, i, j;
283 if (pred_order > s->
nwrap) {
289 for (i = 0; i < pred_order; i++)
302 if (command ==
FN_QLPC && coffset)
303 for (i = -pred_order; i < 0; i++)
304 s->
decoded[channel][i] -= coffset;
310 for (j = 0; j < pred_order; j++)
311 sum += coeffs[j] * s->
decoded[channel][i - j - 1];
317 if (command ==
FN_QLPC && coffset)
319 s->
decoded[channel][i] += coffset;
360 "invalid or unsupported block size: %d\n",
370 for (i = 0; i < skip_bytes; i++)
386 "missing verbatim section at beginning of stream\n");
413 int *got_frame_ptr,
AVPacket *avpkt)
417 int buf_size = avpkt->
size;
419 int i, input_buf_size = 0;
438 input_buf_size = buf_size;
455 if (buf_size < s->max_framesize && avpkt->
data) {
457 return input_buf_size;
511 "Increasing block size is not supported\n");
516 "block size: %d\n", blocksize);
532 int residual_size = 0;
547 coffset = s->
offset[channel][0];
551 sum += s->
offset[channel][i];
552 coffset = sum / s->
nmean;
563 residual_size, coffset)) < 0)
583 for (i = -s->
nwrap; i < 0; i++)
594 int16_t *samples_s16;
602 for (chan = 0; chan < s->
channels; chan++) {
608 *samples_u8++ = av_clip_uint8(s->
decoded[chan][i]);
612 *samples_s16++ = av_clip_int16(s->
decoded[chan][i]);
637 return input_buf_size;