[flac-dev] [PATCH] doc: specify that quantized LPC shift must be non-negative

2016-01-24 Thread Tristan Matthews
Refs http://sourceforge.net/p/flac/bugs/424/
---
 doc/html/format.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/html/format.html b/doc/html/format.html
index 8598941..4ccd7e7 100644
--- a/doc/html/format.html
+++ b/doc/html/format.html
@@ -1578,7 +1578,8 @@
5


-   Quantized linear predictor coefficient shift 
needed in bits (NOTE: this number is signed two's-complement).
+   Quantized linear predictor coefficient shift 
needed in bits (NOTE: this number is signed two's-complement;
+   but, due to implementation details, must be 
non-negative).



-- 
1.9.1

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


[flac-dev] [PATCH 2/2] microbench: remove duplicate define

2015-09-29 Thread Tristan Matthews
---
 microbench/util.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/microbench/util.c b/microbench/util.c
index 0486590..94d8503 100644
--- a/microbench/util.c
+++ b/microbench/util.c
@@ -97,8 +97,6 @@ benchmark_function (void (*testfunc) (void), unsigned count)
 
 #else
 
-#define _GNU_SOURCE
-
 #include 
 #include 
 
-- 
2.5.3

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


[flac-dev] [PATCH 1/2] microbench: add benchmarking code for Darwin

2015-09-29 Thread Tristan Matthews
---
 microbench/util.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/microbench/util.c b/microbench/util.c
index cf19d23..0486590 100644
--- a/microbench/util.c
+++ b/microbench/util.c
@@ -29,6 +29,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include 
+
 #include 
 #include "util.h"
 
@@ -63,6 +65,36 @@ benchmark_function (void (*testfunc) (void), unsigned count)
return counter_diff (, ) / count ;
 } /* benchmark_function */
 
+#elif defined FLAC__SYS_DARWIN
+
+#include 
+
+static double
+counter_diff (const uint64_t * start, const uint64_t * end)
+{
+   mach_timebase_info_data_t t_info;
+   mach_timebase_info(_info);
+   uint64_t duration = *end - *start;
+
+   return duration * ((double)t_info.numer/(double)t_info.denom);
+}
+
+double
+benchmark_function (void (*testfunc) (void), unsigned count)
+{
+   uint64_t start, end;
+   unsigned k;
+
+   start = mach_absolute_time();
+
+   for (k = 0 ; k < count ; k++)
+   testfunc();
+
+   end = mach_absolute_time();
+
+   return counter_diff (, ) / count ;
+} /* benchmark_function */
+
 #else
 
 #define _GNU_SOURCE
-- 
2.5.3

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


[flac-dev] [PATCH] configure: only use -mstackrealign on mingw32/os2

2015-04-10 Thread Tristan Matthews
And only for i686.
---
 configure.ac | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index eb9b0cc..9751745 100644
--- a/configure.ac
+++ b/configure.ac
@@ -399,11 +399,17 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
 
if test x$asm_optimisation$sse_os = xyesyes ; then
XIPH_ADD_CFLAGS([-msse2])
-   XIPH_ADD_CFLAGS([-mstackrealign])
fi
 
fi
 
+case $host_os in
+   mingw32|os2)
+   if test $host_cpu = i686; then
+   XIPH_ADD_CFLAGS([-mstackrealign])
+   fi
+esac
+
 XIPH_ADD_CFLAGS([-Wextra])
 
 if test x$enable_werror = xyes ; then
-- 
2.1.0

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


[flac-dev] [PATCH] configure: only use -mstackrealign on mingw32/os2

2015-04-10 Thread Tristan Matthews
And only for i686.
---
 configure.ac | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index eb9b0cc..8dd5b0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -399,11 +399,16 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
 
if test x$asm_optimisation$sse_os = xyesyes ; then
XIPH_ADD_CFLAGS([-msse2])
-   XIPH_ADD_CFLAGS([-mstackrealign])
fi
-
fi
 
+case $host_os in
+   mingw32|os2)
+   if test $host_cpu = i686; then
+   XIPH_ADD_CFLAGS([-mstackrealign])
+   fi
+esac
+
 XIPH_ADD_CFLAGS([-Wextra])
 
 if test x$enable_werror = xyes ; then
-- 
2.1.0

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


[flac-dev] [PATCH] configure: only use -mstackrealign for mingw32

2015-04-10 Thread Tristan Matthews
---
 configure.ac | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index eb9b0cc..e7d68c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -399,9 +399,11 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
 
if test x$asm_optimisation$sse_os = xyesyes ; then
XIPH_ADD_CFLAGS([-msse2])
-   XIPH_ADD_CFLAGS([-mstackrealign])
fi
+   fi
 
+if test $host_os = mingw32 ; then
+   XIPH_ADD_CFLAGS([-mstackrealign])
fi
 
 XIPH_ADD_CFLAGS([-Wextra])
-- 
2.1.0

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] crash on lpc_restore_signal_16_intrin_sse2

2015-03-09 Thread Tristan Matthews
On Mon, Mar 9, 2015 at 5:15 PM, lvqcl lvqcl.m...@gmail.com wrote:
 Janne Hyvärinen wrote:

 I compiled flac.exe without NASM and verified that
 FLAC__lpc_restore_signal_16_intrin_sse2 is used. Decoding the same file
 that made VLC 2.2 crash decoded without issues. Would be nice if VLC was
 compilable with MSVC and we could use its debugger.


 VLC 2.2.0 crashes here inside WinXP VM on instruction:

  movaps  xmmword ptr [esp+10h], xmm7

 And ESP is equal to 0x02A8FCC8. The stack is not properly aligned
 for some reason, yet GCC uses movaps instruction.

Sounds a bit like:
http://www.peterstock.co.uk/games/mingw_sse/

Also worth noting, VLC uses yasm but not nasm, so we may be able to
sidestep this problem by adding nasm to our toolchain. That said, it
still seems like other people using MinGW and libFLAC will get bit by
this so I'll keep digging.
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


[flac-dev] [PATCH 1/1] ensure that stack is aligned for SSE functions if using mingw32

2015-03-09 Thread Tristan Matthews
Unable to test on win32 at the moment, please give this a try. Feedback welcome.

Avoids crashes due to unaligned ops when built with mingw.
---
 src/libFLAC/include/private/cpu.h | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/libFLAC/include/private/cpu.h 
b/src/libFLAC/include/private/cpu.h
index 8927897..bd40012 100644
--- a/src/libFLAC/include/private/cpu.h
+++ b/src/libFLAC/include/private/cpu.h
@@ -72,8 +72,13 @@
 #define FLAC__FMA_SUPPORTED 1
   #endif
 #elif defined __GNUC__
+  #ifdef __MINGW32__
+#define FLAC__STACK_ALIGN __attribute__((force_align_arg_pointer))
+  #else
+#define FLAC__STACK_ALIGN
+  #endif /* SSE stack alignment fixups */
   #if (__GNUC__  4 || (__GNUC__ == 4  __GNUC_MINOR__ = 9)) /* since GCC 
4.9 -msse.. compiler options aren't necessary */
-#define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x)))
+#define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x))) 
FLAC__STACK_ALIGN
 #define FLAC__SSE_SUPPORTED 1
 #define FLAC__SSE2_SUPPORTED 1
 #define FLAC__SSSE3_SUPPORTED 1
@@ -82,7 +87,7 @@
 #define FLAC__AVX2_SUPPORTED 1
 #define FLAC__FMA_SUPPORTED 1
   #else /* for GCC older than 4.9 */
-#define FLAC__SSE_TARGET(x)
+#define FLAC__SSE_TARGET(x) FLAC__STACK_ALIGN
 #ifdef __SSE__
   #define FLAC__SSE_SUPPORTED 1
 #endif
-- 
2.1.0

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] ensure that stack is aligned for SSE functions if using mingw32

2015-03-09 Thread Tristan Matthews
On Mon, Mar 9, 2015 at 7:57 PM, Dave Yeo dave.r@gmail.com wrote:
 On 03/09/15 03:59 PM, lvqcl wrote:
 Tristan Matthews wrote:

 Unable to test on win32 at the moment, please give this a try. Feedback 
 welcome.

 I wonder why misaligned stack is a problem only for the FLAC library.
 There are many other libraries inside VLC...

 BTW: FLAC 1.3.1 uses -msse2 option by default. Do you remove it?
 Otherwise libFLAC may crash anywhere else (if its stack is not aligned).

 One workaround is to use -mstackrealign where ever -msse2 is used

Yes, that was one of the options mentioned in the article I linked
(http://www.peterstock.co.uk/games/mingw_sse)
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev