[FFmpeg-devel] [PATCH 1/2] avutil/float_dsp: add avpriv_float_dsp_alloc()

Michael Niedermayer michaelni at gmx.at
Fri Nov 14 14:39:45 CET 2014


TODO: update APIChanges & version

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavutil/float_dsp.c |   11 ++++++++++-
 libavutil/float_dsp.h |    7 +++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c
index 78de1a1..467d7a7 100644
--- a/libavutil/float_dsp.c
+++ b/libavutil/float_dsp.c
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "attributes.h"
 #include "float_dsp.h"
+#include "mem.h"
 
 static void vector_fmul_c(float *dst, const float *src0, const float *src1,
                           int len)
@@ -139,6 +140,15 @@ av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
         ff_float_dsp_init_mips(fdsp);
 }
 
+av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
+{
+    AVFloatDSPContext *ret = av_mallocz(sizeof(AVFloatDSPContext));
+    if (ret)
+        avpriv_float_dsp_init(ret, bit_exact);
+    return ret;
+}
+
+
 #ifdef TEST
 
 #include <float.h>
@@ -158,7 +168,6 @@ av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
 #include "internal.h"
 #include "lfg.h"
 #include "log.h"
-#include "mem.h"
 #include "random_seed.h"
 
 #define LEN 240
diff --git a/libavutil/float_dsp.h b/libavutil/float_dsp.h
index 7fc851b..543f701 100644
--- a/libavutil/float_dsp.h
+++ b/libavutil/float_dsp.h
@@ -185,4 +185,11 @@ void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict);
 void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp);
 void ff_float_dsp_init_mips(AVFloatDSPContext *fdsp);
 
+/**
+ * Allocate a float DSP context.
+ *
+ * @param strict  setting to non-zero avoids using functions which may not be IEEE-754 compliant
+ */
+AVFloatDSPContext *avpriv_float_dsp_alloc(int strict);
+
 #endif /* AVUTIL_FLOAT_DSP_H */
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list