2 * Copyright (c) 2016 Alexandra Hájková
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "libavutil/intreadwrite.h"
25 #include "libavcodec/hevcdsp.h"
29 #define randomize_buffers(buf, size) \
32 for (j = 0; j < size; j++) { \
34 AV_WN16A(buf + j, r); \
38 static void check_idct_dc(HEVCDSPContext h, int bit_depth)
41 LOCAL_ALIGNED(32, int16_t, coeffs0, [32 * 32]);
42 LOCAL_ALIGNED(32, int16_t, coeffs1, [32 * 32]);
44 for (i = 2; i <= 5; i++) {
45 int block_size = 1 << i;
46 int size = block_size * block_size;
47 declare_func_emms(AV_CPU_FLAG_MMXEXT, void, int16_t *coeffs);
49 randomize_buffers(coeffs0, size);
50 memcpy(coeffs1, coeffs0, sizeof(*coeffs0) * size);
52 if (check_func(h.idct_dc[i - 2], "idct_%dx%d_dc_%d", block_size, block_size, bit_depth)) {
55 if (memcmp(coeffs0, coeffs1, sizeof(*coeffs0) * size))
62 void checkasm_check_hevc_idct(void)
66 for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
69 ff_hevc_dsp_init(&h, bit_depth);
70 check_idct_dc(h, bit_depth);