History

cpu: add av_set_cpu_flags_mask().

Anton Khirnov committed 14 years ago

Commit 4d851f81 parent 338978a4 files · +23 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/avutil.h +1 −1
  3. libavutil/cpu.c +11 −1
  4. libavutil/cpu.h +8 −0
doc/APIchanges+3−0
@@ -12,6 +12,9 @@ libavutil: 2011-04-18 · 11 unmodified lines
1212
1313 API changes, most recent first:
1414
15+2012-03-xx - xxxxxxx - lavu 51.25.0 - cpu.h
16+ Add av_set_cpu_flags_mask().
17+
1518 2012-xx-xx - lavc 54.8.0
1619 xxxxxxx Add av_get_exact_bits_per_sample()
1720 xxxxxxx Add av_get_audio_frame_duration()
libavutil/avutil.h+1−1
@@ -152,7 +152,7 @@ · 151 unmodified lines
152152 */
153153
154154 #define LIBAVUTIL_VERSION_MAJOR 51
155−#define LIBAVUTIL_VERSION_MINOR 24
155+#define LIBAVUTIL_VERSION_MINOR 25
156156 #define LIBAVUTIL_VERSION_MICRO 0
157157
158158 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
libavutil/cpu.c+11−1
@@ -19,9 +19,11 @@ · 18 unmodified lines
1919 #include "cpu.h"
2020 #include "config.h"
2121
22+static int cpuflags_mask, checked;
23+
2224 int av_get_cpu_flags(void)
2325 {
24− static int flags, checked;
26+ static int flags;
2527
2628 if (checked)
2729 return flags;
@@ -30,10 +32,18 @@ int av_get_cpu_flags(void) · 2 unmodified lines
3032 if (ARCH_PPC) flags = ff_get_cpu_flags_ppc();
3133 if (ARCH_X86) flags = ff_get_cpu_flags_x86();
3234
35+ flags &= cpuflags_mask;
3336 checked = 1;
37+
3438 return flags;
3539 }
3640
41+void av_set_cpu_flags_mask(int mask)
42+{
43+ cpuflags_mask = mask;
44+ checked = 0;
45+}
46+
3747 #ifdef TEST
3848
3949 #undef printf
libavutil/cpu.h+8−0
@@ -48,6 +48,14 @@ · 47 unmodified lines
4848 */
4949 int av_get_cpu_flags(void);
5050
51+/**
52+ * Set a mask on flags returned by av_get_cpu_flags().
53+ * This function is mainly useful for testing.
54+ *
55+ * @warning this function is not thread safe.
56+ */
57+void av_set_cpu_flags_mask(int mask);
58+
5159 /* The following CPU-specific functions shall not be called directly. */
5260 int ff_get_cpu_flags_arm(void);
5361 int ff_get_cpu_flags_ppc(void);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t