History

avutil/avassert: Add av_assertX_fpu()

Michael Niedermayer committed 10 years ago

Commit f5495c91 parent 2c1d38d4 files · +26 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/avassert.h +9 −0
  3. libavutil/utils.c +13 −0
  4. libavutil/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2016-10-22 - xxxxxxx - lavu 55.33.100 - avassert.h
19+ Add av_assert0_fpu() / av_assert2_fpu()
20+
1821 2016-xx-xx - xxxxxxx - lavc 57.61.100 / lavc 57.24.0 - avcodec.h
1922 Decoders now export the frame timestamp as AVFrame.pts. It was
2023 previously exported as AVFrame.pkt_pts, which is now deprecated.
libavutil/avassert.h+9−0
@@ -59,8 +59,17 @@ · 58 unmodified lines
5959 */
6060 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
6161 #define av_assert2(cond) av_assert0(cond)
62+#define av_assert2_fpu() av_assert0_fpu()
6263 #else
6364 #define av_assert2(cond) ((void)0)
65+#define av_assert2_fpu() ((void)0)
6466 #endif
6567
68+/**
69+ * Assert that floating point opperations can be executed.
70+ *
71+ * This will av_assert0() that the cpu is not in MMX state on X86
72+ */
73+void av_assert0_fpu(void);
74+
6675 #endif /* AVUTIL_AVASSERT_H */
libavutil/utils.c+13−0
@@ -125,3 +125,16 @@ AVRational av_get_time_base_q(void) · 124 unmodified lines
125125 {
126126 return (AVRational){1, AV_TIME_BASE};
127127 }
128+
129+void av_assert0_fpu(void) {
130+#if HAVE_MMX_INLINE
131+ uint16_t state[14];
132+ __asm volatile (
133+ "fstenv %0 \n\t"
134+ : "+m" (state)
135+ :
136+ : "memory"
137+ );
138+ av_assert0((state[4] & 3) == 3);
139+#endif
140+}
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
7979 */
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 55
82−#define LIBAVUTIL_VERSION_MINOR 32
82+#define LIBAVUTIL_VERSION_MINOR 33
8383 #define LIBAVUTIL_VERSION_MICRO 100
8484
8585 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

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