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;
216 if (bytestream2_get_le32(&gb) !=
MKTAG(
'R',
'I',
'F',
'F')) {
223 if (bytestream2_get_le32(&gb) !=
MKTAG(
'W',
'A',
'V',
'E')) {
228 while (bytestream2_get_le32(&gb) !=
MKTAG(
'f',
'm',
't',
' ')) {
229 len = bytestream2_get_le32(&gb);
236 len = bytestream2_get_le32(&gb);
243 wave_format = bytestream2_get_le16(&gb);
245 switch (wave_format) {
257 bps = bytestream2_get_le16(&gb);
260 if (bps != 16 && bps != 8) {
280 int residual_size,
int32_t coffset)
282 int pred_order, sum, qshift, init_sum, i, j;
288 if (pred_order > s->
nwrap) {
294 for (i = 0; i < pred_order; i++)
312 if (command ==
FN_QLPC && coffset)
313 for (i = -pred_order; i < 0; i++)
314 s->
decoded[channel][i] -= coffset;
320 for (j = 0; j < pred_order; j++)
321 sum += coeffs[j] * s->
decoded[channel][i - j - 1];
327 if (command ==
FN_QLPC && coffset)
329 s->
decoded[channel][i] += coffset;
370 "invalid or unsupported block size: %d\n",
396 "missing verbatim section at beginning of stream\n");
423 int *got_frame_ptr,
AVPacket *avpkt)
427 int buf_size = avpkt->
size;
429 int i, input_buf_size = 0;
448 input_buf_size = buf_size;
465 if (buf_size < s->max_framesize && avpkt->
data) {
467 return input_buf_size;
521 "Increasing block size is not supported\n");
526 "block size: %d\n", blocksize);
542 int residual_size = 0;
557 coffset = s->
offset[channel][0];
561 sum += s->
offset[channel][i];
562 coffset = sum / s->
nmean;
573 residual_size, coffset)) < 0)
593 for (i = -s->
nwrap; i < 0; i++)
604 int16_t *samples_s16;
612 for (chan = 0; chan < s->
channels; chan++) {
618 *samples_u8++ = av_clip_uint8(s->
decoded[chan][i]);
622 *samples_s16++ = av_clip_int16(s->
decoded[chan][i]);
647 return input_buf_size;