本文整理汇总了C++中FFTContext::mdct_calc方法的典型用法代码示例。如果您正苦于以下问题:C++ FFTContext::mdct_calc方法的具体用法?C++ FFTContext::mdct_calc怎么用?C++ FFTContext::mdct_calc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FFTContext
的用法示例。
在下文中一共展示了FFTContext::mdct_calc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply_window_and_mdct
static int apply_window_and_mdct(AVCodecContext *avctx, const AVFrame *frame)
{
WMACodecContext *s = avctx->priv_data;
float **audio = (float **) frame->extended_data;
int len = frame->nb_samples;
int window_index = s->frame_len_bits - s->block_len_bits;
FFTContext *mdct = &s->mdct_ctx[window_index];
int ch;
const float *win = s->windows[window_index];
int window_len = 1 << s->block_len_bits;
float n = 2.0 * 32768.0 / window_len;
for (ch = 0; ch < avctx->channels; ch++) {
memcpy(s->output, s->frame_out[ch], window_len * sizeof(*s->output));
s->fdsp->vector_fmul_scalar(s->frame_out[ch], audio[ch], n, len);
s->fdsp->vector_fmul_reverse(&s->output[window_len], s->frame_out[ch],
win, len);
s->fdsp->vector_fmul(s->frame_out[ch], s->frame_out[ch], win, len);
mdct->mdct_calc(mdct, s->coefs[ch], s->output);
if (!isfinite(s->coefs[ch][0])) {
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
return AVERROR(EINVAL);
}
}
return 0;
}
示例2: apply_window_and_mdct
static void apply_window_and_mdct(AVCodecContext * avctx, const signed short * audio, int len) {
WMACodecContext *s = avctx->priv_data;
int window_index= s->frame_len_bits - s->block_len_bits;
FFTContext *mdct = &s->mdct_ctx[window_index];
int i, j, channel;
const float * win = s->windows[window_index];
int window_len = 1 << s->block_len_bits;
float n = window_len/2;
for (channel = 0; channel < avctx->channels; channel++) {
memcpy(s->output, s->frame_out[channel], sizeof(float)*window_len);
j = channel;
for (i = 0; i < len; i++, j += avctx->channels){
s->output[i+window_len] = audio[j] / n * win[window_len - i - 1];
s->frame_out[channel][i] = audio[j] / n * win[i];
}
mdct->mdct_calc(mdct, s->coefs[channel], s->output);
}
}
示例3: apply_window_and_mdct
static void apply_window_and_mdct(AVCodecContext * avctx, const AVFrame *frame)
{
WMACodecContext *s = avctx->priv_data;
float **audio = (float **)frame->extended_data;
int len = frame->nb_samples;
int window_index= s->frame_len_bits - s->block_len_bits;
FFTContext *mdct = &s->mdct_ctx[window_index];
int ch;
const float * win = s->windows[window_index];
int window_len = 1 << s->block_len_bits;
float n = 2.0 * 32768.0 / window_len;
for (ch = 0; ch < avctx->channels; ch++) {
memcpy(s->output, s->frame_out[ch], window_len * sizeof(*s->output));
s->fdsp.vector_fmul_scalar(s->frame_out[ch], audio[ch], n, len);
s->dsp.vector_fmul_reverse(&s->output[window_len], s->frame_out[ch], win, len);
s->fdsp.vector_fmul(s->frame_out[ch], s->frame_out[ch], win, len);
mdct->mdct_calc(mdct, s->coefs[ch], s->output);
}
}