Lines Matching +full:memcpy +full:- +full:channels

2  * SPDX-License-Identifier: BSD-2-Clause
35 * Split input buffer into channels. The input buffer is in interleaved format,
36 * which means if we have 2 channels (L and R), this is what the buffer of 8
43 uint8_t *in = config->buf; in to_channels()
48 for (byte = 0; byte < config->buffer_info.bytes; in to_channels()
49 byte += config->sample_size) { in to_channels()
54 i = byte / config->sample_size; in to_channels()
57 channel = i % config->audio_info.max_channels; in to_channels()
60 offset = i / config->audio_info.max_channels; in to_channels()
63 index = (channel * config->chsamples + offset) * in to_channels()
64 config->sample_size; in to_channels()
67 memcpy(out+index, in+byte, config->sample_size); in to_channels()
72 * Convert channels into interleaved format and put into output buffer
77 uint8_t *out = config->buf; in to_interleaved()
82 for (byte = 0; byte < config->buffer_info.bytes; in to_interleaved()
83 byte += config->sample_size) { in to_interleaved()
88 index = byte / config->sample_size; in to_interleaved()
91 channel = index / config->chsamples; in to_interleaved()
94 offset = index % config->chsamples; in to_interleaved()
97 i = (config->audio_info.max_channels * offset + channel) * in to_interleaved()
98 config->sample_size; in to_interleaved()
101 memcpy(out+i, in+byte, config->sample_size); in to_interleaved()
114 int32_t *channels; in main() local
119 channels = malloc(bytes); in main()
127 * Strictly speaking, we could omit "channels" and operate only in main()
128 * using config->buf, but this example tries to show the real in main()
134 to_channels(&config, channels); in main()
135 to_interleaved(&config, channels); in main()
142 free(channels); in main()