Spaces:
Runtime error
Runtime error
/* | |
* This file is part of FFmpeg. | |
* | |
* FFmpeg is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 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 General Public License for more details. | |
* | |
* You should have received a copy of the GNU 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 const int check_lens[] = { | |
2, 4, 8, 16, 32, 64, 120, 960, 1024, 1920, 16384, | |
}; | |
static AVTXContext *tx_refs[AV_TX_NB][2 /* Direction */][FF_ARRAY_ELEMS(check_lens)] = { 0 }; | |
static int init = 0; | |
static void free_tx_refs(void) | |
{ | |
for (int i = 0; i < FF_ARRAY_ELEMS(tx_refs); i++) | |
for (int j = 0; j < FF_ARRAY_ELEMS(*tx_refs); j++) | |
for (int k = 0; k < FF_ARRAY_ELEMS(**tx_refs); k++) | |
av_tx_uninit(&tx_refs[i][j][k]); | |
} | |
void checkasm_check_av_tx(void) | |
{ | |
declare_func(void, AVTXContext *tx, void *out, void *in, ptrdiff_t stride); | |
void *in = av_malloc(16384*2*8); | |
void *out_ref = av_malloc(16384*2*8); | |
void *out_new = av_malloc(16384*2*8); | |
randomize_complex(in, 16384, AVComplexFloat, SCALE_NOOP); | |
CHECK_TEMPLATE("float_fft", AV_TX_FLOAT_FFT, 0, AVComplexFloat, float, check_lens, | |
!float_near_abs_eps_array(out_ref, out_new, EPS, len*2)); | |
CHECK_TEMPLATE("float_imdct", AV_TX_FLOAT_MDCT, 1, float, float, check_lens, | |
!float_near_abs_eps_array(out_ref, out_new, EPS, len)); | |
randomize_complex(in, 16384, AVComplexDouble, SCALE_NOOP); | |
CHECK_TEMPLATE("double_fft", AV_TX_DOUBLE_FFT, 0, AVComplexDouble, double, check_lens, | |
!double_near_abs_eps_array(out_ref, out_new, EPS, len*2)); | |
av_free(in); | |
av_free(out_ref); | |
av_free(out_new); | |
if (!init) { | |
init = 1; | |
atexit(free_tx_refs); | |
} | |
} | |