Lines Matching refs:channel
140 static void aptx_encode_channel(Channel *channel, int32_t samples[4], int hd)
144 aptx_qmf_tree_analysis(&channel->qmf, samples, subband_samples);
145 ff_aptx_generate_dither(channel);
147 int32_t diff = av_clip_intp2(subband_samples[subband] - channel->prediction[subband].predicted_sample, 23);
148 aptx_quantize_difference(&channel->quantize[subband], diff,
149 channel->dither[subband],
150 channel->invert_quantize[subband].quantization_factor,
173 static uint16_t aptx_pack_codeword(Channel *channel)
175 int32_t parity = aptx_quantized_parity(channel);
176 return (((channel->quantize[3].quantized_sample & 0x06) | parity) << 13)
177 | (((channel->quantize[2].quantized_sample & 0x03) ) << 11)
178 | (((channel->quantize[1].quantized_sample & 0x0F) ) << 7)
179 | (((channel->quantize[0].quantized_sample & 0x7F) ) << 0);
182 static uint32_t aptxhd_pack_codeword(Channel *channel)
184 int32_t parity = aptx_quantized_parity(channel);
185 return (((channel->quantize[3].quantized_sample & 0x01E) | parity) << 19)
186 | (((channel->quantize[2].quantized_sample & 0x00F) ) << 15)
187 | (((channel->quantize[1].quantized_sample & 0x03F) ) << 9)
188 | (((channel->quantize[0].quantized_sample & 0x1FF) ) << 0);
195 int channel;
196 for (channel = 0; channel < NB_CHANNELS; channel++)
197 aptx_encode_channel(&ctx->channels[channel], samples[channel], ctx->hd);
201 for (channel = 0; channel < NB_CHANNELS; channel++) {
202 ff_aptx_invert_quantize_and_prediction(&ctx->channels[channel], ctx->hd);
204 AV_WB24(output + 3*channel,
205 aptxhd_pack_codeword(&ctx->channels[channel]));
207 AV_WB16(output + 2*channel,
208 aptx_pack_codeword(&ctx->channels[channel]));
216 int pos, ipos, channel, sample, output_size, ret;
228 for (channel = 0; channel < NB_CHANNELS; channel++)
230 samples[channel][sample] = (int32_t)AV_RN32A(&frame->data[channel][4*(ipos+sample)]) >> 8;