File: ffmpeg_cpu_flags.cc

package info (click to toggle)
blender 4.3.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 309,564 kB
  • sloc: cpp: 2,385,210; python: 330,236; ansic: 280,972; xml: 2,446; sh: 972; javascript: 317; makefile: 170
file content (28 lines) | stat: -rw-r--r-- 742 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* SPDX-FileCopyrightText: 2024 Blender Authors
 *
 * SPDX-License-Identifier: GPL-2.0-or-later */

#include "testing/testing.h"

extern "C" {
#include <libavutil/cpu.h>
}

namespace ffmpeg::tests {

TEST(ffmpeg, correct_av_cpu_flags)
{
  int flags = av_get_cpu_flags();
#if defined(_M_X64) || defined(__x86_64__)
  /* x64 expected to have at least up to SSE4.2. */
  EXPECT_TRUE((flags & AV_CPU_FLAG_SSE2) != 0);
  EXPECT_TRUE((flags & AV_CPU_FLAG_SSE4) != 0);
  EXPECT_TRUE((flags & AV_CPU_FLAG_SSE42) != 0);
#elif defined(__aarch64__) || defined(_M_ARM64)
  /* arm64 expected to have at least NEON. */
  EXPECT_TRUE((flags & AV_CPU_FLAG_ARMV8) != 0);
  EXPECT_TRUE((flags & AV_CPU_FLAG_NEON) != 0);
#endif
}

}  // namespace ffmpeg::tests