/* * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
static av_cold int factor_init(AVTXContext *s, const FFTXCodelet *cd,
uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, constvoid *scale)
{ int ret;
/* The transformations below are performed in the gather domain, * so override the option and let the infrastructure convert the map
* to SCATTER if needed. */
FFTXCodeletOptions sub_opts = { .map_dir = FF_TX_MAP_GATHER };
TX_TAB(ff_tx_init_tabs)(len);
if (len == 15)
ret = ff_tx_gen_pfa_input_map(s, &sub_opts, 3, 5); else
ret = ff_tx_gen_default_map(s, &sub_opts);
if (ret < 0) return ret;
if (len == 15) { int cnt = 0, tmp[15];
/* Special permutation to simplify loads in the pre-permuted version */
memcpy(tmp, s->map, 15*sizeof(*tmp)); for (int i = 1; i < 15; i += 3) {
s->map[cnt] = tmp[i];
cnt++;
} for (int i = 2; i < 15; i += 3) {
s->map[cnt] = tmp[i];
cnt++;
} for (int i = 0; i < 15; i += 3) {
s->map[cnt] = tmp[i];
cnt++;
}
memmove(&s->map[7], &s->map[6], 4*sizeof(int));
memmove(&s->map[3], &s->map[1], 4*sizeof(int));
s->map[1] = tmp[2];
s->map[2] = tmp[0];
}
return 0;
}
static av_cold int m_inv_init(AVTXContext *s, const FFTXCodelet *cd,
uint64_t flags, FFTXCodeletOptions *opts, int len, int inv, constvoid *scale)
{ int ret;
FFTXCodeletOptions sub_opts = { .map_dir = FF_TX_MAP_GATHER };
flags &= ~FF_TX_OUT_OF_PLACE; /* We want the subtransform to be */
flags |= AV_TX_INPLACE; /* in-place */
flags |= FF_TX_PRESHUFFLE; /* This function handles the permute step */
flags |= FF_TX_ASM_CALL; /* We want an assembly function, not C */
if ((ret = ff_tx_init_subtx(s, TX_TYPE(FFT), flags, &sub_opts, len >> 1,
inv, scale))) return ret;
s->map = av_malloc(len*sizeof(*s->map)); if (!s->map) return AVERROR(ENOMEM);
memcpy(s->map, s->sub->map, (len >> 1)*sizeof(*s->map));
/* Invert lookup table for unstrided path */ for (int i = 0; i < (len >> 1); i++)
s->map[(len >> 1) + s->map[i]] = i;
if ((ret = ff_tx_mdct_gen_exp_float(s, s->map))) return ret;
return 0;
}
static av_cold int fft_pfa_init(AVTXContext *s,
const FFTXCodelet *cd,
uint64_t flags,
FFTXCodeletOptions *opts,
int len, int inv,
const void *scale)
{
int ret;
int sub_len = len / cd->factors[0];
FFTXCodeletOptions sub_opts = { .map_dir = FF_TX_MAP_SCATTER };
flags &= ~FF_TX_OUT_OF_PLACE; /* We want the subtransform to be */
flags |= AV_TX_INPLACE; /* in-place */
flags |= FF_TX_PRESHUFFLE; /* This function handles the permute step */
flags |= FF_TX_ASM_CALL; /* We want an assembly function, not C */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.