From 1d06ae03d71587b227b25fc37427e84652af44e1 Mon Sep 17 00:00:00 2001 From: xald Date: Fri, 20 Feb 2015 10:41:16 +0000 Subject: [PATCH] libtta-2.3 --- Makefile.am | 2 +- Makefile.in | 2 +- README | 4 +- config.h | 110 ++++++++ config.h.in | 3 + configure | 30 +-- configure.ac | 4 +- console/Makefile.am | 2 +- console/Makefile.in | 6 +- console/console.sln | 22 ++ console/console.vcproj | 206 --------------- console/console.vcxproj | 102 ++++++++ console/console.vcxproj.filters | 33 +++ console/console.vcxproj.user | 4 + console/tta.c | 26 +- console/tta.h | 16 +- filter.h | 2 +- libtta.c | 13 +- libtta.h | 22 +- libtta.sln | 22 ++ libtta.vcproj | 195 -------------- libtta.vcxproj | 102 ++++++++ libtta.vcxproj.filters | 36 +++ libtta.vcxproj.user | 4 + missing | 449 +++++++++++--------------------- 25 files changed, 668 insertions(+), 749 deletions(-) create mode 100644 config.h create mode 100644 console/console.sln delete mode 100644 console/console.vcproj create mode 100644 console/console.vcxproj create mode 100644 console/console.vcxproj.filters create mode 100644 console/console.vcxproj.user create mode 100644 libtta.sln delete mode 100644 libtta.vcproj create mode 100644 libtta.vcxproj create mode 100644 libtta.vcxproj.filters create mode 100644 libtta.vcxproj.user diff --git a/Makefile.am b/Makefile.am index a1d2040..eaa9a8f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,4 +20,4 @@ console: $(MAKE) $(AM_MAKEFLAGS) SUBDIRS = . console -EXTRA_DIST = config.h Makefile.rm Makefile.mipsel libtta.vcproj +EXTRA_DIST = config.h Makefile.rm Makefile.mipsel libtta.sln libtta.vcxproj* diff --git a/Makefile.in b/Makefile.in index 567571b..62a2440 100644 --- a/Makefile.in +++ b/Makefile.in @@ -364,7 +364,7 @@ libtta_a_SOURCES = libtta.c libtta.h filter.h @CPU_ARM_TRUE@@ENABLE_ASM_TRUE@libtta_a_LIBADD = filter_arm.o DOCLIST = COPYING README SUBDIRS = . console -EXTRA_DIST = config.h Makefile.rm Makefile.mipsel libtta.vcproj +EXTRA_DIST = config.h Makefile.rm Makefile.mipsel libtta.sln libtta.vcxproj* all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/README b/README index 522a672..bb993fd 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -//////////// THE LOSSLESS TRUE AUDIO CODEC ANSI-C LIBRARY V2.2 ////////////// +//////////// THE LOSSLESS TRUE AUDIO CODEC ANSI-C LIBRARY V2.3 ////////////// ///////////////////////////////////////////////////////////////////////////// This package contains a full-futured codec library for realtime encoding and @@ -150,7 +150,7 @@ LM Poh, Scott Watson. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -Copyright (c) 1999-2014 Aleksander Djuric. All rights reserved. +Copyright (c) 1999-2015 Aleksander Djuric. All rights reserved. For the latest in news and downloads, please visit the official True Audio project site: diff --git a/config.h b/config.h new file mode 100644 index 0000000..32db16a --- /dev/null +++ b/config.h @@ -0,0 +1,110 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building for ARM */ +/* #undef CPU_ARM */ + +/* Define if building for MIPS */ +/* #undef CPU_MIPS */ + +/* Define if building for X86 */ +#define CPU_X86 /**/ + +/* Define to enable assembly optimizations */ +/* #undef ENABLE_ASM */ + +/* Define to enable FRW optimization */ +/* #undef ENABLE_FRW */ + +/* Define to use SSE2 instructions */ +#define ENABLE_SSE2 /**/ + +/* Define to use SSE4 instructions */ +/* #undef ENABLE_SSE4 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `lseek64' function. */ +#define HAVE_LSEEK64 1 + +/* Define to 1 if you have the `malloc' function. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `posix_memalign' function. */ +#define HAVE_POSIX_MEMALIGN 1 + +/* Define to 1 if you have the `read' function. */ +#define HAVE_READ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `write' function. */ +#define HAVE_WRITE 1 + +/* Name of package */ +#define PACKAGE "libtta-c" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "info@true-audio.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libtta-c" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libtta-c 2.3" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libtta-c" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.3" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "2.3" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif diff --git a/config.h.in b/config.h.in index f38b532..d6eb56f 100644 --- a/config.h.in +++ b/config.h.in @@ -39,6 +39,9 @@ /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET +/* Define to 1 if you have the `posix_memalign' function. */ +#undef HAVE_POSIX_MEMALIGN + /* Define to 1 if you have the `read' function. */ #undef HAVE_READ diff --git a/configure b/configure index 4726545..fa14116 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libtta 2.2. +# Generated by GNU Autoconf 2.69 for libtta-c 2.3. # # Report bugs to . # @@ -578,10 +578,10 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='libtta' -PACKAGE_TARNAME='libtta' -PACKAGE_VERSION='2.2' -PACKAGE_STRING='libtta 2.2' +PACKAGE_NAME='libtta-c' +PACKAGE_TARNAME='libtta-c' +PACKAGE_VERSION='2.3' +PACKAGE_STRING='libtta-c 2.3' PACKAGE_BUGREPORT='info@true-audio.com' PACKAGE_URL='' @@ -1297,7 +1297,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libtta 2.2 to adapt to many kinds of systems. +\`configure' configures libtta-c 2.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1345,7 +1345,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/libtta] + --docdir=DIR documentation root [DATAROOTDIR/doc/libtta-c] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1368,7 +1368,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libtta 2.2:";; + short | recursive ) echo "Configuration of libtta-c 2.3:";; esac cat <<\_ACEOF @@ -1464,7 +1464,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libtta configure 2.2 +libtta-c configure 2.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1833,7 +1833,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libtta $as_me 2.2, which was +It was created by libtta-c $as_me 2.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2809,8 +2809,8 @@ fi # Define the identity of the package. - PACKAGE='libtta' - VERSION='2.2' + PACKAGE='libtta-c' + VERSION='2.3' cat >>confdefs.h <<_ACEOF @@ -5392,7 +5392,7 @@ $as_echo "$ac_cv_prog_gcc_traditional" >&6; } fi fi -for ac_func in read write malloc memset memcpy lseek64 +for ac_func in read write malloc memset memcpy lseek64 posix_memalign do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -6025,7 +6025,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libtta $as_me 2.2, which was +This file was extended by libtta-c $as_me 2.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6091,7 +6091,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libtta config.status 2.2 +libtta-c config.status 2.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 0bee146..935b02f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libtta], [2.2], [info@true-audio.com]) +AC_INIT([libtta-c], [2.3], [info@true-audio.com]) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([libtta.c]) @@ -47,7 +47,7 @@ AC_C_INLINE # Checks for library functions AC_PROG_GCC_TRADITIONAL -AC_CHECK_FUNCS([read write malloc memset memcpy lseek64]) +AC_CHECK_FUNCS([read write malloc memset memcpy lseek64 posix_memalign]) # Specific optimization features AM_CONDITIONAL(ENABLE_ASM, false) diff --git a/console/Makefile.am b/console/Makefile.am index e770ac3..fea3777 100644 --- a/console/Makefile.am +++ b/console/Makefile.am @@ -6,4 +6,4 @@ tta_SOURCES = tta.c tta.h tta_LDADD = $(top_builddir)/libtta.a -EXTRA_DIST = Makefile.mipsel console.vcproj +EXTRA_DIST = Makefile.mipsel console.sln console.vcxproj* diff --git a/console/Makefile.in b/console/Makefile.in index 47a7540..564911a 100644 --- a/console/Makefile.in +++ b/console/Makefile.in @@ -257,7 +257,7 @@ top_srcdir = @top_srcdir@ AM_CFLAGS = -D_LARGEFILE64_SOURCE tta_SOURCES = tta.c tta.h tta_LDADD = $(top_builddir)/libtta.a -EXTRA_DIST = Makefile.mipsel console.vcproj +EXTRA_DIST = Makefile.mipsel console.sln console.vcxproj* all: all-am .SUFFIXES: @@ -271,9 +271,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign console/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu console/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign console/Makefile + $(AUTOMAKE) --gnu console/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/console/console.sln b/console/console.sln new file mode 100644 index 0000000..be99f5c --- /dev/null +++ b/console/console.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "console", "console.vcxproj", "{66695377-9DFB-4792-A97C-C42C03DE910A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {66695377-9DFB-4792-A97C-C42C03DE910A}.Debug|Win32.ActiveCfg = Debug|Win32 + {66695377-9DFB-4792-A97C-C42C03DE910A}.Debug|Win32.Build.0 = Debug|Win32 + {66695377-9DFB-4792-A97C-C42C03DE910A}.Release|Win32.ActiveCfg = Release|Win32 + {66695377-9DFB-4792-A97C-C42C03DE910A}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/console/console.vcproj b/console/console.vcproj deleted file mode 100644 index 0c49254..0000000 --- a/console/console.vcproj +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/console/console.vcxproj b/console/console.vcxproj new file mode 100644 index 0000000..ee4cdcc --- /dev/null +++ b/console/console.vcxproj @@ -0,0 +1,102 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {66695377-9DFB-4792-A97C-C42C03DE910A} + sample + ManagedCProj + tta + + + + Application + v120 + Unicode + false + true + + + Application + v120 + Unicode + false + + + + + + + + + + + + + <_ProjectFileVersion>12.0.21005.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + tta + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + + + /NODEFAULTLIB:LIBCMT.lib %(AdditionalOptions) + ../$(IntDir)libtta.lib;%(AdditionalDependencies) + true + true + MachineX86 + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;%(PreprocessorDefinitions) + + StreamingSIMDExtensions2 + CompileAsC + + + ../$(IntDir)libtta.lib;%(AdditionalDependencies) + $(OutDir)tta.exe + UseLinkTimeCodeGeneration + MachineX86 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/console/console.vcxproj.filters b/console/console.vcxproj.filters new file mode 100644 index 0000000..ee24fc0 --- /dev/null +++ b/console/console.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/console/console.vcxproj.user b/console/console.vcxproj.user new file mode 100644 index 0000000..ef5ff2a --- /dev/null +++ b/console/console.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/console/tta.c b/console/tta.c index 985fcc9..f373622 100644 --- a/console/tta.c +++ b/console/tta.c @@ -2,7 +2,7 @@ * tta.c * * Description: TTA simple console frontend - * Copyright (c) 1999-2014 Aleksander Djuric. All rights reserved. + * Copyright (c) 1999-2015 Aleksander Djuric. All rights reserved. * Distributed under the GNU Lesser General Public License (LGPL). * The complete text of the license can be found in the COPYING * file included in the distribution. @@ -167,7 +167,7 @@ TTAuint8 *convert_password(const TTAwchar *src, int *len) { TTAuint8 *dst; int n; - dst = tta_malloc(*len + 1); + dst = (TTAuint8*) tta_malloc(*len + 1); if (dst == NULL) return NULL; for (n = 0; n != *len; ++n) { @@ -194,7 +194,7 @@ TTAuint8 *convert_password(const TTAwchar *src, int *len) { TTAuint8 *dst; int i, n; - dst = tta_malloc(*len * 6 + 1); + dst = (TTAuint8*) tta_malloc(*len * 6 + 1); if (dst == NULL) return NULL; for (i = 0, n = 0; i != *len; ++i) { @@ -308,6 +308,17 @@ int compress(HANDLE infile, HANDLE outfile, HANDLE tmpfile, void const *passwd, return -1; } + // check for supported formats + if ((wave_hdr.chunk_id != RIFF_SIGN) || + (wave_hdr.format != WAVE_SIGN) || + (wave_hdr.num_channels == 0) || + (wave_hdr.num_channels > MAX_NCH) || + (wave_hdr.bits_per_sample == 0) || + (wave_hdr.bits_per_sample > MAX_BPS)) { + tta_strerror(TTA_FORMAT_ERROR); + return -1; + } + tta_encoder_new((TTA_io_callback *) &io); smp_size = (wave_hdr.num_channels * ((wave_hdr.bits_per_sample + 7) / 8)); @@ -353,6 +364,8 @@ int compress(HANDLE infile, HANDLE outfile, HANDLE tmpfile, void const *passwd, } while (data_size > 0) { + buf_size = (buf_size < data_size) ? buf_size : data_size; + if (!tta_read(infile, buffer, buf_size, len) || !len){ tta_strerror(TTA_READ_ERROR); goto done; @@ -373,7 +386,7 @@ int compress(HANDLE infile, HANDLE outfile, HANDLE tmpfile, void const *passwd, done: tta_encoder_done(); - if (buffer) free(buffer); + if (buffer) tta_free(buffer); return ret; } // compress @@ -453,7 +466,7 @@ int decompress(HANDLE infile, HANDLE outfile, void const *passwd, int pwlen) { done: tta_decoder_done(); - if (buffer) free(buffer); + if (buffer) tta_free(buffer); return ret; } // decompress @@ -593,9 +606,8 @@ int tta_main(int argc, TTAwchar **argv) { } done: - if (pwstr) free(pwstr); + if (pwstr) tta_free(pwstr); return ret; } /* eof */ - diff --git a/console/tta.h b/console/tta.h index 4190f0a..abc191b 100644 --- a/console/tta.h +++ b/console/tta.h @@ -2,7 +2,7 @@ * tta.h * * Description: TTA general portability definitions - * Copyright (c) 1999-2014 Aleksander Djuric. All rights reserved. + * Copyright (c) 1999-2015 Aleksander Djuric. All rights reserved. * Distributed under the GNU Lesser General Public License (LGPL). * The complete text of the license can be found in the COPYING * file included in the distribution. @@ -24,8 +24,10 @@ #include #include #include +#include #include #else // MSVC +#include #include #include #endif @@ -55,6 +57,7 @@ typedef RMfile (HANDLE); #define tta_memclear(__dest,__length) RMMemset(__dest,0,__length) #define tta_memcpy(__dest,__source,__length) RMMemcpy(__dest,__source,__length) #define tta_malloc RMMalloc +#define tta_free RMFree #else // NOT CARIBBEAN typedef int (HANDLE); #define INVALID_HANDLE_VALUE (-1) @@ -62,6 +65,11 @@ typedef int (HANDLE); (defined(__APPLE__) && defined(__MACH__)) #define lseek64 lseek #endif +#ifndef aligned_alloc +#define aligned_alloc(__alignment,__length) ({ \ + void *ptr; \ + (posix_memalign(&ptr,__alignment,__length)) ? NULL : ptr; }) +#endif #define tta_open_read(__name) open(__name,O_RDONLY|O_NONBLOCK) #define tta_open_write(__name) open(__name,O_RDWR|O_TRUNC|O_CREAT,S_IRUSR|S_IWUSR) #define tta_close(__handle) close(__handle) @@ -72,7 +80,8 @@ typedef int (HANDLE); #define tta_reset(__handle) lseek64(__handle,0,SEEK_SET) #define tta_memclear(__dest,__length) memset(__dest,0,__length) #define tta_memcpy(__dest,__source,__length) memcpy(__dest,__source,__length) -#define tta_malloc malloc +#define tta_malloc(__length) aligned_alloc(16,__length) +#define tta_free free #define tta_cpuid(func,ax,bx,cx,dx) \ __asm__ __volatile__ ("cpuid": \ @@ -98,7 +107,8 @@ typedef wchar_t (TTAwchar); #define tta_reset(__handle) SetFilePointer(__handle,0,0,FILE_BEGIN) #define tta_memclear(__dest,__length) ZeroMemory(__dest,__length) #define tta_memcpy(__dest,__source,__length) CopyMemory(__dest,__source,__length) -#define tta_malloc malloc +#define tta_malloc(__length) _aligned_malloc(__length, 16) +#define tta_free(__dest) _aligned_free(__dest) #define tta_cpuid(func,ax,bx,cx,dx) { \ int cpuid[4]; \ diff --git a/filter.h b/filter.h index cfe1b63..f2d6e80 100644 --- a/filter.h +++ b/filter.h @@ -2,7 +2,7 @@ * filter.h * * Description: TTA hybrid filter functions - * Copyright (c) 1999-2014 Aleksander Djuric. All rights reserved. + * Copyright (c) 1999-2015 Aleksander Djuric. All rights reserved. * SSE4 optimization copyright (c) 2008 Kazuki Oikawa * Distributed under the GNU Lesser General Public License (LGPL). * The complete text of the license can be found in the COPYING diff --git a/libtta.c b/libtta.c index 67d533c..689475d 100644 --- a/libtta.c +++ b/libtta.c @@ -2,7 +2,7 @@ * libtta.c * * Description: TTA1 c-library functions - * Copyright (c) 1999-2014 Aleksander Djuric. All rights reserved. + * Copyright (c) 1999-2015 Aleksander Djuric. All rights reserved. * Distributed under the GNU Lesser General Public License (LGPL). * The complete text of the license can be found in the COPYING * file included in the distribution. @@ -23,16 +23,21 @@ #define tta_malloc RMMalloc #define tta_free RMFree #else // GNUC +#ifndef aligned_alloc +#define aligned_alloc(__alignment,__length) ({ \ + void *ptr; \ + (posix_memalign(&ptr,__alignment,__length)) ? NULL : ptr; }) +#endif #define tta_memclear(__dest,__length) memset(__dest,0,__length) #define tta_memcpy(__dest,__source,__length) memcpy(__dest,__source,__length) -#define tta_malloc malloc +#define tta_malloc(__length) aligned_alloc(16,__length) #define tta_free free #endif #else // MSVC #define tta_memclear(__dest,__length) ZeroMemory(__dest,__length) #define tta_memcpy(__dest,__source,__length) CopyMemory(__dest,__source,__length) -#define tta_malloc(__length) GlobalAlloc(GMEM_ZEROINIT,__length) -#define tta_free(__dest) GlobalFree(__dest) +#define tta_malloc(__length) _aligned_malloc(__length, 16) +#define tta_free(__dest) _aligned_free(__dest) #endif //////////////////////// constants and definitions ////////////////////////// diff --git a/libtta.h b/libtta.h index 93cb5e6..1b13b6f 100644 --- a/libtta.h +++ b/libtta.h @@ -2,7 +2,7 @@ * libtta.h * * Description: TTA1-C library interface - * Copyright (c) 1999-2014 Aleksander Djuric. All rights reserved. + * Copyright (c) 1999-2015 Aleksander Djuric. All rights reserved. * Distributed under the GNU Lesser General Public License (LGPL). * The complete text of the license can be found in the COPYING * file included in the distribution. @@ -16,8 +16,8 @@ #include #include #include +#include #include -#include #ifdef CARIBBEAN #define ALLOW_OS_CODE 1 @@ -113,26 +113,20 @@ typedef enum { #define TTA_FORMAT_SIMPLE 1 #define TTA_FORMAT_ENCRYPTED 2 -typedef struct _tag_TTA_io_callback { - TTAint32 (CALLBACK *read)(struct _tag_TTA_io_callback *, TTAuint8 *, TTAuint32); - TTAint32 (CALLBACK *write)(struct _tag_TTA_io_callback *, TTAuint8 *, TTAuint32); - TTAint64 (CALLBACK *seek)(struct _tag_TTA_io_callback *, TTAint64 offset); -} TTA_io_callback; - typedef struct { TTAuint32 format; // audio format TTAuint32 nch; // number of channels TTAuint32 bps; // bits per sample TTAuint32 sps; // samplerate (sps) TTAuint32 samples; // data length in samples -} TTA_info; +} TTA_ALIGNED(16) TTA_info; typedef struct { TTAuint32 k0; TTAuint32 k1; TTAuint32 sum0; TTAuint32 sum1; -} TTA_adapt; +} TTA_ALIGNED(16) TTA_adapt; typedef struct { TTAint32 index; @@ -148,7 +142,13 @@ typedef struct { TTA_fltst fst; TTA_adapt rice; TTAint32 prev; -} TTA_codec; +} TTA_ALIGNED(16) TTA_codec; + +typedef struct _tag_TTA_io_callback { + TTAint32(CALLBACK *read)(struct _tag_TTA_io_callback *, TTAuint8 *, TTAuint32); + TTAint32(CALLBACK *write)(struct _tag_TTA_io_callback *, TTAuint8 *, TTAuint32); + TTAint64(CALLBACK *seek)(struct _tag_TTA_io_callback *, TTAint64 offset); +} TTA_ALIGNED(16) TTA_io_callback; // progress callback typedef void (CALLBACK *TTA_CALLBACK)(TTAuint32, TTAuint32, TTAuint32); diff --git a/libtta.sln b/libtta.sln new file mode 100644 index 0000000..4a2c3d5 --- /dev/null +++ b/libtta.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtta", "libtta.vcxproj", "{B3DF599C-1C8F-451D-91E4-DD766210DA1F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B3DF599C-1C8F-451D-91E4-DD766210DA1F}.Debug|Win32.ActiveCfg = Debug|Win32 + {B3DF599C-1C8F-451D-91E4-DD766210DA1F}.Debug|Win32.Build.0 = Debug|Win32 + {B3DF599C-1C8F-451D-91E4-DD766210DA1F}.Release|Win32.ActiveCfg = Release|Win32 + {B3DF599C-1C8F-451D-91E4-DD766210DA1F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libtta.vcproj b/libtta.vcproj deleted file mode 100644 index 39a472d..0000000 --- a/libtta.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libtta.vcxproj b/libtta.vcxproj new file mode 100644 index 0000000..3277081 --- /dev/null +++ b/libtta.vcxproj @@ -0,0 +1,102 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {B3DF599C-1C8F-451D-91E4-DD766210DA1F} + libtta + ManagedCProj + + + + StaticLibrary + v120 + MultiByte + false + false + + + StaticLibrary + v120 + MultiByte + false + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.21005.1 + + + Debug\ + Debug\ + + + Release\ + Release\ + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + Cdecl + NotSet + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + WIN32;NDEBUG;%(PreprocessorDefinitions) + + StreamingSIMDExtensions2 + + CompileAsC + + + /LTCG %(AdditionalOptions) + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libtta.vcxproj.filters b/libtta.vcxproj.filters new file mode 100644 index 0000000..7615b37 --- /dev/null +++ b/libtta.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {d6375cda-f917-4016-a3c7-fdeff3692382} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {fa1f227e-5d22-48f3-b192-d05ebfdd0dae} + h;hpp;hxx;hm;inl;inc + + + + + Source Files + + + + + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libtta.vcxproj.user b/libtta.vcxproj.user new file mode 100644 index 0000000..ef5ff2a --- /dev/null +++ b/libtta.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/missing b/missing index 894e786..cdea514 100755 --- a/missing +++ b/missing @@ -1,11 +1,10 @@ #! /bin/sh -# Common stub for a few missing GNU programs while installing. +# Common wrapper for a few potentially missing GNU programs. -scriptversion=2005-06-08.21 +scriptversion=2012-06-26.16; # UTC -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,9 +17,7 @@ scriptversion=2005-06-08.21 # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -28,63 +25,40 @@ scriptversion=2005-06-08.21 # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" + echo 1>&2 "Try '$0 --help' for more information" exit 1 fi -run=: +case $1 in -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. Send bug reports to ." exit $? @@ -96,265 +70,146 @@ Send bug reports to ." ;; -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=http://www.perl.org/ +flex_URL=http://flex.sourceforge.net/ +gnu_software_URL=http://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'automa4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: