MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / encode_chunks

Function encode_chunks

lib/adpcm/adpcm-lib.cpp:245–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245static void encode_chunks (struct adpcm_context *pcnxt, uint8_t **outbuf, size_t *outbufsize, const int16_t **inbuf, int inbufcount)
246{
247 const int16_t *pcmbuf;
248 int chunks, ch, i;
249
250 chunks = (inbufcount - 1) / 8;
251 *outbufsize += (chunks * 4) * pcnxt->num_channels;
252
253 while (chunks--)
254 {
255 for (ch = 0; ch < pcnxt->num_channels; ch++)
256 {
257 pcmbuf = *inbuf + ch;
258
259 for (i = 0; i < 4; i++) {
260 **outbuf = encode_sample (pcnxt, ch, pcmbuf, chunks * 8 + (3 - i) * 2 + 2);
261 pcmbuf += pcnxt->num_channels;
262 **outbuf |= encode_sample (pcnxt, ch, pcmbuf, chunks * 8 + (3 - i) * 2 + 1) << 4;
263 pcmbuf += pcnxt->num_channels;
264 (*outbuf)++;
265 }
266 }
267
268 *inbuf += 8 * pcnxt->num_channels;
269 }
270}
271
272/* Encode a block of 16-bit PCM data into 4-bit ADPCM.
273 *

Callers 1

adpcm_encode_blockFunction · 0.85

Calls 1

encode_sampleFunction · 0.85

Tested by

no test coverage detected