| 243 | } |
| 244 | |
| 245 | static 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 | * |
no test coverage detected