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
60 #define V2LPCQOFFSET (1 << LPCQUANT)
68 #define FN_BLOCKSIZE 5
77 #define VERBATIM_CKSIZE_SIZE 5
78 #define VERBATIM_BYTE_SIZE 8
79 #define CANONICAL_HEADER_SIZE 44
124 for (chan = 0; chan < s->
channels; chan++) {
132 "s->blocksize + s->nwrap too large\n");
144 for (i = 0; i < s->
nwrap; i++)
187 for (chan = 0; chan < s->
channels; chan++)
188 for (i = 0; i < nblock; i++)
189 s->
offset[chan][i] = mean;
202 if (bytestream2_get_le32(&gb) !=
MKTAG(
'R',
'I',
'F',
'F')) {
209 if (bytestream2_get_le32(&gb) !=
MKTAG(
'W',
'A',
'V',
'E')) {
214 while (bytestream2_get_le32(&gb) !=
MKTAG(
'f',
'm',
't',
' ')) {
215 len = bytestream2_get_le32(&gb);
222 len = bytestream2_get_le32(&gb);
229 wave_format = bytestream2_get_le16(&gb);
231 switch (wave_format) {
261 for (ch = 0; ch < nchan; ch++) {
263 int16_t *
out = samples[ch];
264 for (i = 0; i < blocksize; i++)
265 out[i] = av_clip_int16(in[i]);
277 int residual_size,
int32_t coffset)
279 int pred_order, sum, qshift, init_sum, i, j;
285 if (pred_order > s->
nwrap) {
291 for (i = 0; i < pred_order; i++)
298 pred_order = command;
309 if (command ==
FN_QLPC && coffset)
310 for (i = -pred_order; i < 0; i++)
311 s->
decoded[channel][i] -= coffset;
317 for (j = 0; j < pred_order; j++)
318 sum += coeffs[j] * s->
decoded[channel][i - j - 1];
324 if (command ==
FN_QLPC && coffset)
326 s->
decoded[channel][i] += coffset;
367 "invalid or unsupported block size: %d\n",
393 "missing verbatim section at beginning of stream\n");
420 int *got_frame_ptr,
AVPacket *avpkt)
424 int buf_size = avpkt->
size;
426 int i, input_buf_size = 0;
445 input_buf_size = buf_size;
462 if (buf_size < s->max_framesize && avpkt->
data) {
464 return input_buf_size;
518 "Increasing block size is not supported\n");
523 "block size: %d\n", blocksize);
539 int residual_size = 0;
554 coffset = s->
offset[channel][0];
558 sum += s->
offset[channel][i];
559 coffset = sum / s->
nmean;
570 residual_size, coffset)) < 0)
590 for (i = -s->
nwrap; i < 0; i++)
629 return input_buf_size;