Commit 736f90d8 authored by Alexandre Julliard's avatar Alexandre Julliard

mpg123: Import upstream release 1.32.2.

parent c5476595
......@@ -30,6 +30,8 @@ The creator: Michael Hipp (email: hippm@informatik.uni-tuebingen.de - please bot
Contributions/ideas Thomas Orgis era (includes backports from mhipp trunk):
Dave Yeo <dave.r.yeo@gmail.com>: continued OS/2 fixing
madebr and manx: github mirror and CI
Vitaly Kirsanov <krokoziabla@gmail.com>: ports/cmake (optional CMake build)
Won-Kyu Park <wkpark@gmail.com>: patch to get rid of asm textrels (x86 PIC)
Michael Weiser <michaelweiser@users.sf.net>: update of coreaudio output to AudioComponents API
......
......@@ -17,6 +17,7 @@ C_SRCS = \
src/libmpg123/layer1.c \
src/libmpg123/layer2.c \
src/libmpg123/layer3.c \
src/libmpg123/lfs_wrap.c \
src/libmpg123/libmpg123.c \
src/libmpg123/ntom.c \
src/libmpg123/optimize.c \
......
......@@ -20,10 +20,6 @@
/* Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. */
/* #undef ASMALIGN_EXP */
/* No suffixed symbols for large file support (only alias for backwards
compat.) */
#define BUILD_NO_LARGENAME 1
/* Define if __attribute__((aligned(16))) shall be used */
#define CCALIGN 1
......@@ -84,6 +80,9 @@
/* Define to 1 if you have the <byteswap.h> header file. */
/* #undef HAVE_BYTESWAP_H */
/* Define to 1 if you have the `clock_gettime' function. */
/* #undef HAVE_CLOCK_GETTIME */
/* Define to 1 if you have the <CoreServices/CoreServices.h> header file. */
/* #undef HAVE_CORESERVICES_CORESERVICES_H */
......@@ -144,15 +143,15 @@
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define to 1 if you have the `lseek64' function. */
/* #undef HAVE_LSEEK64 */
/* Define to 1 if you have the <machine/soundcard.h> header file. */
/* #undef HAVE_MACHINE_SOUNDCARD_H */
/* Define to 1 if you have the `mbstowcs' function. */
#define HAVE_MBSTOWCS 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkfifo' function. */
/* #undef HAVE_MKFIFO */
......@@ -183,6 +182,9 @@
/* Define to 1 if you have the <os2.h> header file. */
/* #undef HAVE_OS2_H */
/* Define if O_LARGEFILE flag for open(2) exists. */
/* #undef HAVE_O_LARGEFILE */
/* Define to 1 if you have the `random' function. */
/* #undef HAVE_RANDOM */
......@@ -234,6 +236,9 @@
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strerror_l' function. */
/* #undef HAVE_STRERROR_L */
/* Define to 1 if you have the <strings.h> header file. */
/* #undef HAVE_STRINGS_H 1 */
......@@ -297,6 +302,9 @@
/* Define to 1 if you have the `unsetenv' function. */
/* #undef HAVE_UNSETENV */
/* Define to 1 if you have the `uselocale' function. */
/* #undef HAVE_USELOCALE */
/* Define to 1 if you have the <wchar.h> header file. */
#define HAVE_WCHAR_H 1
......@@ -330,9 +338,11 @@
/* Define if IPV6 support is enabled. */
#define IPV6 1
/* Define this to the size of native offset type in bits, used for LFS alias
functions. */
#define LFS_ALIAS_BITS 32
/* Define if we use _LARGEFILE64_SOURCE with off64_t and lseek64. */
/* #undef LFS_LARGEFILE_64 */
/* System redefines off_t when defining _FILE_OFFSET_BITS to 64. */
/* #undef LFS_SENSITIVE */
/* Define to the extension used for runtime loadable modules, say, ".so". */
#define LT_MODULE_EXT ".dll"
......@@ -429,7 +439,7 @@
#define PACKAGE_NAME "mpg123"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "mpg123 1.31.1"
#define PACKAGE_STRING "mpg123 1.32.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "mpg123"
......@@ -438,7 +448,10 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.31.1"
#define PACKAGE_VERSION "1.32.2"
/* Define to only include portable library API (no off_t, no internal I/O). */
/* #undef PORTABLE_API */
/* Define if portaudio v18 API is wanted. */
/* #undef PORTAUDIO18 */
......@@ -452,11 +465,8 @@
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of `off64_t', as computed by sizeof. */
#define SIZEOF_OFF64_T 8
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 8
#define SIZEOF_OFF_T 4
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
......@@ -464,7 +474,9 @@
/* The size of `ssize_t', as computed by sizeof. */
#define SIZEOF_SSIZE_T 4
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#define STDC_HEADERS 1
/* Define to not duplicate some code for likely cases in libsyn123. */
......@@ -480,7 +492,7 @@
/* #undef USE_YASM_FOR_AVX */
/* Version number of package */
#define VERSION "1.31.1"
#define VERSION "1.32.2"
/* Define to use Win32 named pipes */
#define WANT_WIN32_FIFO 1
......@@ -512,17 +524,6 @@
/* Define for extreme debugging. */
/* #undef XDEBUG */
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Windows Vista and later APIs */
/* #undef _WIN32_WINNT */
......@@ -544,11 +545,8 @@
/* Define to `long long' if <sys/types.h> does not define. */
/* #undef int64_t */
/* Define to the native offset type (long or actually off_t). */
#define lfs_alias_t long
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `long' if <sys/types.h> does not define. */
/* #undef ptrdiff_t */
/* Define to `unsigned long' if <sys/types.h> does not define. */
/* #undef size_t */
......
......@@ -4,7 +4,7 @@
The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX.
So anything possibly somewhat advanced should be considered to be put here, with proper #ifdef;-)
copyright 2007-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, Windows Unicode stuff by JonY.
*/
......@@ -43,23 +43,23 @@
#ifndef WINDOWS_UWP
char *compat_getenv(const char* name)
char *INT123_compat_getenv(const char* name)
{
char *ret = NULL;
#ifdef WANT_WIN32_UNICODE
wchar_t *env;
wchar_t *wname = NULL;
if(win32_utf8_wide(name, &wname, NULL) > 0)
if(INT123_win32_utf8_wide(name, &wname, NULL) > 0)
{
env = _wgetenv(wname);
free(wname);
if(env)
win32_wide_utf8(env, &ret, NULL);
INT123_win32_wide_utf8(env, &ret, NULL);
}
#else
ret = getenv(name);
if(ret)
ret = compat_strdup(ret);
ret = INT123_compat_strdup(ret);
#endif
return ret;
}
......@@ -69,7 +69,7 @@ char *compat_getenv(const char* name)
#include "wpathconv.h"
/* Always add a default permission mask in case of flags|O_CREAT. */
int compat_open(const char *filename, int flags)
int INT123_compat_open(const char *filename, int flags)
{
int ret;
#if defined (WANT_WIN32_UNICODE)
......@@ -105,8 +105,8 @@ open_ok:
}
/* Moved over from wav.c, logic with fallbacks added from the
example of compat_open(). */
FILE* compat_fopen(const char *filename, const char *mode)
example of INT123_compat_open(). */
FILE* INT123_compat_fopen(const char *filename, const char *mode)
{
FILE* stream = NULL;
#ifdef WANT_WIN32_UNICODE
......@@ -117,7 +117,7 @@ FILE* compat_fopen(const char *filename, const char *mode)
wname = u2wlongpath(filename);
if(!wname)
goto fopen_fallback;
cnt = win32_utf8_wide(mode, &wmode, NULL);
cnt = INT123_win32_utf8_wide(mode, &wmode, NULL);
if( (wmode == NULL) || (cnt == 0))
goto fopen_fallback;
......@@ -136,12 +136,12 @@ fopen_ok:
return stream;
}
FILE* compat_fdopen(int fd, const char *mode)
FILE* INT123_compat_fdopen(int fd, const char *mode)
{
return fdopen(fd, mode);
}
int compat_close(int infd)
int INT123_compat_close(int infd)
{
#if (defined(WIN32) && !defined (__CYGWIN__)) /* MSDN says POSIX function is deprecated beginning in Visual C++ 2005 */
return _close(infd);
......@@ -150,12 +150,12 @@ int compat_close(int infd)
#endif
}
int compat_fclose(FILE *stream)
int INT123_compat_fclose(FILE *stream)
{
return fclose(stream);
}
void compat_binmode(int fd, int enable)
void INT123_compat_binmode(int fd, int enable)
{
#if defined(HAVE__SETMODE)
_setmode(fd, enable ? _O_BINARY : _O_TEXT);
......@@ -179,7 +179,11 @@ void compat_binmode(int fd, int enable)
it late to some official APIs, that's still fine with us.
*/
char* compat_catpath(const char *prefix, const char* path)
#ifdef WANT_WIN32_UNICODE
typedef HRESULT (__stdcall *PCA_ptr)( const wchar_t *, const wchar_t*, unsigned long, wchar_t **);
#endif
char* INT123_compat_catpath(const char *prefix, const char* path)
{
char *ret = NULL;
#ifdef WANT_WIN32_UNICODE
......@@ -193,8 +197,7 @@ char* compat_catpath(const char *prefix, const char* path)
ThOr: I presume this hack is for supporting pre-8 Windows, as
from Windows 8 on, this is documented in the API.
*/
HRESULT (__stdcall *mypac)( const wchar_t *in, const wchar_t* more
, unsigned long flags, wchar_t **out ) = NULL;
PCA_ptr mypac = NULL;
HMODULE pathcch = NULL;
if(!prefix && !path)
......@@ -207,7 +210,7 @@ char* compat_catpath(const char *prefix, const char* path)
/* Again: I presume this whole fun is to get at PathAllocCombine
even when pathcch.h is not available (like in MinGW32). */
if( (pathcch = GetModuleHandleA("kernelbase")) )
mypac = (void *)GetProcAddress(pathcch, "PathAllocCombine");
mypac = (PCA_ptr) GetProcAddress(pathcch, "PathAllocCombine");
if(mypac) /* PATHCCH_ALLOW_LONG_PATH = 1 per API docs */
{
debug("Actually calling PathAllocCombine!");
......@@ -250,7 +253,7 @@ catpath_end:
return ret;
}
int compat_isdir(const char *path)
int INT123_compat_isdir(const char *path)
{
int ret = 0;
#ifdef WANT_WIN32_UNICODE
......@@ -286,7 +289,7 @@ struct compat_dir
#endif
};
struct compat_dir* compat_diropen(char *path)
struct compat_dir* INT123_compat_diropen(char *path)
{
struct compat_dir *cd;
if(!path)
......@@ -299,7 +302,7 @@ struct compat_dir* compat_diropen(char *path)
{
char *pattern;
wchar_t *wpattern;
pattern = compat_catpath(path, "*");
pattern = INT123_compat_catpath(path, "*");
wpattern = u2wlongpath(pattern);
if(wpattern)
{
......@@ -326,17 +329,17 @@ struct compat_dir* compat_diropen(char *path)
#endif
if(cd)
{
cd->path = compat_strdup(path);
cd->path = INT123_compat_strdup(path);
if(!cd->path)
{
compat_dirclose(cd);
INT123_compat_dirclose(cd);
cd = NULL;
}
}
return cd;
}
void compat_dirclose(struct compat_dir *cd)
void INT123_compat_dirclose(struct compat_dir *cd)
{
if(cd)
{
......@@ -350,7 +353,7 @@ void compat_dirclose(struct compat_dir *cd)
}
}
char* compat_nextfile(struct compat_dir *cd)
char* INT123_compat_nextfile(struct compat_dir *cd)
{
if(!cd)
return NULL;
......@@ -361,7 +364,7 @@ char* compat_nextfile(struct compat_dir *cd)
if(!(cd->d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
char *ret;
win32_wide_utf8(cd->d.cFileName, &ret, NULL);
INT123_win32_wide_utf8(cd->d.cFileName, &ret, NULL);
return ret;
}
}
......@@ -371,11 +374,11 @@ char* compat_nextfile(struct compat_dir *cd)
while((dp = readdir(cd->dir)))
{
struct stat fst;
char *fullpath = compat_catpath(cd->path, dp->d_name);
char *fullpath = INT123_compat_catpath(cd->path, dp->d_name);
if(fullpath && !stat(fullpath, &fst) && S_ISREG(fst.st_mode))
{
free(fullpath);
return compat_strdup(dp->d_name);
return INT123_compat_strdup(dp->d_name);
}
free(fullpath);
}
......@@ -384,7 +387,7 @@ char* compat_nextfile(struct compat_dir *cd)
return NULL;
}
char* compat_nextdir(struct compat_dir *cd)
char* INT123_compat_nextdir(struct compat_dir *cd)
{
if(!cd)
return NULL;
......@@ -395,7 +398,7 @@ char* compat_nextdir(struct compat_dir *cd)
if(cd->d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
char *ret;
win32_wide_utf8(cd->d.cFileName, &ret, NULL);
INT123_win32_wide_utf8(cd->d.cFileName, &ret, NULL);
return ret;
}
}
......@@ -405,11 +408,11 @@ char* compat_nextdir(struct compat_dir *cd)
while((dp = readdir(cd->dir)))
{
struct stat fst;
char *fullpath = compat_catpath(cd->path, dp->d_name);
char *fullpath = INT123_compat_catpath(cd->path, dp->d_name);
if(fullpath && !stat(fullpath, &fst) && S_ISDIR(fst.st_mode))
{
free(fullpath);
return compat_strdup(dp->d_name);
return INT123_compat_strdup(dp->d_name);
}
free(fullpath);
}
......@@ -435,14 +438,14 @@ char* compat_nextdir(struct compat_dir *cd)
// because of a serious reason (maybe EOF, maybe out of disk space). You
// can inspect errno.
size_t unintr_write(int fd, void const *buffer, size_t bytes)
size_t INT123_unintr_write(int fd, void const *buffer, size_t bytes)
{
size_t written = 0;
errno = 0;
while(bytes)
{
errno = 0;
ssize_t part = write(fd, (char*)buffer+written, bytes);
ptrdiff_t part = write(fd, (char*)buffer+written, bytes);
// Just on short writes, we do not abort. Only when
// there was no successful operation (even zero write) at all.
// Any other error than EINTR ends things here.
......@@ -463,14 +466,14 @@ size_t unintr_write(int fd, void const *buffer, size_t bytes)
}
/* Same for reading the data. */
size_t unintr_read(int fd, void *buffer, size_t bytes)
size_t INT123_unintr_read(int fd, void *buffer, size_t bytes)
{
size_t got = 0;
errno = 0;
while(bytes)
{
errno = 0;
ssize_t part = read(fd, (char*)buffer+got, bytes);
ptrdiff_t part = read(fd, (char*)buffer+got, bytes);
if(part > 0) // == 0 is end of file
{
bytes -= part;
......@@ -486,7 +489,7 @@ size_t unintr_read(int fd, void *buffer, size_t bytes)
}
// and again for streams
size_t unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
size_t INT123_unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t written = 0;
errno = 0;
......@@ -506,7 +509,7 @@ size_t unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
#ifndef NO_CATCHSIGNAL
#if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H)
void (*catchsignal(int signum, void(*handler)()))()
void (*INT123_catchsignal(int signum, void(*handler)(int)))(int)
{
struct sigaction new_sa;
struct sigaction old_sa;
......@@ -520,7 +523,7 @@ void (*catchsignal(int signum, void(*handler)()))()
sigemptyset(&new_sa.sa_mask);
new_sa.sa_flags = 0;
if(sigaction(signum, &new_sa, &old_sa) == -1)
return ((void (*)()) -1);
return ((void (*)(int)) -1); // Not rather NULL?
return (old_sa.sa_handler);
}
#endif
......
......@@ -6,7 +6,7 @@
It is envisioned to include this compat header instead of any of the "standard" headers, to catch compatibility issues.
So, don't include stdlib.h or string.h ... include compat.h.
copyright 2007-21 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-23 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
......@@ -26,6 +26,8 @@
#include <stdlib.h>
#endif
#include <stddef.h>
#include <stdio.h>
#include <math.h>
......@@ -63,15 +65,34 @@
#ifndef SSIZE_MAX
#define SSIZE_MAX ((size_t)-1/2)
#endif
#ifndef PTRDIFF_MAX
#define PTRDIFF_MAX SSIZE_MAX
#endif
#ifndef ULONG_MAX
#define ULONG_MAX ((unsigned long)-1)
#endif
#ifndef INT64_MAX
#define INT64_MAX 9223372036854775807LL
#endif
#ifndef INT64_MIN
#define INT64_MIN (-INT64_MAX - 1)
#endif
#ifndef INT32_MAX
#define INT32_MAX 2147483647L
#endif
#ifndef INT32_MIN
#define INT32_MIN (-INT32_MAX - 1)
#endif
#ifndef OFF_MAX
#undef OFF_MIN
#if SIZEOF_OFF_T == 4
#define OFF_MAX ((uint32_t)-1/2)
#define OFF_MAX INT32_MAX
#define OFF_MIN INT32_MIN
#elif SIZEOF_OFF_T == 8
#define OFF_MAX ((uint64_t)-1/2)
#define OFF_MAX INT64_MAX
#define OFF_MIN INT64_MIN
#else
#error "Unexpected width of off_t."
#endif
......@@ -79,6 +100,7 @@
// Add two values (themselves assumed to be < limit), saturating to given limit.
#define SATURATE_ADD(inout, add, limit) inout = (limit-add >= inout) ? inout+add : limit;
#define SATURATE_SUB(inout, sub, limit) inout = (limit+sub >= inout) ? inout-sub : limit;
#ifdef HAVE_STRING_H
#include <string.h>
......@@ -99,7 +121,7 @@
#include <sys/select.h>
#endif
/* compat_open makes little sense without */
/* INT123_compat_open makes little sense without */
#include <fcntl.h>
/* To parse big numbers... */
......@@ -112,34 +134,21 @@
typedef unsigned char byte;
#if defined(_MSC_VER)
// For _setmode(), at least.
#include <io.h>
#if !defined(MPG123_DEF_SSIZE_T)
#define MPG123_DEF_SSIZE_T
#include <stddef.h>
typedef ptrdiff_t ssize_t;
#endif
#endif
// Not too early, leave system headers alone (strerror).
#include "intsym.h"
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
void *safe_realloc(void *ptr, size_t size);
void *INT123_safe_realloc(void *ptr, size_t size);
// Also freeing ptr if result is NULL. You can do
// ptr = safer_realloc(ptr, size)
// Also, ptr = safer_realloc(ptr, 0) will do free(ptr); ptr=NULL;.
void *safer_realloc(void *ptr, size_t size);
#ifndef HAVE_STRERROR
const char *strerror(int errnum);
#endif
// ptr = INT123_safer_realloc(ptr, size)
// Also, ptr = INT123_safer_realloc(ptr, 0) will do free(ptr); ptr=NULL;.
void *INT123_safer_realloc(void *ptr, size_t size);
const char *INT123_strerror(int errnum);
/* Roll our own strdup() that does not depend on libc feature test macros
and returns NULL on NULL input instead of crashing. */
char* compat_strdup(const char *s);
char* INT123_compat_strdup(const char *s);
/* If we have the size checks enabled, try to derive some sane printfs.
Simple start: Use max integer type and format if long is not big enough.
......@@ -152,25 +161,21 @@ typedef intmax_t off_p;
typedef long off_p;
#endif
#if (defined SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > SIZEOF_LONG) && (defined PRIuMAX)
#if (defined SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > SIZEOF_LONG) && (defined PRIuMAX) && (defined PRIiMAX)
# define SIZE_P PRIuMAX
typedef uintmax_t size_p;
# define SSIZE_P PRIiMAX
typedef intmax_t ssize_p;
#else
# define SIZE_P "lu"
typedef unsigned long size_p;
#endif
#if (defined SIZEOF_SSIZE_T) && (SIZEOF_SSIZE_T > SIZEOF_LONG) && (defined PRIiMAX)
# define SSIZE_P PRIuMAX
typedef intmax_t ssize_p;
#else
# define SSIZE_P "li"
# define SSIZE_P "ld"
typedef long ssize_p;
#endif
/* Get an environment variable, possibly converted to UTF-8 from wide string.
The return value is a copy that you shall free. */
char *compat_getenv(const char* name);
char *INT123_compat_getenv(const char* name);
/**
* Opening a file handle can be different.
......@@ -179,12 +184,12 @@ char *compat_getenv(const char* name);
* @param[in] mbptr Pointer to multibyte string.
* @return file descriptor (>=0) or error code.
*/
int compat_open(const char *filename, int flags);
FILE* compat_fopen(const char *filename, const char *mode);
int INT123_compat_open(const char *filename, int flags);
FILE* INT123_compat_fopen(const char *filename, const char *mode);
/**
* Also fdopen to avoid having to define POSIX macros in various source files.
*/
FILE* compat_fdopen(int fd, const char *mode);
FILE* INT123_compat_fdopen(int fd, const char *mode);
/**
* Closing a file handle can be platform specific.
......@@ -192,8 +197,8 @@ FILE* compat_fdopen(int fd, const char *mode);
* @param[in] infd File descriptor to be closed.
* @return 0 if the file was successfully closed. A return value of -1 indicates an error.
*/
int compat_close(int infd);
int compat_fclose(FILE* stream);
int INT123_compat_close(int infd);
int INT123_compat_fclose(FILE* stream);
/**
......@@ -201,7 +206,7 @@ int compat_fclose(FILE* stream);
* We do not bother with errors. This has to work.
* You can enable or disable binary mode.
*/
void compat_binmode(int fd, int enable);
void INT123_compat_binmode(int fd, int enable);
/* Those do make sense in a separate file, but I chose to include them in compat.c because that's the one source whose object is shared between mpg123 and libmpg123 -- and both need the functionality internally. */
......@@ -217,7 +222,7 @@ void compat_binmode(int fd, int enable);
*
* WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx
*/
int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen);
int INT123_win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen);
/**
* win32_uni2mbc
......@@ -230,7 +235,7 @@ int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen);
*
* WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx
*/
int win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen);
int INT123_win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen);
/**
* win32_mbc2uni
......@@ -244,7 +249,7 @@ int win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen);
* MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx
*/
int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen);
int INT123_win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen);
#endif
/*
......@@ -270,11 +275,11 @@ int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen);
(meaning: for Windows), else they are preserved (on POSIX, actual
file system access would be needed because of symlinks).
*/
char* compat_catpath(const char *prefix, const char* path);
char* INT123_compat_catpath(const char *prefix, const char* path);
/* Return 1 if the given path indicates an existing directory,
0 otherwise. */
int compat_isdir(const char *path);
int INT123_compat_isdir(const char *path);
/*
Directory traversal. This talks ASCII/UTF-8 paths externally, converts
......@@ -286,14 +291,14 @@ struct compat_dir;
/* Returns NULL if either directory failed to open or listing is empty.
Listing can still be empty even if non-NULL, so always rely on the
nextfile/nextdir functions. */
struct compat_dir* compat_diropen(char *path);
void compat_dirclose(struct compat_dir*);
struct compat_dir* INT123_compat_diropen(char *path);
void INT123_compat_dirclose(struct compat_dir*);
/* Get the next entry that is a file (or symlink to one).
The returned string is a copy that needs to be freed after use. */
char* compat_nextfile(struct compat_dir*);
char* INT123_compat_nextfile(struct compat_dir*);
/* Get the next entry that is a directory (or symlink to one).
The returned string is a copy that needs to be freed after use. */
char* compat_nextdir (struct compat_dir*);
char* INT123_compat_nextdir (struct compat_dir*);
#ifdef USE_MODULES
/*
......@@ -303,17 +308,17 @@ char* compat_nextdir (struct compat_dir*);
Use of absolute paths is a good idea if you want to be sure which
file is openend, as default search paths vary.
*/
void *compat_dlopen (const char *path);
void *compat_dlsym (void *handle, const char* name);
void compat_dlclose(void *handle);
void *INT123_compat_dlopen (const char *path);
void *INT123_compat_dlsym (void *handle, const char* name);
void INT123_compat_dlclose(void *handle);
#endif
/* Blocking write/read of data with signal resilience.
They continue after being interrupted by signals and always return the
amount of processed data (shortage indicating actual problem or EOF). */
size_t unintr_write(int fd, void const *buffer, size_t bytes);
size_t unintr_read (int fd, void *buffer, size_t bytes);
size_t unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t INT123_unintr_write(int fd, void const *buffer, size_t bytes);
size_t INT123_unintr_read (int fd, void *buffer, size_t bytes);
size_t INT123_unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
/* OSX SDK defines an enum with "normal" as value. That clashes with
optimize.h */
......@@ -324,7 +329,7 @@ size_t unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
#include "true.h"
#if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H)
void (*catchsignal(int signum, void(*handler)()))();
void (*INT123_catchsignal(int signum, void(*handler)(int)))(int);
#endif
#endif
......@@ -4,11 +4,13 @@
The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX.
So anything possibly somewhat advanced should be considered to be put here, with proper #ifdef;-)
copyright 2007-2016 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, Windows Unicode stuff by JonY.
*/
// Need POSIX 2008 for uselocale stuff.
#define _POSIX_C_SOURCE 200809L
#include "compat.h"
/* Win32 is only supported with unicode now. These headers also cover
......@@ -20,10 +22,14 @@
#include <winnls.h>
#endif
#if HAVE_LOCALE_H
#include <locale.h>
#endif
#include "debug.h"
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
void *safe_realloc(void *ptr, size_t size)
void *INT123_safe_realloc(void *ptr, size_t size)
{
if(ptr == NULL) return malloc(size);
else return realloc(ptr, size);
......@@ -31,25 +37,33 @@ void *safe_realloc(void *ptr, size_t size)
// A more sensible variant of realloc: It deallocates the original memory if
// realloc fails or if size zero was requested.
void *safer_realloc(void *ptr, size_t size)
void *INT123_safer_realloc(void *ptr, size_t size)
{
void *nptr = size ? safe_realloc(ptr, size) : NULL;
void *nptr = size ? INT123_safe_realloc(ptr, size) : NULL;
if(!nptr && ptr)
free(ptr);
return nptr;
}
#ifndef HAVE_STRERROR
const char *strerror(int errnum)
const char *INT123_strerror(int errnum)
{
#if defined(HAVE_STRERROR_L) && defined(HAVE_USELOCALE)
locale_t curloc = uselocale((locale_t)0);
if(curloc != LC_GLOBAL_LOCALE)
return strerror_l(errnum, curloc);
#endif
// Also fall back to strerror() in case of no set locale.
#if defined(HAVE_STRERROR)
return strerror(errnum);
#else
extern int sys_nerr;
extern char *sys_errlist[];
return (errnum < sys_nerr) ? sys_errlist[errnum] : "";
}
#endif
}
char* compat_strdup(const char *src)
char* INT123_compat_strdup(const char *src)
{
char *dest = NULL;
if(src)
......@@ -85,17 +99,17 @@ int win32_wide_common(const wchar_t * const wptr, char **mbptr, size_t * buflen,
return ret;
}
int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen)
int INT123_win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen)
{
return win32_wide_common(wptr, mbptr, buflen, CP_UTF8);
}
int win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen)
int INT123_win32_wide_utf7(const wchar_t * const wptr, char **mbptr, size_t * buflen)
{
return win32_wide_common(wptr, mbptr, buflen, CP_UTF7);
}
int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen)
int INT123_win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen)
{
size_t len;
wchar_t *buf;
......
......@@ -18,7 +18,7 @@
static wchar_t* u2wpath(const char *upath)
{
wchar_t* wpath, *p;
if(!upath || win32_utf8_wide(upath, &wpath, NULL) < 1)
if(!upath || INT123_win32_utf8_wide(upath, &wpath, NULL) < 1)
return NULL;
for(p=wpath; *p; ++p)
if(*p == L'/')
......@@ -26,17 +26,19 @@ static wchar_t* u2wpath(const char *upath)
return wpath;
}
#ifndef HIDE_w2upath
/* Convert Windows wide character paths to unix UTF-8. */
static char* w2upath(const wchar_t *wpath)
{
char* upath, *p;
if(!wpath || win32_wide_utf8(wpath, &upath, NULL) < 1)
if(!wpath || INT123_win32_wide_utf8(wpath, &upath, NULL) < 1)
return NULL;
for(p=upath; *p; ++p)
if(*p == '\\')
*p = '/';
return upath;
}
#endif
/* An absolute path that is too long and not already marked with
\\?\ can be marked as a long one and still work. */
......@@ -109,7 +111,7 @@ static wchar_t* u2wlongpath(const char *upath)
static wchar_t* u2wlongpath(const char *upath)
{
wchar_t* wpath, *p;
if (!upath || win32_utf8_wide(upath, &wpath, NULL) < 1)
if (!upath || INT123_win32_utf8_wide(upath, &wpath, NULL) < 1)
return NULL;
for (p = wpath; *p; ++p)
if (*p == L'/')
......
#ifndef MPG123_INTSYM_H
#define MPG123_INTSYM_H
/* Mapping of internal mpg123 symbols to something that is less likely to
conflict in case of static linking. */
#include "config.h"
#define COS9 INT123_COS9
#define tfcos36 INT123_tfcos36
#define pnts INT123_pnts
#define catchsignal INT123_catchsignal
#define safe_realloc INT123_safe_realloc
#define safer_realloc INT123_safer_realloc
#define compat_strdup INT123_compat_strdup
#define compat_getenv INT123_compat_getenv
#define compat_open INT123_compat_open
#define compat_fopen INT123_compat_fopen
#define compat_fdopen INT123_compat_fdopen
#define compat_close INT123_compat_close
#define compat_fclose INT123_compat_fclose
#define compat_binmode INT123_compat_binmode
#define win32_wide_utf8 INT123_win32_wide_utf8
#define win32_wide_utf7 INT123_win32_wide_utf7
#define win32_utf8_wide INT123_win32_utf8_wide
#define compat_catpath INT123_compat_catpath
#define compat_isdir INT123_compat_isdir
#define compat_diropen INT123_compat_diropen
#define compat_dirclose INT123_compat_dirclose
#define compat_nextfile INT123_compat_nextfile
#define compat_nextdir INT123_compat_nextdir
#define compat_dlopen INT123_compat_dlopen
#define compat_dlsym INT123_compat_dlsym
#define compat_dlclose INT123_compat_dlclose
#define unintr_write INT123_unintr_write
#define unintr_read INT123_unintr_read
#define unintr_fwrite INT123_unintr_fwrite
#define ntom_set_ntom INT123_ntom_set_ntom
#define synth_1to1 INT123_synth_1to1
#define synth_1to1_dither INT123_synth_1to1_dither
#define synth_1to1_i386 INT123_synth_1to1_i386
#define synth_1to1_i586 INT123_synth_1to1_i586
#define synth_1to1_i586_dither INT123_synth_1to1_i586_dither
#define synth_1to1_mmx INT123_synth_1to1_mmx
#define synth_1to1_3dnow INT123_synth_1to1_3dnow
#define synth_1to1_sse INT123_synth_1to1_sse
#define synth_1to1_stereo_sse INT123_synth_1to1_stereo_sse
#define synth_1to1_3dnowext INT123_synth_1to1_3dnowext
#define synth_1to1_altivec INT123_synth_1to1_altivec
#define synth_1to1_stereo_altivec INT123_synth_1to1_stereo_altivec
#define synth_1to1_x86_64 INT123_synth_1to1_x86_64
#define synth_1to1_stereo_x86_64 INT123_synth_1to1_stereo_x86_64
#define synth_1to1_avx INT123_synth_1to1_avx
#define synth_1to1_stereo_avx INT123_synth_1to1_stereo_avx
#define synth_1to1_arm INT123_synth_1to1_arm
#define synth_1to1_neon INT123_synth_1to1_neon
#define synth_1to1_stereo_neon INT123_synth_1to1_stereo_neon
#define synth_1to1_neon64 INT123_synth_1to1_neon64
#define synth_1to1_stereo_neon64 INT123_synth_1to1_stereo_neon64
#define absynth_1to1_i486 INT123_absynth_1to1_i486
#define synth_1to1_mono INT123_synth_1to1_mono
#define synth_1to1_m2s INT123_synth_1to1_m2s
#define synth_2to1 INT123_synth_2to1
#define synth_2to1_dither INT123_synth_2to1_dither
#define synth_2to1_i386 INT123_synth_2to1_i386
#define synth_2to1_mono INT123_synth_2to1_mono
#define synth_2to1_m2s INT123_synth_2to1_m2s
#define synth_4to1 INT123_synth_4to1
#define synth_4to1_dither INT123_synth_4to1_dither
#define synth_4to1_i386 INT123_synth_4to1_i386
#define synth_4to1_mono INT123_synth_4to1_mono
#define synth_4to1_m2s INT123_synth_4to1_m2s
#define synth_ntom INT123_synth_ntom
#define synth_ntom_mono INT123_synth_ntom_mono
#define synth_ntom_m2s INT123_synth_ntom_m2s
#define synth_1to1_8bit INT123_synth_1to1_8bit
#define synth_1to1_8bit_i386 INT123_synth_1to1_8bit_i386
#define synth_1to1_8bit_wrap INT123_synth_1to1_8bit_wrap
#define synth_1to1_8bit_mono INT123_synth_1to1_8bit_mono
#define synth_1to1_8bit_m2s INT123_synth_1to1_8bit_m2s
#define synth_1to1_8bit_wrap_mono INT123_synth_1to1_8bit_wrap_mono
#define synth_1to1_8bit_wrap_m2s INT123_synth_1to1_8bit_wrap_m2s
#define synth_2to1_8bit INT123_synth_2to1_8bit
#define synth_2to1_8bit_i386 INT123_synth_2to1_8bit_i386
#define synth_2to1_8bit_mono INT123_synth_2to1_8bit_mono
#define synth_2to1_8bit_m2s INT123_synth_2to1_8bit_m2s
#define synth_4to1_8bit INT123_synth_4to1_8bit
#define synth_4to1_8bit_i386 INT123_synth_4to1_8bit_i386
#define synth_4to1_8bit_mono INT123_synth_4to1_8bit_mono
#define synth_4to1_8bit_m2s INT123_synth_4to1_8bit_m2s
#define synth_ntom_8bit INT123_synth_ntom_8bit
#define synth_ntom_8bit_mono INT123_synth_ntom_8bit_mono
#define synth_ntom_8bit_m2s INT123_synth_ntom_8bit_m2s
#define synth_1to1_real INT123_synth_1to1_real
#define synth_1to1_real_i386 INT123_synth_1to1_real_i386
#define synth_1to1_real_sse INT123_synth_1to1_real_sse
#define synth_1to1_real_stereo_sse INT123_synth_1to1_real_stereo_sse
#define synth_1to1_real_x86_64 INT123_synth_1to1_real_x86_64
#define synth_1to1_real_stereo_x86_64 INT123_synth_1to1_real_stereo_x86_64
#define synth_1to1_real_avx INT123_synth_1to1_real_avx
#define synth_1to1_fltst_avx INT123_synth_1to1_fltst_avx
#define synth_1to1_real_altivec INT123_synth_1to1_real_altivec
#define synth_1to1_fltst_altivec INT123_synth_1to1_fltst_altivec
#define synth_1to1_real_neon INT123_synth_1to1_real_neon
#define synth_1to1_real_stereo_neon INT123_synth_1to1_real_stereo_neon
#define synth_1to1_real_neon64 INT123_synth_1to1_real_neon64
#define synth_1to1_fltst_neon64 INT123_synth_1to1_fltst_neon64
#define synth_1to1_real_mono INT123_synth_1to1_real_mono
#define synth_1to1_real_m2s INT123_synth_1to1_real_m2s
#define synth_2to1_real INT123_synth_2to1_real
#define synth_2to1_real_i386 INT123_synth_2to1_real_i386
#define synth_2to1_real_mono INT123_synth_2to1_real_mono
#define synth_2to1_real_m2s INT123_synth_2to1_real_m2s
#define synth_4to1_real INT123_synth_4to1_real
#define synth_4to1_real_i386 INT123_synth_4to1_real_i386
#define synth_4to1_real_mono INT123_synth_4to1_real_mono
#define synth_4to1_real_m2s INT123_synth_4to1_real_m2s
#define synth_ntom_real INT123_synth_ntom_real
#define synth_ntom_real_mono INT123_synth_ntom_real_mono
#define synth_ntom_real_m2s INT123_synth_ntom_real_m2s
#define synth_1to1_s32 INT123_synth_1to1_s32
#define synth_1to1_s32_i386 INT123_synth_1to1_s32_i386
#define synth_1to1_s32_sse INT123_synth_1to1_s32_sse
#define synth_1to1_s32_stereo_sse INT123_synth_1to1_s32_stereo_sse
#define synth_1to1_s32_x86_64 INT123_synth_1to1_s32_x86_64
#define synth_1to1_s32_stereo_x86_64 INT123_synth_1to1_s32_stereo_x86_64
#define synth_1to1_s32_avx INT123_synth_1to1_s32_avx
#define synth_1to1_s32_stereo_avx INT123_synth_1to1_s32_stereo_avx
#define synth_1to1_s32_altivec INT123_synth_1to1_s32_altivec
#define synth_1to1_s32_stereo_altivec INT123_synth_1to1_s32_stereo_altivec
#define synth_1to1_s32_neon INT123_synth_1to1_s32_neon
#define synth_1to1_s32_stereo_neon INT123_synth_1to1_s32_stereo_neon
#define synth_1to1_s32_neon64 INT123_synth_1to1_s32_neon64
#define synth_1to1_s32st_neon64 INT123_synth_1to1_s32st_neon64
#define synth_1to1_s32_mono INT123_synth_1to1_s32_mono
#define synth_1to1_s32_m2s INT123_synth_1to1_s32_m2s
#define synth_2to1_s32 INT123_synth_2to1_s32
#define synth_2to1_s32_i386 INT123_synth_2to1_s32_i386
#define synth_2to1_s32_mono INT123_synth_2to1_s32_mono
#define synth_2to1_s32_m2s INT123_synth_2to1_s32_m2s
#define synth_4to1_s32 INT123_synth_4to1_s32
#define synth_4to1_s32_i386 INT123_synth_4to1_s32_i386
#define synth_4to1_s32_mono INT123_synth_4to1_s32_mono
#define synth_4to1_s32_m2s INT123_synth_4to1_s32_m2s
#define synth_ntom_s32 INT123_synth_ntom_s32
#define synth_ntom_s32_mono INT123_synth_ntom_s32_mono
#define synth_ntom_s32_m2s INT123_synth_ntom_s32_m2s
#define dct64 INT123_dct64
#define dct64_i386 INT123_dct64_i386
#define dct64_altivec INT123_dct64_altivec
#define dct64_i486 INT123_dct64_i486
#define dct36 INT123_dct36
#define dct36_3dnow INT123_dct36_3dnow
#define dct36_3dnowext INT123_dct36_3dnowext
#define dct36_x86_64 INT123_dct36_x86_64
#define dct36_sse INT123_dct36_sse
#define dct36_avx INT123_dct36_avx
#define dct36_neon INT123_dct36_neon
#define dct36_neon64 INT123_dct36_neon64
#define synth_ntom_set_step INT123_synth_ntom_set_step
#define ntom_val INT123_ntom_val
#define ntom_frame_outsamples INT123_ntom_frame_outsamples
#define ntom_frmouts INT123_ntom_frmouts
#define ntom_ins2outs INT123_ntom_ins2outs
#define ntom_frameoff INT123_ntom_frameoff
#define init_layer3 INT123_init_layer3
#define init_layer3_gainpow2 INT123_init_layer3_gainpow2
#define init_layer3_stuff INT123_init_layer3_stuff
#define init_layer12 INT123_init_layer12
#define init_layer12_table INT123_init_layer12_table
#define init_layer12_stuff INT123_init_layer12_stuff
#define init_costabs INT123_init_costabs
#define make_decode_tables INT123_make_decode_tables
#define make_decode_tables_mmx INT123_make_decode_tables_mmx
#define init_layer3_gainpow2_mmx INT123_init_layer3_gainpow2_mmx
#define init_layer12_table_mmx INT123_init_layer12_table_mmx
#define make_conv16to8_table INT123_make_conv16to8_table
#define do_layer3 INT123_do_layer3
#define do_layer2 INT123_do_layer2
#define do_layer1 INT123_do_layer1
#define do_equalizer INT123_do_equalizer
#define dither_table_init INT123_dither_table_init
#define frame_dither_init INT123_frame_dither_init
#define invalidate_format INT123_invalidate_format
#define frame_init INT123_frame_init
#define frame_init_par INT123_frame_init_par
#define frame_outbuffer INT123_frame_outbuffer
#define frame_output_format INT123_frame_output_format
#define frame_buffers INT123_frame_buffers
#define frame_reset INT123_frame_reset
#define frame_buffers_reset INT123_frame_buffers_reset
#define frame_exit INT123_frame_exit
#define frame_index_find INT123_frame_index_find
#define frame_index_setup INT123_frame_index_setup
#define do_volume INT123_do_volume
#define do_rva INT123_do_rva
#define frame_gapless_init INT123_frame_gapless_init
#define frame_gapless_realinit INT123_frame_gapless_realinit
#define frame_gapless_update INT123_frame_gapless_update
#define frame_gapless_bytify INT123_frame_gapless_bytify
#define frame_gapless_ignore INT123_frame_gapless_ignore
#define frame_expect_outsamples INT123_frame_expect_outsamples
#define frame_skip INT123_frame_skip
#define frame_ins2outs INT123_frame_ins2outs
#define frame_outs INT123_frame_outs
#define frame_expect_outsampels INT123_frame_expect_outsampels
#define frame_offset INT123_frame_offset
#define frame_set_frameseek INT123_frame_set_frameseek
#define frame_set_seek INT123_frame_set_seek
#define frame_tell_seek INT123_frame_tell_seek
#define frame_fill_toc INT123_frame_fill_toc
#define getcpuflags INT123_getcpuflags
#define icy2utf8 INT123_icy2utf8
#define init_icy INT123_init_icy
#define clear_icy INT123_clear_icy
#define reset_icy INT123_reset_icy
#define init_id3 INT123_init_id3
#define exit_id3 INT123_exit_id3
#define reset_id3 INT123_reset_id3
#define id3_link INT123_id3_link
#define parse_new_id3 INT123_parse_new_id3
#define id3_to_utf8 INT123_id3_to_utf8
#define fi_init INT123_fi_init
#define fi_exit INT123_fi_exit
#define fi_resize INT123_fi_resize
#define fi_add INT123_fi_add
#define fi_set INT123_fi_set
#define fi_reset INT123_fi_reset
#define decode_update INT123_decode_update
#define decoder_synth_bytes INT123_decoder_synth_bytes
#define samples_to_bytes INT123_samples_to_bytes
#define bytes_to_samples INT123_bytes_to_samples
#define outblock_bytes INT123_outblock_bytes
#define postprocess_buffer INT123_postprocess_buffer
#define open_fixed_pre INT123_open_fixed_pre
#define open_fixed_post INT123_open_fixed_post
#define frame_cpu_opt INT123_frame_cpu_opt
#define set_synth_functions INT123_set_synth_functions
#define dectype INT123_dectype
#define defdec INT123_defdec
#define decclass INT123_decclass
#define read_frame_init INT123_read_frame_init
#define frame_bitrate INT123_frame_bitrate
#define frame_freq INT123_frame_freq
#define read_frame_recover INT123_read_frame_recover
#define read_frame INT123_read_frame
#define set_pointer INT123_set_pointer
#define position_info INT123_position_info
#define compute_bpf INT123_compute_bpf
#define time_to_frame INT123_time_to_frame
#define get_songlen INT123_get_songlen
#define bc_prepare INT123_bc_prepare
#define bc_cleanup INT123_bc_cleanup
#define bc_poolsize INT123_bc_poolsize
#define bc_fill INT123_bc_fill
#define open_stream INT123_open_stream
#define open_stream_handle INT123_open_stream_handle
#define open_feed INT123_open_feed
#define feed_more INT123_feed_more
#define feed_forget INT123_feed_forget
#define feed_set_pos INT123_feed_set_pos
#define open_bad INT123_open_bad
#define open_module INT123_open_module
#define close_module INT123_close_module
#define list_modules INT123_list_modules
#define buffer_init INT123_buffer_init
#define buffer_exit INT123_buffer_exit
#define buffer_sync_param INT123_buffer_sync_param
#define buffer_open INT123_buffer_open
#define buffer_encodings INT123_buffer_encodings
#define buffer_formats INT123_buffer_formats
#define buffer_start INT123_buffer_start
#define buffer_ndrain INT123_buffer_ndrain
#define buffer_stop INT123_buffer_stop
#define buffer_close INT123_buffer_close
#define buffer_continue INT123_buffer_continue
#define buffer_ignore_lowmem INT123_buffer_ignore_lowmem
#define buffer_drain INT123_buffer_drain
#define buffer_end INT123_buffer_end
#define buffer_pause INT123_buffer_pause
#define buffer_drop INT123_buffer_drop
#define buffer_write INT123_buffer_write
#define buffer_fill INT123_buffer_fill
#define xfermem_init INT123_xfermem_init
#define xfermem_init_writer INT123_xfermem_init_writer
#define xfermem_init_reader INT123_xfermem_init_reader
#define xfermem_get_freespace INT123_xfermem_get_freespace
#define xfermem_get_usedspace INT123_xfermem_get_usedspace
#define xfermem_getcmd INT123_xfermem_getcmd
#define xfermem_getcmds INT123_xfermem_getcmds
#define xfermem_putcmd INT123_xfermem_putcmd
#define xfermem_writer_block INT123_xfermem_writer_block
#define xfermem_write INT123_xfermem_write
#define xfermem_done INT123_xfermem_done
#define au_open INT123_au_open
#define cdr_open INT123_cdr_open
#define raw_open INT123_raw_open
#define wav_open INT123_wav_open
#define wav_write INT123_wav_write
#define wav_close INT123_wav_close
#define au_close INT123_au_close
#define raw_close INT123_raw_close
#define cdr_formats INT123_cdr_formats
#define au_formats INT123_au_formats
#define raw_formats INT123_raw_formats
#define wav_formats INT123_wav_formats
#define wav_drain INT123_wav_drain
#define stringlists_add INT123_stringlists_add
#define check_neon INT123_check_neon
#define dct64_3dnow INT123_dct64_3dnow
#define dct64_3dnowext INT123_dct64_3dnowext
#define dct64_avx INT123_dct64_avx
#define dct64_real_avx INT123_dct64_real_avx
#define dct64_mmx INT123_dct64_mmx
#define dct64_MMX INT123_dct64_MMX
#define dct64_neon INT123_dct64_neon
#define dct64_neon64 INT123_dct64_neon64
#define dct64_real_neon64 INT123_dct64_real_neon64
#define dct64_real_neon INT123_dct64_real_neon
#define dct64_sse INT123_dct64_sse
#define dct64_real_sse INT123_dct64_real_sse
#define dct64_x86_64 INT123_dct64_x86_64
#define dct64_real_x86_64 INT123_dct64_real_x86_64
#define do_equalizer_3dnow INT123_do_equalizer_3dnow
#define synth_1to1_3dnow_asm INT123_synth_1to1_3dnow_asm
#define synth_1to1_arm_asm INT123_synth_1to1_arm_asm
#define synth_1to1_arm_accurate_asm INT123_synth_1to1_arm_accurate_asm
#define synth_1to1_i586_asm INT123_synth_1to1_i586_asm
#define synth_1to1_i586_asm_dither INT123_synth_1to1_i586_asm_dither
#define synth_1to1_MMX INT123_synth_1to1_MMX
#define synth_1to1_neon_asm INT123_synth_1to1_neon_asm
#define synth_1to1_neon64_asm INT123_synth_1to1_neon64_asm
#define synth_1to1_neon64_accurate_asm INT123_synth_1to1_neon64_accurate_asm
#define synth_1to1_real_neon64_asm INT123_synth_1to1_real_neon64_asm
#define synth_1to1_s32_neon64_asm INT123_synth_1to1_s32_neon64_asm
#define synth_1to1_neon_accurate_asm INT123_synth_1to1_neon_accurate_asm
#define synth_1to1_real_neon_asm INT123_synth_1to1_real_neon_asm
#define synth_1to1_s32_neon_asm INT123_synth_1to1_s32_neon_asm
#define synth_1to1_sse_accurate_asm INT123_synth_1to1_sse_accurate_asm
#define synth_1to1_real_sse_asm INT123_synth_1to1_real_sse_asm
#define synth_1to1_s32_sse_asm INT123_synth_1to1_s32_sse_asm
#define synth_1to1_s_avx_asm INT123_synth_1to1_s_avx_asm
#define synth_1to1_s_avx_accurate_asm INT123_synth_1to1_s_avx_accurate_asm
#define synth_1to1_real_s_avx_asm INT123_synth_1to1_real_s_avx_asm
#define synth_1to1_s32_s_avx_asm INT123_synth_1to1_s32_s_avx_asm
#define synth_1to1_s_neon_asm INT123_synth_1to1_s_neon_asm
#define synth_1to1_s_neon64_asm INT123_synth_1to1_s_neon64_asm
#define synth_1to1_s_neon64_accurate_asm INT123_synth_1to1_s_neon64_accurate_asm
#define synth_1to1_real_s_neon64_asm INT123_synth_1to1_real_s_neon64_asm
#define synth_1to1_s32_s_neon64_asm INT123_synth_1to1_s32_s_neon64_asm
#define synth_1to1_s_neon_accurate_asm INT123_synth_1to1_s_neon_accurate_asm
#define synth_1to1_real_s_neon_asm INT123_synth_1to1_real_s_neon_asm
#define synth_1to1_s32_s_neon_asm INT123_synth_1to1_s32_s_neon_asm
#define synth_1to1_s_sse_accurate_asm INT123_synth_1to1_s_sse_accurate_asm
#define synth_1to1_real_s_sse_asm INT123_synth_1to1_real_s_sse_asm
#define synth_1to1_s32_s_sse_asm INT123_synth_1to1_s32_s_sse_asm
#define synth_1to1_s_x86_64_asm INT123_synth_1to1_s_x86_64_asm
#define synth_1to1_s_x86_64_accurate_asm INT123_synth_1to1_s_x86_64_accurate_asm
#define synth_1to1_real_s_x86_64_asm INT123_synth_1to1_real_s_x86_64_asm
#define synth_1to1_s32_s_x86_64_asm INT123_synth_1to1_s32_s_x86_64_asm
#define synth_1to1_x86_64_asm INT123_synth_1to1_x86_64_asm
#define synth_1to1_x86_64_accurate_asm INT123_synth_1to1_x86_64_accurate_asm
#define synth_1to1_real_x86_64_asm INT123_synth_1to1_real_x86_64_asm
#define synth_1to1_s32_x86_64_asm INT123_synth_1to1_s32_x86_64_asm
#define costab_mmxsse INT123_costab_mmxsse
#define make_decode_tables_mmx_asm INT123_make_decode_tables_mmx_asm
#ifndef HAVE_STRERROR
#define strerror INT123_strerror
#endif
#endif
/*
abi_align: An attempt to avoid breakage because of mixing
compilers with different alignment.
abi_align: ABI and alignment stuff for library builds.
copyright 1995-2015 by the mpg123 project
Original use was the definitions for avoiding breakage because of mixing
compilers with different alignment. Then, the switchery for building
DLLs got lumped in.
copyright 1995-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
......@@ -16,6 +19,12 @@
#include "config.h"
// Building any of our libs on/for Windows needs this before
// including the main API header (define MPG123_EXPORT).
#if defined(WIN32) && defined(DYNAMIC_BUILD)
#define BUILD_MPG123_DLL
#endif
/* ABI conformance for other compilers.
mpg123 needs 16byte-aligned (or more) stack for SSE and friends.
gcc provides that, but others don't necessarily. */
......
/*
dct64.c: DCT64, the plain C version
INT123_dct64.c: DCT64, the plain C version
copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
......@@ -19,7 +19,7 @@
#include "mpg123lib_intern.h"
void dct64(real *out0,real *out1,real *samples)
void INT123_dct64(real *out0,real *out1,real *samples)
{
real bufs[64];
......@@ -30,7 +30,7 @@ void dct64(real *out0,real *out1,real *samples)
b1 = samples;
bs = bufs;
costab = pnts[0]+16;
costab = INT123_pnts[0]+16;
b2 = b1 + 32;
for(i=15;i>=0;i--)
......@@ -39,7 +39,7 @@ void dct64(real *out0,real *out1,real *samples)
*bs++ = REAL_MUL((*--b2 - *b1++), *--costab);
b1 = bufs;
costab = pnts[1]+8;
costab = INT123_pnts[1]+8;
b2 = b1 + 16;
{
......@@ -57,7 +57,7 @@ void dct64(real *out0,real *out1,real *samples)
}
bs = bufs;
costab = pnts[2];
costab = INT123_pnts[2];
b2 = b1 + 8;
for(j=2;j;j--)
......@@ -75,7 +75,7 @@ void dct64(real *out0,real *out1,real *samples)
}
b1 = bufs;
costab = pnts[3];
costab = INT123_pnts[3];
b2 = b1 + 4;
for(j=4;j;j--)
......@@ -92,7 +92,7 @@ void dct64(real *out0,real *out1,real *samples)
b2 += 8;
}
bs = bufs;
costab = pnts[4];
costab = INT123_pnts[4];
for(j=8;j;j--)
{
......@@ -171,5 +171,3 @@ void dct64(real *out0,real *out1,real *samples)
out1[0x10*15] = REAL_SCALE_DCT64(bufs[16+15]);
}
......@@ -4,7 +4,7 @@
This file is strongly tied with optimize.h concerning the synth functions.
Perhaps one should restructure that a bit.
copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, taking WRITE_SAMPLE from decode.c
*/
......@@ -30,7 +30,7 @@
#define NTOM_MAX 8 /* maximum allowed factor for upsampling */
#define NTOM_MAX_FREQ 96000 /* maximum frequency to upsample to / downsample from */
#define NTOM_MUL (32768)
void ntom_set_ntom(mpg123_handle *fr, off_t num);
void INT123_ntom_set_ntom(mpg123_handle *fr, int64_t num);
#endif
/* Let's collect all possible synth functions here, for an overview.
......@@ -39,84 +39,84 @@ void ntom_set_ntom(mpg123_handle *fr, off_t num);
#ifndef NO_16BIT
/* The signed-16bit-producing variants. */
int synth_1to1 (real*, int, mpg123_handle*, int);
int synth_1to1_dither (real*, int, mpg123_handle*, int);
int synth_1to1_i386 (real*, int, mpg123_handle*, int);
int synth_1to1_i586 (real*, int, mpg123_handle*, int);
int synth_1to1_i586_dither(real*, int, mpg123_handle*, int);
int synth_1to1_mmx (real*, int, mpg123_handle*, int);
int synth_1to1_3dnow (real*, int, mpg123_handle*, int);
int synth_1to1_sse (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_sse (real*, real*, mpg123_handle*);
int synth_1to1_3dnowext (real*, int, mpg123_handle*, int);
int synth_1to1_altivec (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_altivec(real*, real*, mpg123_handle*);
int synth_1to1_x86_64 (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_x86_64(real*, real*, mpg123_handle*);
int synth_1to1_avx (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_avx (real*, real*, mpg123_handle*);
int synth_1to1_arm (real*, int, mpg123_handle*, int);
int synth_1to1_neon (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_neon(real*, real*, mpg123_handle*);
int synth_1to1_neon64 (real*, int, mpg123_handle*, int);
int synth_1to1_stereo_neon64(real*, real*, mpg123_handle*);
int INT123_synth_1to1 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_dither (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_i586 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_i586_dither(real*, int, mpg123_handle*, int);
int INT123_synth_1to1_mmx (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_3dnow (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_sse (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_sse (real*, real*, mpg123_handle*);
int INT123_synth_1to1_3dnowext (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_altivec (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_altivec(real*, real*, mpg123_handle*);
int INT123_synth_1to1_x86_64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_x86_64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_avx (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_avx (real*, real*, mpg123_handle*);
int INT123_synth_1to1_arm (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_neon (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_neon(real*, real*, mpg123_handle*);
int INT123_synth_1to1_neon64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_stereo_neon64(real*, real*, mpg123_handle*);
/* This is different, special usage in layer3.c only.
Hence, the name... and now forget about it.
Never use it outside that special portion of code inside layer3.c! */
int absynth_1to1_i486(real*, int, mpg123_handle*, int);
int INT123_absynth_1to1_i486(real*, int, mpg123_handle*, int);
/* These mono/stereo converters use one of the above for the grunt work. */
int synth_1to1_mono (real*, mpg123_handle*);
int synth_1to1_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_mono (real*, mpg123_handle*);
int INT123_synth_1to1_m2s(real*, mpg123_handle*);
/* Sample rate decimation comes in less flavours. */
#ifndef NO_DOWNSAMPLE
int synth_2to1 (real*, int, mpg123_handle*, int);
int synth_2to1_dither (real*, int, mpg123_handle*, int);
int synth_2to1_i386 (real*, int, mpg123_handle*, int);
int synth_2to1_mono (real*, mpg123_handle*);
int synth_2to1_m2s(real*, mpg123_handle*);
int synth_4to1 (real *,int, mpg123_handle*, int);
int synth_4to1_dither (real *,int, mpg123_handle*, int);
int synth_4to1_i386 (real*, int, mpg123_handle*, int);
int synth_4to1_mono (real*, mpg123_handle*);
int synth_4to1_m2s(real*, mpg123_handle*);
int INT123_synth_2to1 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_dither (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_mono (real*, mpg123_handle*);
int INT123_synth_2to1_m2s(real*, mpg123_handle*);
int INT123_synth_4to1 (real *,int, mpg123_handle*, int);
int INT123_synth_4to1_dither (real *,int, mpg123_handle*, int);
int INT123_synth_4to1_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_mono (real*, mpg123_handle*);
int INT123_synth_4to1_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_NTOM
/* NtoM is really just one implementation. */
int synth_ntom (real *,int, mpg123_handle*, int);
int synth_ntom_mono (real *, mpg123_handle *);
int synth_ntom_m2s (real *, mpg123_handle *);
int INT123_synth_ntom (real *,int, mpg123_handle*, int);
int INT123_synth_ntom_mono (real *, mpg123_handle *);
int INT123_synth_ntom_m2s (real *, mpg123_handle *);
#endif
#endif
#ifndef NO_8BIT
/* The 8bit-producing variants. */
/* There are direct 8-bit synths and wrappers over a possibly optimized 16bit one. */
int synth_1to1_8bit (real*, int, mpg123_handle*, int);
int synth_1to1_8bit_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_8bit (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_8bit_i386 (real*, int, mpg123_handle*, int);
#ifndef NO_16BIT
int synth_1to1_8bit_wrap (real*, int, mpg123_handle*, int);
int synth_1to1_8bit_mono (real*, mpg123_handle*);
int INT123_synth_1to1_8bit_wrap (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_8bit_mono (real*, mpg123_handle*);
#endif
int synth_1to1_8bit_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_8bit_m2s(real*, mpg123_handle*);
#ifndef NO_16BIT
int synth_1to1_8bit_wrap_mono (real*, mpg123_handle*);
int synth_1to1_8bit_wrap_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_8bit_wrap_mono (real*, mpg123_handle*);
int INT123_synth_1to1_8bit_wrap_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_DOWNSAMPLE
int synth_2to1_8bit (real*, int, mpg123_handle*, int);
int synth_2to1_8bit_i386 (real*, int, mpg123_handle*, int);
int synth_2to1_8bit_mono (real*, mpg123_handle*);
int synth_2to1_8bit_m2s(real*, mpg123_handle*);
int synth_4to1_8bit (real*, int, mpg123_handle*, int);
int synth_4to1_8bit_i386 (real*, int, mpg123_handle*, int);
int synth_4to1_8bit_mono (real*, mpg123_handle*);
int synth_4to1_8bit_m2s(real*, mpg123_handle*);
int INT123_synth_2to1_8bit (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_8bit_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_8bit_mono (real*, mpg123_handle*);
int INT123_synth_2to1_8bit_m2s(real*, mpg123_handle*);
int INT123_synth_4to1_8bit (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_8bit_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_8bit_mono (real*, mpg123_handle*);
int INT123_synth_4to1_8bit_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_NTOM
int synth_ntom_8bit (real*, int, mpg123_handle*, int);
int synth_ntom_8bit_mono (real*, mpg123_handle*);
int synth_ntom_8bit_m2s(real*, mpg123_handle*);
int INT123_synth_ntom_8bit (real*, int, mpg123_handle*, int);
int INT123_synth_ntom_8bit_mono (real*, mpg123_handle*);
int INT123_synth_ntom_8bit_m2s(real*, mpg123_handle*);
#endif
#endif
......@@ -124,153 +124,153 @@ int synth_ntom_8bit_m2s(real*, mpg123_handle*);
#ifndef NO_REAL
/* The real-producing variants. */
int synth_1to1_real (real*, int, mpg123_handle*, int);
int synth_1to1_real_i386 (real*, int, mpg123_handle*, int);
int synth_1to1_real_sse (real*, int, mpg123_handle*, int);
int synth_1to1_real_stereo_sse (real*, real*, mpg123_handle*);
int synth_1to1_real_x86_64 (real*, int, mpg123_handle*, int);
int synth_1to1_real_stereo_x86_64(real*, real*, mpg123_handle*);
int synth_1to1_real_avx (real*, int, mpg123_handle*, int);
int synth_1to1_fltst_avx (real*, real*, mpg123_handle*);
int synth_1to1_real_altivec (real*, int, mpg123_handle*, int);
int synth_1to1_fltst_altivec(real*, real*, mpg123_handle*);
int synth_1to1_real_neon (real*, int, mpg123_handle*, int);
int synth_1to1_real_stereo_neon(real*, real*, mpg123_handle*);
int synth_1to1_real_neon64 (real*, int, mpg123_handle*, int);
int synth_1to1_fltst_neon64(real*, real*, mpg123_handle*);
int synth_1to1_real_mono (real*, mpg123_handle*);
int synth_1to1_real_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_real (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_sse (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_stereo_sse (real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_x86_64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_stereo_x86_64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_avx (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_fltst_avx (real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_altivec (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_fltst_altivec(real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_neon (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_real_stereo_neon(real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_neon64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_fltst_neon64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_real_mono (real*, mpg123_handle*);
int INT123_synth_1to1_real_m2s(real*, mpg123_handle*);
#ifndef NO_DOWNSAMPLE
int synth_2to1_real (real*, int, mpg123_handle*, int);
int synth_2to1_real_i386 (real*, int, mpg123_handle*, int);
int synth_2to1_real_mono (real*, mpg123_handle*);
int synth_2to1_real_m2s(real*, mpg123_handle*);
int synth_4to1_real (real*, int, mpg123_handle*, int);
int synth_4to1_real_i386 (real*, int, mpg123_handle*, int);
int synth_4to1_real_mono (real*, mpg123_handle*);
int synth_4to1_real_m2s(real*, mpg123_handle*);
int INT123_synth_2to1_real (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_real_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_real_mono (real*, mpg123_handle*);
int INT123_synth_2to1_real_m2s(real*, mpg123_handle*);
int INT123_synth_4to1_real (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_real_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_real_mono (real*, mpg123_handle*);
int INT123_synth_4to1_real_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_NTOM
int synth_ntom_real (real*, int, mpg123_handle*, int);
int synth_ntom_real_mono (real*, mpg123_handle*);
int synth_ntom_real_m2s(real*, mpg123_handle*);
int INT123_synth_ntom_real (real*, int, mpg123_handle*, int);
int INT123_synth_ntom_real_mono (real*, mpg123_handle*);
int INT123_synth_ntom_real_m2s(real*, mpg123_handle*);
#endif
#endif
#ifndef NO_32BIT
/* 32bit integer */
int synth_1to1_s32 (real*, int, mpg123_handle*, int);
int synth_1to1_s32_i386 (real*, int, mpg123_handle*, int);
int synth_1to1_s32_sse (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_sse (real*, real*, mpg123_handle*);
int synth_1to1_s32_x86_64 (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_x86_64(real*, real*, mpg123_handle*);
int synth_1to1_s32_avx (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_avx (real*, real*, mpg123_handle*);
int synth_1to1_s32_altivec (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_altivec(real*, real*, mpg123_handle*);
int synth_1to1_s32_neon (real*, int, mpg123_handle*, int);
int synth_1to1_s32_stereo_neon(real*, real*, mpg123_handle*);
int synth_1to1_s32_neon64 (real*, int, mpg123_handle*, int);
int synth_1to1_s32st_neon64(real*, real*, mpg123_handle*);
int synth_1to1_s32_mono (real*, mpg123_handle*);
int synth_1to1_s32_m2s(real*, mpg123_handle*);
int INT123_synth_1to1_s32 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_sse (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_sse (real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_x86_64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_x86_64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_avx (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_avx (real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_altivec (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_altivec(real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_neon (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32_stereo_neon(real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_neon64 (real*, int, mpg123_handle*, int);
int INT123_synth_1to1_s32st_neon64(real*, real*, mpg123_handle*);
int INT123_synth_1to1_s32_mono (real*, mpg123_handle*);
int INT123_synth_1to1_s32_m2s(real*, mpg123_handle*);
#ifndef NO_DOWNSAMPLE
int synth_2to1_s32 (real*, int, mpg123_handle*, int);
int synth_2to1_s32_i386 (real*, int, mpg123_handle*, int);
int synth_2to1_s32_mono (real*, mpg123_handle*);
int synth_2to1_s32_m2s(real*, mpg123_handle*);
int synth_4to1_s32 (real*, int, mpg123_handle*, int);
int synth_4to1_s32_i386 (real*, int, mpg123_handle*, int);
int synth_4to1_s32_mono (real*, mpg123_handle*);
int synth_4to1_s32_m2s(real*, mpg123_handle*);
int INT123_synth_2to1_s32 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_s32_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_2to1_s32_mono (real*, mpg123_handle*);
int INT123_synth_2to1_s32_m2s(real*, mpg123_handle*);
int INT123_synth_4to1_s32 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_s32_i386 (real*, int, mpg123_handle*, int);
int INT123_synth_4to1_s32_mono (real*, mpg123_handle*);
int INT123_synth_4to1_s32_m2s(real*, mpg123_handle*);
#endif
#ifndef NO_NTOM
int synth_ntom_s32 (real*, int, mpg123_handle*, int);
int synth_ntom_s32_mono (real*, mpg123_handle*);
int synth_ntom_s32_m2s(real*, mpg123_handle*);
int INT123_synth_ntom_s32 (real*, int, mpg123_handle*, int);
int INT123_synth_ntom_s32_mono (real*, mpg123_handle*);
int INT123_synth_ntom_s32_m2s(real*, mpg123_handle*);
#endif
#endif
#endif /* FIXED */
/* Inside these synth functions, some dct64 variants may be used.
/* Inside these synth functions, some INT123_dct64 variants may be used.
The special optimized ones that only appear in assembler code are not mentioned here.
And, generally, these functions are only employed in a matching synth function. */
void dct64 (real *,real *,real *);
void dct64_i386 (real *,real *,real *);
void dct64_altivec(real *,real *,real *);
void dct64_i486(int*, int* , real*); /* Yeah, of no use outside of synth_i486.c .*/
void INT123_dct64 (real *,real *,real *);
void INT123_dct64_i386 (real *,real *,real *);
void INT123_dct64_altivec(real *,real *,real *);
void INT123_dct64_i486(int*, int* , real*); /* Yeah, of no use outside of synth_i486.c .*/
/* This is used by the layer 3 decoder, one generic function and 3DNow variants. */
void dct36 (real *,real *,real *,const real *,real *);
void dct36_3dnow (real *,real *,real *,const real *,real *);
void dct36_3dnowext(real *,real *,real *,const real *,real *);
void dct36_x86_64 (real *,real *,real *,const real *,real *);
void dct36_sse (real *,real *,real *,const real *,real *);
void dct36_avx (real *,real *,real *,const real *,real *);
void dct36_neon (real *,real *,real *,const real *,real *);
void dct36_neon64 (real *,real *,real *,const real *,real *);
void INT123_dct36 (real *,real *,real *,const real *,real *);
void INT123_dct36_3dnow (real *,real *,real *,const real *,real *);
void INT123_dct36_3dnowext(real *,real *,real *,const real *,real *);
void INT123_dct36_x86_64 (real *,real *,real *,const real *,real *);
void INT123_dct36_sse (real *,real *,real *,const real *,real *);
void INT123_dct36_avx (real *,real *,real *,const real *,real *);
void INT123_dct36_neon (real *,real *,real *,const real *,real *);
void INT123_dct36_neon64 (real *,real *,real *,const real *,real *);
/* Tools for NtoM resampling synth, defined in ntom.c . */
int synth_ntom_set_step(mpg123_handle *fr); /* prepare ntom decoding */
unsigned long ntom_val(mpg123_handle *fr, off_t frame); /* compute ntom_val for frame offset */
int INT123_synth_ntom_set_step(mpg123_handle *fr); /* prepare ntom decoding */
unsigned long INT123_ntom_val(mpg123_handle *fr, int64_t frame); /* compute INT123_ntom_val for frame offset */
/* Frame and sample offsets. */
#ifndef NO_NTOM
/*
Outsamples of _this_ frame.
To be exact: The samples to be expected from the next frame decode (using the current ntom_val). When you already decoded _this_ frame, this is the number of samples to be expected from the next one.
To be exact: The samples to be expected from the next frame decode (using the current INT123_ntom_val). When you already decoded _this_ frame, this is the number of samples to be expected from the next one.
*/
off_t ntom_frame_outsamples(mpg123_handle *fr);
int64_t INT123_ntom_frame_outsamples(mpg123_handle *fr);
/* Total out/insample offset. */
off_t ntom_frmouts(mpg123_handle *fr, off_t frame);
off_t ntom_ins2outs(mpg123_handle *fr, off_t ins);
off_t ntom_frameoff(mpg123_handle *fr, off_t soff);
int64_t INT123_ntom_frmouts(mpg123_handle *fr, int64_t frame);
int64_t INT123_ntom_ins2outs(mpg123_handle *fr, int64_t ins);
int64_t INT123_ntom_frameoff(mpg123_handle *fr, int64_t soff);
#endif
/* Initialization of any static data that majy be needed at runtime.
Make sure you call these once before it is too late. */
#ifndef NO_LAYER3
#ifdef RUNTIME_TABLES
void init_layer3(void);
void INT123_init_layer3(void);
#endif
real init_layer3_gainpow2(mpg123_handle *fr, int i);
void init_layer3_stuff(mpg123_handle *fr, real (*gainpow2)(mpg123_handle *fr, int i));
real INT123_init_layer3_gainpow2(mpg123_handle *fr, int i);
void INT123_init_layer3_stuff(mpg123_handle *fr, real (*gainpow2)(mpg123_handle *fr, int i));
#endif
#ifndef NO_LAYER12
#ifdef RUNTIME_TABLES
void init_layer12(void);
void INT123_init_layer12(void);
#endif
real* init_layer12_table(mpg123_handle *fr, real *table, int m);
void init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr, real *table, int m));
real* INT123_init_layer12_table(mpg123_handle *fr, real *table, int m);
void INT123_init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr, real *table, int m));
#endif
#ifdef RUNTIME_TABLES
void init_costabs(void);
void INT123_init_costabs(void);
#else
const
#endif
extern real *pnts[5]; /* costab.h provides, dct64 needs */
extern real *INT123_pnts[5]; /* costab.h provides, INT123_dct64 needs */
/* Runtime (re)init functions; needed more often. */
void make_decode_tables(mpg123_handle *fr); /* For every volume change. */
/* Stuff needed after updating synth setup (see set_synth_functions()). */
void INT123_make_decode_tables(mpg123_handle *fr); /* For every volume change. */
/* Stuff needed after updating synth setup (see INT123_set_synth_functions()). */
#ifdef OPT_MMXORSSE
/* Special treatment for mmx-like decoders, these functions go into the slots below. */
void make_decode_tables_mmx(mpg123_handle *fr);
void INT123_make_decode_tables_mmx(mpg123_handle *fr);
#ifndef NO_LAYER3
real init_layer3_gainpow2_mmx(mpg123_handle *fr, int i);
real INT123_init_layer3_gainpow2_mmx(mpg123_handle *fr, int i);
#endif
#ifndef NO_LAYER12
real* init_layer12_table_mmx(mpg123_handle *fr, real *table, int m);
real* INT123_init_layer12_table_mmx(mpg123_handle *fr, real *table, int m);
#endif
#endif
#ifndef NO_8BIT
/* Needed when switching to 8bit output. */
int make_conv16to8_table(mpg123_handle *fr);
int INT123_make_conv16to8_table(mpg123_handle *fr);
#endif
/* These are the actual workers.
......@@ -278,15 +278,15 @@ int make_conv16to8_table(mpg123_handle *fr);
The synth functions defined above are called from inside the layer handlers. */
#ifndef NO_LAYER3
int do_layer3(mpg123_handle *fr);
int INT123_do_layer3(mpg123_handle *fr);
#endif
#ifndef NO_LAYER2
int do_layer2(mpg123_handle *fr);
int INT123_do_layer2(mpg123_handle *fr);
#endif
#ifndef NO_LAYER1
int do_layer1(mpg123_handle *fr);
int INT123_do_layer1(mpg123_handle *fr);
#endif
/* There's an 3DNow counterpart in asm. */
void do_equalizer(real *bandPtr,int channel, real equalizer[2][32]);
void INT123_do_equalizer(real *bandPtr,int channel, real equalizer[2][32]);
#endif
/* Hack to allow building the same code with and without libtool. */
#include "intsym.h"
#include "dither_impl.h"
......@@ -18,6 +18,6 @@ enum mpg123_noise_type
};
void mpg123_noise(float* table, size_t count, enum mpg123_noise_type noisetype);
void dither_table_init(float *dithertable);
void INT123_dither_table_init(float *dithertable);
#endif
......@@ -113,7 +113,7 @@ void mpg123_noise(float* table, size_t count, enum mpg123_noise_type noisetype)
}
/* Generate white noise and shape it with a high pass filter. */
void dither_table_init(float *dithertable)
void INT123_dither_table_init(float *dithertable)
{
highpass_tpdf_noise(dithertable, DITHERSIZE);
}
......@@ -9,7 +9,7 @@
#include "mpg123lib_intern.h"
void do_equalizer(real *bandPtr,int channel, real equalizer[2][32])
void INT123_do_equalizer(real *bandPtr,int channel, real equalizer[2][32])
{
int i;
for(i=0;i<32;i++)
......
/*
format: routines to deal with audio (output) format
copyright 2008-20 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2008-23 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, starting with parts of the old audio.c, with only faintly manage to show now
......@@ -223,7 +223,7 @@ eend:
/* match constraints against supported audio formats, store possible setup in frame
return: -1: error; 0: no format change; 1: format change */
int frame_output_format(mpg123_handle *fr)
int INT123_frame_output_format(mpg123_handle *fr)
{
struct audioformat nf;
int f0=0;
......@@ -232,7 +232,7 @@ int frame_output_format(mpg123_handle *fr)
int try_float = (p->flags & MPG123_FLOAT_FALLBACK) ? 0 : 1;
/* initialize new format, encoding comes later */
nf.channels = fr->stereo;
mdebug("native frame format: %d ch @ %ld Hz", fr->stereo, frame_freq(fr));
mdebug("native frame format: %d ch @ %ld Hz", fr->stereo, INT123_frame_freq(fr));
// I intended the forcing stuff to be weaved into the format support table,
// but this probably will never happen, as this would change library behaviour.
// One could introduce an additional effective format table that takes for
......@@ -287,30 +287,30 @@ int frame_output_format(mpg123_handle *fr)
}
#endif
// Native decoder rate first.
if(enc_chan_fit(p, frame_freq(fr)>>p->down_sample, &nf, f0, f2, try_float))
if(enc_chan_fit(p, INT123_frame_freq(fr)>>p->down_sample, &nf, f0, f2, try_float))
goto end;
// Then downsamplings.
if(p->flags & MPG123_AUTO_RESAMPLE && p->down_sample < 2)
{
if(enc_chan_fit( p, frame_freq(fr)>>(p->down_sample+1), &nf
if(enc_chan_fit( p, INT123_frame_freq(fr)>>(p->down_sample+1), &nf
, f0, f2, try_float ))
goto end;
if(p->down_sample < 1 && enc_chan_fit( p, frame_freq(fr)>>2, &nf
if(p->down_sample < 1 && enc_chan_fit( p, INT123_frame_freq(fr)>>2, &nf
, f0, f2, try_float ))
goto end;
}
// And again the whole deal with float fallback.
if(!try_float)
{
if(enc_chan_fit(p, frame_freq(fr)>>p->down_sample, &nf, f0, f2, TRUE))
if(enc_chan_fit(p, INT123_frame_freq(fr)>>p->down_sample, &nf, f0, f2, TRUE))
goto end;
// Then downsamplings.
if(p->flags & MPG123_AUTO_RESAMPLE && p->down_sample < 2)
{
if(enc_chan_fit( p, frame_freq(fr)>>(p->down_sample+1), &nf
if(enc_chan_fit( p, INT123_frame_freq(fr)>>(p->down_sample+1), &nf
, f0, f2, TRUE ))
goto end;
if(p->down_sample < 1 && enc_chan_fit( p, frame_freq(fr)>>2, &nf
if(p->down_sample < 1 && enc_chan_fit( p, INT123_frame_freq(fr)>>2, &nf
, f0, f2, TRUE ))
goto end;
}
......@@ -320,7 +320,7 @@ int frame_output_format(mpg123_handle *fr)
if( p->flags & MPG123_AUTO_RESAMPLE && fr->p.down_sample == 0)
{
int i;
int rn = rate2num(p, frame_freq(fr));
int rn = rate2num(p, INT123_frame_freq(fr));
int rrn;
if(rn < 0) return 0;
/* Try higher rates first. */
......@@ -352,9 +352,9 @@ int frame_output_format(mpg123_handle *fr)
(p->flags & MPG123_FORCE_MONO ? "mono, " : "") )
, ( p->flags & MPG123_FORCE_FLOAT ? "float, " :
(p->flags & MPG123_FORCE_8BIT ? "8bit, " : "") )
, frame_freq(fr)>>p->down_sample
, frame_freq(fr)>>(p->down_sample ? p->down_sample : 1)
, frame_freq(fr)>>2 );
, INT123_frame_freq(fr)>>p->down_sample
, INT123_frame_freq(fr)>>(p->down_sample ? p->down_sample : 1)
, INT123_frame_freq(fr)>>2 );
/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */
fr->err = MPG123_BAD_OUTFORMAT;
......@@ -549,7 +549,7 @@ int attribute_align_arg mpg123_fmt_support(mpg123_pars *mp, long rate, int encod
}
/* Call this one to ensure that any valid format will be something different than this. */
void invalidate_format(struct audioformat *af)
void INT123_invalidate_format(struct audioformat *af)
{
af->encoding = 0;
af->rate = 0;
......@@ -557,25 +557,25 @@ void invalidate_format(struct audioformat *af)
}
/* Number of bytes the decoder produces. */
off_t decoder_synth_bytes(mpg123_handle *fr, off_t s)
int64_t INT123_decoder_synth_bytes(mpg123_handle *fr, int64_t s)
{
return s * fr->af.dec_encsize * fr->af.channels;
}
/* Samples/bytes for output buffer after post-processing. */
/* take into account: channels, bytes per sample -- NOT resampling!*/
off_t samples_to_bytes(mpg123_handle *fr , off_t s)
int64_t INT123_samples_to_bytes(mpg123_handle *fr , int64_t s)
{
return s * fr->af.encsize * fr->af.channels;
}
off_t bytes_to_samples(mpg123_handle *fr , off_t b)
int64_t INT123_bytes_to_samples(mpg123_handle *fr , int64_t b)
{
return b / fr->af.encsize / fr->af.channels;
}
/* Number of bytes needed for decoding _and_ post-processing. */
off_t outblock_bytes(mpg123_handle *fr, off_t s)
int64_t INT123_outblock_bytes(mpg123_handle *fr, int64_t s)
{
int encsize = (fr->af.encoding & MPG123_ENC_24)
? 4 /* Intermediate 32 bit. */
......@@ -636,7 +636,7 @@ static void conv_s16_to_u16(struct outbuffer *buf)
#ifndef NO_REAL
static void conv_s16_to_f32(struct outbuffer *buf)
{
ssize_t i;
ptrdiff_t i;
int16_t *in = (int16_t*) buf->data;
float *out = (float*) buf->data;
size_t count = buf->fill/sizeof(int16_t);
......@@ -662,7 +662,7 @@ static void conv_s16_to_f32(struct outbuffer *buf)
#ifndef NO_32BIT
static void conv_s16_to_s32(struct outbuffer *buf)
{
ssize_t i;
ptrdiff_t i;
int16_t *in = (int16_t*) buf->data;
int32_t *out = (int32_t*) buf->data;
size_t count = buf->fill/sizeof(int16_t);
......@@ -699,7 +699,7 @@ void swap_endian(struct outbuffer *buf, int block)
}
}
void postprocess_buffer(mpg123_handle *fr)
void INT123_postprocess_buffer(mpg123_handle *fr)
{
/*
This caters for the final output formats that are never produced by
......
/*
frame: Heap of routines dealing with the core mpg123 data structure.
copyright 2008-2021 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2008-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
......@@ -68,12 +68,12 @@ static void frame_default_pars(mpg123_pars *mp)
mp->freeformat_framesize = -1;
}
void frame_init(mpg123_handle *fr)
void INT123_frame_init(mpg123_handle *fr)
{
frame_init_par(fr, NULL);
INT123_frame_init_par(fr, NULL);
}
void frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
void INT123_frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
{
fr->own_buffer = TRUE;
fr->buffer.data = NULL;
......@@ -98,37 +98,34 @@ void frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
#ifdef OPT_CPU_FLAGS
wrap_getcpuflags(&(fr->cpu_flags));
#endif
fr->cpu_opts.type = defdec();
fr->cpu_opts.class = decclass(fr->cpu_opts.type);
fr->cpu_opts.type = INT123_defdec();
fr->cpu_opts.class = INT123_decclass(fr->cpu_opts.type);
#ifndef NO_NTOM
/* these two look unnecessary, check guarantee for synth_ntom_set_step (in control_generic, even)! */
fr->ntom_val[0] = NTOM_MUL>>1;
fr->ntom_val[1] = NTOM_MUL>>1;
/* these two look unnecessary, check guarantee for INT123_synth_ntom_set_step (in control_generic, even)! */
fr->INT123_ntom_val[0] = NTOM_MUL>>1;
fr->INT123_ntom_val[1] = NTOM_MUL>>1;
fr->ntom_step = NTOM_MUL;
#endif
/* unnecessary: fr->buffer.size = fr->buffer.fill = 0; */
mpg123_reset_eq(fr);
init_icy(&fr->icy);
init_id3(fr);
/* frame_outbuffer is missing... */
/* frame_buffers is missing... that one needs cpu opt setting! */
/* after these... frame_reset is needed before starting full decode */
invalidate_format(&fr->af);
fr->rdat.r_read = NULL;
fr->rdat.r_lseek = NULL;
INT123_init_icy(&fr->icy);
INT123_init_id3(fr);
/* INT123_frame_outbuffer is missing... */
/* INT123_frame_buffers is missing... that one needs cpu opt setting! */
/* after these... INT123_frame_reset is needed before starting full decode */
INT123_invalidate_format(&fr->af);
fr->rdat.iohandle = NULL;
fr->rdat.r_read_handle = NULL;
fr->rdat.r_lseek_handle = NULL;
fr->rdat.r_read64 = NULL;
fr->rdat.r_lseek64 = NULL;
fr->rdat.cleanup_handle = NULL;
fr->wrapperdata = NULL;
fr->wrapperclean = NULL;
fr->decoder_change = 1;
fr->err = MPG123_OK;
if(mp == NULL) frame_default_pars(&fr->p);
else memcpy(&fr->p, mp, sizeof(struct mpg123_pars_struct));
#ifndef NO_FEEDER
bc_prepare(&fr->rdat.buffer, fr->p.feedpool, fr->p.feedbuffer);
INT123_bc_prepare(&fr->rdat.buffer, fr->p.feedpool, fr->p.feedbuffer);
#endif
fr->down_sample = 0; /* Initialize to silence harmless errors when debugging. */
......@@ -136,10 +133,10 @@ void frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
frame_fixed_reset(fr); /* Reset only the fixed data, dynamic buffers are not there yet! */
fr->synth = NULL;
fr->synth_mono = NULL;
fr->make_decode_tables = NULL;
fr->INT123_make_decode_tables = NULL;
#ifdef FRAME_INDEX
fi_init(&fr->index);
frame_index_setup(fr); /* Apply the size setting. */
INT123_fi_init(&fr->index);
INT123_frame_index_setup(fr); /* Apply the size setting. */
#endif
#ifndef NO_MOREINFO
fr->pinfo = NULL;
......@@ -149,7 +146,7 @@ void frame_init_par(mpg123_handle *fr, mpg123_pars *mp)
#ifdef OPT_DITHER
/* Also, only allocate the memory for the table on demand.
In future, one could create special noise for different sampling frequencies(?). */
int frame_dither_init(mpg123_handle *fr)
int INT123_frame_dither_init(mpg123_handle *fr)
{
/* run-time dither noise table generation */
if(fr->dithernoise == NULL)
......@@ -157,7 +154,7 @@ int frame_dither_init(mpg123_handle *fr)
fr->dithernoise = malloc(sizeof(float)*DITHERSIZE);
if(fr->dithernoise == NULL) return 0;
dither_table_init(fr->dithernoise);
INT123_dither_table_init(fr->dithernoise);
}
return 1;
}
......@@ -187,7 +184,7 @@ int attribute_align_arg mpg123_reset_eq(mpg123_handle *mh)
return MPG123_OK;
}
int frame_outbuffer(mpg123_handle *fr)
int INT123_frame_outbuffer(mpg123_handle *fr)
{
size_t size = fr->outblock;
if(!fr->own_buffer)
......@@ -243,19 +240,19 @@ int attribute_align_arg mpg123_replace_buffer(mpg123_handle *mh, void *data, siz
}
#ifdef FRAME_INDEX
int frame_index_setup(mpg123_handle *fr)
int INT123_frame_index_setup(mpg123_handle *fr)
{
int ret = MPG123_ERR;
if(fr->p.index_size >= 0)
{ /* Simple fixed index. */
fr->index.grow_size = 0;
ret = fi_resize(&fr->index, (size_t)fr->p.index_size);
ret = INT123_fi_resize(&fr->index, (size_t)fr->p.index_size);
}
else
{ /* A growing index. We give it a start, though. */
fr->index.grow_size = (size_t)(- fr->p.index_size);
if(fr->index.size < fr->index.grow_size)
ret = fi_resize(&fr->index, fr->index.grow_size);
ret = INT123_fi_resize(&fr->index, fr->index.grow_size);
else
ret = MPG123_OK; /* We have minimal size already... and since growing is OK... */
}
......@@ -272,7 +269,7 @@ static void frame_decode_buffers_reset(mpg123_handle *fr)
memset(fr->rawbuffs, 0, fr->rawbuffss);
}
int frame_buffers(mpg123_handle *fr)
int INT123_frame_buffers(mpg123_handle *fr)
{
int buffssize = 0;
debug1("frame %p buffer", (void*)fr);
......@@ -445,7 +442,7 @@ int frame_buffers(mpg123_handle *fr)
return 0;
}
int frame_buffers_reset(mpg123_handle *fr)
int INT123_frame_buffers_reset(mpg123_handle *fr)
{
fr->buffer.fill = 0; /* hm, reset buffer fill... did we do a flush? */
fr->bsnum = 0;
......@@ -477,7 +474,7 @@ static void frame_free_toc(mpg123_handle *fr)
}
/* Just copy the Xing TOC over... */
int frame_fill_toc(mpg123_handle *fr, unsigned char* in)
int INT123_frame_fill_toc(mpg123_handle *fr, unsigned char* in)
{
if(fr->xing_toc == NULL) fr->xing_toc = malloc(100);
if(fr->xing_toc != NULL)
......@@ -498,13 +495,13 @@ int frame_fill_toc(mpg123_handle *fr, unsigned char* in)
/* Prepare the handle for a new track.
Reset variables, buffers... */
int frame_reset(mpg123_handle* fr)
int INT123_frame_reset(mpg123_handle* fr)
{
frame_buffers_reset(fr);
INT123_frame_buffers_reset(fr);
frame_fixed_reset(fr);
frame_free_toc(fr);
#ifdef FRAME_INDEX
fi_reset(&fr->index);
INT123_fi_reset(&fr->index);
#endif
return 0;
......@@ -514,7 +511,7 @@ int frame_reset(mpg123_handle* fr)
static void frame_fixed_reset(mpg123_handle *fr)
{
frame_icy_reset(fr);
open_bad(fr);
INT123_open_bad(fr);
fr->to_decode = FALSE;
fr->to_ignore = FALSE;
fr->metaflags = 0;
......@@ -552,7 +549,7 @@ static void frame_fixed_reset(mpg123_handle *fr)
fr->fresh = 1;
fr->new_format = 0;
#ifdef GAPLESS
frame_gapless_init(fr,-1,0,0);
INT123_frame_gapless_init(fr,-1,0,0);
fr->lastoff = 0;
fr->firstoff = 0;
#endif
......@@ -563,8 +560,8 @@ static void frame_fixed_reset(mpg123_handle *fr)
#ifdef OPT_DITHER
fr->ditherindex = 0;
#endif
reset_id3(fr);
reset_icy(&fr->icy);
INT123_reset_id3(fr);
INT123_reset_icy(&fr->icy);
/* ICY stuff should go into icy.c, eh? */
#ifndef NO_ICY
fr->icy.interval = 0;
......@@ -597,7 +594,7 @@ static void frame_free_buffers(mpg123_handle *fr)
if(fr->layerscratch != NULL) free(fr->layerscratch);
}
void frame_exit(mpg123_handle *fr)
void INT123_frame_exit(mpg123_handle *fr)
{
if(fr->buffer.rdata != NULL)
{
......@@ -608,7 +605,7 @@ void frame_exit(mpg123_handle *fr)
frame_free_buffers(fr);
frame_free_toc(fr);
#ifdef FRAME_INDEX
fi_exit(&fr->index);
INT123_fi_exit(&fr->index);
#endif
#ifdef OPT_DITHER
if(fr->dithernoise != NULL)
......@@ -617,16 +614,10 @@ void frame_exit(mpg123_handle *fr)
fr->dithernoise = NULL;
}
#endif
exit_id3(fr);
clear_icy(&fr->icy);
/* Clean up possible mess from LFS wrapper. */
if(fr->wrapperclean != NULL)
{
fr->wrapperclean(fr->wrapperdata);
fr->wrapperdata = NULL;
}
INT123_exit_id3(fr);
INT123_clear_icy(&fr->icy);
#ifndef NO_FEEDER
bc_cleanup(&fr->rdat.buffer);
INT123_bc_cleanup(&fr->rdat.buffer);
#endif
}
......@@ -662,10 +653,10 @@ int attribute_align_arg mpg123_set_moreinfo( mpg123_handle *mh
- guess wildly from mean framesize and offset of first frame / beginning of file.
*/
static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame)
static int64_t frame_fuzzy_find(mpg123_handle *fr, int64_t want_frame, int64_t* get_frame)
{
/* Default is to go to the beginning. */
off_t ret = fr->audio_start;
int64_t ret = fr->audio_start;
*get_frame = 0;
/* But we try to find something better. */
......@@ -681,12 +672,12 @@ static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t* get_fr
if(toc_entry > 99) toc_entry = 99;
/* Now estimate back what frame we get. */
*get_frame = (off_t) ((double)toc_entry/100. * fr->track_frames);
*get_frame = (int64_t) ((double)toc_entry/100. * fr->track_frames);
fr->state_flags &= ~FRAME_ACCURATE;
fr->silent_resync = 1;
/* Question: Is the TOC for whole file size (with/without ID3) or the "real" audio data only?
ID3v1 info could also matter. */
ret = (off_t) ((double)fr->xing_toc[toc_entry]/256.* fr->rdat.filelen);
ret = (int64_t) ((double)fr->xing_toc[toc_entry]/256.* fr->rdat.filelen);
}
else if(fr->mean_framesize > 0)
{ /* Just guess with mean framesize (may be exact with CBR files). */
......@@ -694,26 +685,28 @@ static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t* get_fr
fr->state_flags &= ~FRAME_ACCURATE; /* Fuzzy! */
fr->silent_resync = 1;
*get_frame = want_frame;
ret = (off_t) (fr->audio_start+fr->mean_framesize*want_frame);
ret = (int64_t) (fr->audio_start+fr->mean_framesize*want_frame);
}
debug5("fuzzy: want %li of %li, get %li at %li B of %li B",
(long)want_frame, (long)fr->track_frames, (long)*get_frame, (long)ret, (long)(fr->rdat.filelen-fr->audio_start));
debug5("fuzzy: want %" PRIi64 " of %" PRIi64
", get %" PRIi64 " at %" PRIi64 " B of %" PRIi64 " B"
, want_frame, fr->track_frames, *get_frame, ret
, (fr->rdat.filelen-fr->audio_start));
return ret;
}
/*
find the best frame in index just before the wanted one, seek to there
then step to just before wanted one with read_frame
then step to just before wanted one with INT123_read_frame
do not care tabout the stuff that was in buffer but not played back
everything that left the decoder is counted as played
Decide if you want low latency reaction and accurate timing info or stable long-time playback with buffer!
*/
off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame)
int64_t INT123_frame_index_find(mpg123_handle *fr, int64_t want_frame, int64_t* get_frame)
{
/* default is file start if no index position */
off_t gopos = 0;
int64_t gopos = 0;
*get_frame = 0;
#ifdef FRAME_INDEX
/* Possibly use VBRI index, too? I'd need an example for this... */
......@@ -751,13 +744,13 @@ off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame)
#ifdef FRAME_INDEX
}
#endif
debug2("index: 0x%lx for frame %li", (unsigned long)gopos, (long) *get_frame);
debug2("index: 0x%" PRIx64 " for frame %" PRIi64, (uint64_t)gopos, *get_frame);
return gopos;
}
off_t frame_ins2outs(mpg123_handle *fr, off_t ins)
int64_t INT123_frame_ins2outs(mpg123_handle *fr, int64_t ins)
{
off_t outs = 0;
int64_t outs = 0;
switch(fr->down_sample)
{
case 0:
......@@ -768,7 +761,7 @@ off_t frame_ins2outs(mpg123_handle *fr, off_t ins)
outs = ins>>fr->down_sample;
break;
# ifndef NO_NTOM
case 3: outs = ntom_ins2outs(fr, ins); break;
case 3: outs = INT123_ntom_ins2outs(fr, ins); break;
# endif
default: if(NOQUIET)
merror( "Bad down_sample (%i) ... should not be possible!!"
......@@ -777,9 +770,9 @@ off_t frame_ins2outs(mpg123_handle *fr, off_t ins)
return outs;
}
off_t frame_outs(mpg123_handle *fr, off_t num)
int64_t INT123_frame_outs(mpg123_handle *fr, int64_t num)
{
off_t outs = 0;
int64_t outs = 0;
switch(fr->down_sample)
{
case 0:
......@@ -790,7 +783,7 @@ off_t frame_outs(mpg123_handle *fr, off_t num)
outs = (fr->spf>>fr->down_sample)*num;
break;
#ifndef NO_NTOM
case 3: outs = ntom_frmouts(fr, num); break;
case 3: outs = INT123_ntom_frmouts(fr, num); break;
#endif
default: if(NOQUIET)
merror( "Bad down_sample (%i) ... should not be possible!!"
......@@ -801,9 +794,9 @@ off_t frame_outs(mpg123_handle *fr, off_t num)
/* Compute the number of output samples we expect from this frame.
This is either simple spf() or a tad more elaborate for ntom. */
off_t frame_expect_outsamples(mpg123_handle *fr)
int64_t INT123_frame_expect_outsamples(mpg123_handle *fr)
{
off_t outs = 0;
int64_t outs = 0;
switch(fr->down_sample)
{
case 0:
......@@ -814,7 +807,7 @@ off_t frame_expect_outsamples(mpg123_handle *fr)
outs = fr->spf>>fr->down_sample;
break;
#ifndef NO_NTOM
case 3: outs = ntom_frame_outsamples(fr); break;
case 3: outs = INT123_ntom_frame_outsamples(fr); break;
#endif
default: if(NOQUIET)
merror( "Bad down_sample (%i) ... should not be possible!!"
......@@ -823,9 +816,9 @@ off_t frame_expect_outsamples(mpg123_handle *fr)
return outs;
}
off_t frame_offset(mpg123_handle *fr, off_t outs)
int64_t INT123_frame_offset(mpg123_handle *fr, int64_t outs)
{
off_t num = 0;
int64_t num = 0;
switch(fr->down_sample)
{
case 0:
......@@ -836,7 +829,7 @@ off_t frame_offset(mpg123_handle *fr, off_t outs)
num = outs/(fr->spf>>fr->down_sample);
break;
#ifndef NO_NTOM
case 3: num = ntom_frameoff(fr, outs); break;
case 3: num = INT123_ntom_frameoff(fr, outs); break;
#endif
default: if(NOQUIET)
error("Bad down_sample ... should not be possible!!");
......@@ -846,9 +839,9 @@ off_t frame_offset(mpg123_handle *fr, off_t outs)
#ifdef GAPLESS
/* input in _input_ samples */
void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip)
void INT123_frame_gapless_init(mpg123_handle *fr, int64_t framecount, int64_t bskip, int64_t eskip)
{
debug3("frame_gapless_init: given %"OFF_P" frames, skip %"OFF_P" and %"OFF_P, (off_p)framecount, (off_p)bskip, (off_p)eskip);
debug3("INT123_frame_gapless_init: given %"PRIi64" frames, skip %"PRIi64" and %"PRIi64, framecount, bskip, eskip);
fr->gapless_frames = framecount;
if(fr->gapless_frames > 0 && bskip >=0 && eskip >= 0)
{
......@@ -860,40 +853,42 @@ void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t
fr->begin_os = 0;
fr->end_os = 0;
fr->fullend_os = 0;
debug2("frame_gapless_init: from %"OFF_P" to %"OFF_P" samples", (off_p)fr->begin_s, (off_p)fr->end_s);
debug2("INT123_frame_gapless_init: from %"PRIi64" to %"PRIi64" samples", fr->begin_s, fr->end_s);
}
void frame_gapless_realinit(mpg123_handle *fr)
void INT123_frame_gapless_realinit(mpg123_handle *fr)
{
fr->begin_os = frame_ins2outs(fr, fr->begin_s);
fr->end_os = frame_ins2outs(fr, fr->end_s);
fr->begin_os = INT123_frame_ins2outs(fr, fr->begin_s);
fr->end_os = INT123_frame_ins2outs(fr, fr->end_s);
if(fr->gapless_frames > 0)
fr->fullend_os = frame_ins2outs(fr, fr->gapless_frames*fr->spf);
fr->fullend_os = INT123_frame_ins2outs(fr, fr->gapless_frames*fr->spf);
else fr->fullend_os = 0;
debug4("frame_gapless_realinit: from %"OFF_P" to %"OFF_P" samples (%"OFF_P", %"OFF_P")", (off_p)fr->begin_os, (off_p)fr->end_os, (off_p)fr->fullend_os, (off_p)fr->gapless_frames);
debug4("INT123_frame_gapless_realinit: from %"PRIi64" to %"PRIi64" samples (%"PRIi64", %"PRIi64")"
, fr->begin_os, fr->end_os, fr->fullend_os, fr->gapless_frames);
}
/* At least note when there is trouble... */
void frame_gapless_update(mpg123_handle *fr, off_t total_samples)
void INT123_frame_gapless_update(mpg123_handle *fr, int64_t total_samples)
{
off_t gapless_samples = fr->gapless_frames*fr->spf;
int64_t gapless_samples = fr->gapless_frames*fr->spf;
if(fr->gapless_frames < 1) return;
debug2("gapless update with new sample count %"OFF_P" as opposed to known %"OFF_P, (off_p)total_samples, (off_p)gapless_samples);
debug2("gapless update with new sample count %"PRIi64" as opposed to known %"PRIi64, total_samples, gapless_samples);
if(NOQUIET && total_samples != gapless_samples)
fprintf(stderr, "\nWarning: Real sample count %"OFF_P" differs from given gapless sample count %"OFF_P". Frankenstein stream?\n"
, (off_p)total_samples, (off_p)gapless_samples);
fprintf(stderr, "\nWarning: Real sample count %" PRIi64
" differs from given gapless sample count %" PRIi64
". Frankenstein stream?\n", total_samples, gapless_samples);
if(gapless_samples > total_samples)
{
if(NOQUIET)
merror( "End sample count smaller than gapless end! (%"OFF_P
" < %"OFF_P"). Disabling gapless mode from now on."
, (off_p)total_samples, (off_p)fr->end_s );
merror( "End sample count smaller than gapless end! (%" PRIi64
" < %"PRIi64"). Disabling gapless mode from now on."
, total_samples, fr->end_s );
/* This invalidates the current position... but what should I do? */
frame_gapless_init(fr, -1, 0, 0);
frame_gapless_realinit(fr);
INT123_frame_gapless_init(fr, -1, 0, 0);
INT123_frame_gapless_realinit(fr);
fr->lastframe = -1;
fr->lastoff = 0;
}
......@@ -902,9 +897,9 @@ void frame_gapless_update(mpg123_handle *fr, off_t total_samples)
#endif
/* Compute the needed frame to ignore from, for getting accurate/consistent output for intended firstframe. */
static off_t ignoreframe(mpg123_handle *fr)
static int64_t ignoreframe(mpg123_handle *fr)
{
off_t preshift = fr->p.preframes;
int64_t preshift = fr->p.preframes;
/* Layer 3 _really_ needs at least one frame before. */
if(fr->lay==3 && preshift < 1) preshift = 1;
/* Layer 1 & 2 reall do not need more than 2. */
......@@ -917,64 +912,68 @@ static off_t ignoreframe(mpg123_handle *fr)
Seek to frame offset 1 may be just seek to 200 samples offset in output since the beginning of first frame is delay/padding.
Hm, is that right? OK for the padding stuff, but actually, should the decoder delay be better totally hidden or not?
With gapless, even the whole frame position could be advanced further than requested (since Homey don't play dat). */
void frame_set_frameseek(mpg123_handle *fr, off_t fe)
void INT123_frame_set_frameseek(mpg123_handle *fr, int64_t fe)
{
fr->firstframe = fe;
#ifdef GAPLESS
if(fr->p.flags & MPG123_GAPLESS && fr->gapless_frames > 0)
{
/* Take care of the beginning... */
off_t beg_f = frame_offset(fr, fr->begin_os);
int64_t beg_f = INT123_frame_offset(fr, fr->begin_os);
if(fe <= beg_f)
{
fr->firstframe = beg_f;
fr->firstoff = fr->begin_os - frame_outs(fr, beg_f);
fr->firstoff = fr->begin_os - INT123_frame_outs(fr, beg_f);
}
else fr->firstoff = 0;
/* The end is set once for a track at least, on the frame_set_frameseek called in get_next_frame() */
/* The end is set once for a track at least, on the INT123_frame_set_frameseek called in get_next_frame() */
if(fr->end_os > 0)
{
fr->lastframe = frame_offset(fr,fr->end_os);
fr->lastoff = fr->end_os - frame_outs(fr, fr->lastframe);
fr->lastframe = INT123_frame_offset(fr,fr->end_os);
fr->lastoff = fr->end_os - INT123_frame_outs(fr, fr->lastframe);
} else {fr->lastframe = -1; fr->lastoff = 0; }
} else { fr->firstoff = fr->lastoff = 0; fr->lastframe = -1; }
#endif
fr->ignoreframe = ignoreframe(fr);
#ifdef GAPLESS
debug5("frame_set_frameseek: begin at %li frames and %li samples, end at %li and %li; ignore from %li",
(long) fr->firstframe, (long) fr->firstoff,
(long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe);
debug5("INT123_frame_set_frameseek: begin at %" PRIi64 " frames and %" PRIi64
" samples, end at %" PRIi64 " and %" PRIi64 "; ignore from %" PRIi64,
fr->firstframe, fr->firstoff
, fr->lastframe, fr->lastoff, fr->ignoreframe);
#else
debug3("frame_set_frameseek: begin at %li frames, end at %li; ignore from %li",
(long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe);
debug3("INT123_frame_set_frameseek: begin at %" PRIi64 " frames, end at %" PRIi64
"; ignore from %" PRIi64
, fr->firstframe, fr->lastframe, fr->ignoreframe);
#endif
}
void frame_skip(mpg123_handle *fr)
void INT123_frame_skip(mpg123_handle *fr)
{
#ifndef NO_LAYER3
if(fr->lay == 3) set_pointer(fr, 1, 512);
if(fr->lay == 3) INT123_set_pointer(fr, 1, 512);
#endif
}
/* Sample accurate seek prepare for decoder. */
/* This gets unadjusted output samples and takes resampling into account */
void frame_set_seek(mpg123_handle *fr, off_t sp)
void INT123_frame_set_seek(mpg123_handle *fr, int64_t sp)
{
fr->firstframe = frame_offset(fr, sp);
debug1("frame_set_seek: from %"OFF_P, fr->num);
fr->firstframe = INT123_frame_offset(fr, sp);
debug1("INT123_frame_set_seek: from %" PRIi64, fr->num);
#ifndef NO_NTOM
if(fr->down_sample == 3) ntom_set_ntom(fr, fr->firstframe);
if(fr->down_sample == 3) INT123_ntom_set_ntom(fr, fr->firstframe);
#endif
fr->ignoreframe = ignoreframe(fr);
#ifdef GAPLESS /* The sample offset is used for non-gapless mode, too! */
fr->firstoff = sp - frame_outs(fr, fr->firstframe);
debug5("frame_set_seek: begin at %li frames and %li samples, end at %li and %li; ignore from %li",
(long) fr->firstframe, (long) fr->firstoff,
(long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe);
fr->firstoff = sp - INT123_frame_outs(fr, fr->firstframe);
debug5("INT123_frame_set_seek: begin at %" PRIi64 " frames and %" PRIi64
" samples, end at %" PRIi64 " and %" PRIi64 "; ignore from %" PRIi64,
fr->firstframe, fr->firstoff
, fr->lastframe, fr->lastoff, fr->ignoreframe);
#else
debug3("frame_set_seek: begin at %li frames, end at %li; ignore from %li",
(long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe);
debug3("INT123_frame_set_seek: begin at %" PRIi64 " frames, end at %" PRIi64
"; ignore from %" PRIi64
, fr->firstframe, fr->lastframe, fr->ignoreframe);
#endif
}
......@@ -997,7 +996,7 @@ int attribute_align_arg mpg123_volume(mpg123_handle *mh, double vol)
if(vol >= 0) mh->p.outscale = vol;
else mh->p.outscale = 0.;
do_rva(mh);
INT123_do_rva(mh);
return MPG123_OK;
}
......@@ -1024,7 +1023,7 @@ static int get_rva(mpg123_handle *fr, double *peak, double *gain)
}
/* adjust the volume, taking both fr->outscale and rva values into account */
void do_rva(mpg123_handle *fr)
void INT123_do_rva(mpg123_handle *fr)
{
double peak = 0;
double gain = 0;
......@@ -1050,7 +1049,7 @@ void do_rva(mpg123_handle *fr)
debug3("changing scale value from %f to %f (peak estimated to %f)", fr->lastscale != -1 ? fr->lastscale : fr->p.outscale, newscale, (double) (newscale*peak));
fr->lastscale = newscale;
/* It may be too early, actually. */
if(fr->make_decode_tables != NULL) fr->make_decode_tables(fr); /* the actual work */
if(fr->INT123_make_decode_tables != NULL) fr->INT123_make_decode_tables(fr); /* the actual work */
}
}
......@@ -1064,7 +1063,7 @@ int attribute_align_arg mpg123_getvolume(mpg123_handle *mh, double *base, double
return MPG123_OK;
}
off_t attribute_align_arg mpg123_framepos(mpg123_handle *mh)
int64_t attribute_align_arg mpg123_framepos64(mpg123_handle *mh)
{
if(mh == NULL) return MPG123_ERR;
......
/*
frame: Central data structures and opmitization hooks.
copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
......@@ -24,7 +24,7 @@
#ifdef OPT_DITHER
#include "dither.h"
int frame_dither_init(mpg123_handle *fr);
int INT123_frame_dither_init(mpg123_handle *fr);
#endif
/* max = 1728 */
......@@ -56,7 +56,7 @@ struct audioformat
long rate;
};
void invalidate_format(struct audioformat *af);
void INT123_invalidate_format(struct audioformat *af);
struct mpg123_pars_struct
{
......@@ -151,7 +151,7 @@ struct mpg123_handle_struct
#ifndef NO_NTOM
/* decode_ntom */
unsigned long ntom_val[2];
unsigned long INT123_ntom_val[2];
unsigned long ntom_step;
#endif
/* special i486 fun */
......@@ -188,7 +188,7 @@ struct mpg123_handle_struct
func_synth_stereo synth_stereo;
func_synth_mono synth_mono;
/* Yes, this function is runtime-switched, too. */
void (*make_decode_tables)(mpg123_handle *fr); /* That is the volume control. */
void (*INT123_make_decode_tables)(mpg123_handle *fr); /* That is the volume control. */
int stereo; /* I _think_ 1 for mono and 2 for stereo */
int jsbound;
......@@ -220,10 +220,10 @@ struct mpg123_handle_struct
int framesize; /* computed framesize */
int freesize; /* free format frame size */
enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */
off_t num; /* frame offset ... */
off_t input_offset; /* byte offset of this frame in input stream */
off_t playnum; /* playback offset... includes repetitions, reset at seeks */
off_t audio_start; /* The byte offset in the file where audio data begins. */
int64_t num; /* frame offset ... */
int64_t input_offset; /* byte offset of this frame in input stream */
int64_t playnum; /* playback offset... includes repetitions, reset at seeks */
int64_t audio_start; /* The byte offset in the file where audio data begins. */
int state_flags;
char silent_resync; /* Do not complain for the next n resyncs. */
unsigned char* xing_toc; /* The seek TOC from Xing header. */
......@@ -250,10 +250,10 @@ struct mpg123_handle_struct
} rva;
/* input data */
off_t track_frames;
off_t track_samples;
int64_t track_frames;
int64_t track_samples;
double mean_framesize;
off_t mean_frames;
int64_t mean_frames;
int fsizeold;
int ssize;
unsigned int bitreservoir;
......@@ -277,18 +277,18 @@ struct mpg123_handle_struct
size_t outblock; /* number of bytes that this frame produces (upper bound) */
int to_decode; /* this frame holds data to be decoded */
int to_ignore; /* the same, somehow */
off_t firstframe; /* start decoding from here */
off_t lastframe; /* last frame to decode (for gapless or num_frames limit) */
off_t ignoreframe; /* frames to decode but discard before firstframe */
int64_t firstframe; /* start decoding from here */
int64_t lastframe; /* last frame to decode (for gapless or num_frames limit) */
int64_t ignoreframe; /* frames to decode but discard before firstframe */
#ifdef GAPLESS
off_t gapless_frames; /* frame count for the gapless part */
off_t firstoff; /* number of samples to ignore from firstframe */
off_t lastoff; /* number of samples to use from lastframe */
off_t begin_s; /* overall begin offset in samples */
off_t begin_os;
off_t end_s; /* overall end offset in samples */
off_t end_os;
off_t fullend_os; /* gapless_frames translated to output samples */
int64_t gapless_frames; /* frame count for the gapless part */
int64_t firstoff; /* number of samples to ignore from firstframe */
int64_t lastoff; /* number of samples to use from lastframe */
int64_t begin_s; /* overall begin offset in samples */
int64_t begin_os;
int64_t end_s; /* overall end offset in samples */
int64_t end_os;
int64_t fullend_os; /* gapless_frames translated to output samples */
#endif
unsigned int crc; /* Well, I need a safe 16bit type, actually. But wider doesn't hurt. */
struct reader *rd; /* pointer to the reading functions */
......@@ -342,8 +342,6 @@ struct mpg123_handle_struct
/* A place for storing additional data for the large file wrapper.
This is cruft! */
void *wrapperdata;
/* A callback used to properly destruct the wrapper data. */
void (*wrapperclean)(void*);
int enc_delay;
int enc_padding;
#ifndef NO_MOREINFO
......@@ -352,27 +350,27 @@ struct mpg123_handle_struct
};
/* generic init, does not include dynamic buffers */
void frame_init(mpg123_handle *fr);
void frame_init_par(mpg123_handle *fr, mpg123_pars *mp);
void INT123_frame_init(mpg123_handle *fr);
void INT123_frame_init_par(mpg123_handle *fr, mpg123_pars *mp);
/* output buffer and format */
int frame_outbuffer(mpg123_handle *fr);
int frame_output_format(mpg123_handle *fr);
int INT123_frame_outbuffer(mpg123_handle *fr);
int INT123_frame_output_format(mpg123_handle *fr);
int frame_buffers(mpg123_handle *fr); /* various decoder buffers, needed once */
int frame_reset(mpg123_handle* fr); /* reset for next track */
int frame_buffers_reset(mpg123_handle *fr);
void frame_exit(mpg123_handle *fr); /* end, free all buffers */
int INT123_frame_buffers(mpg123_handle *fr); /* various decoder buffers, needed once */
int INT123_frame_reset(mpg123_handle* fr); /* reset for next track */
int INT123_frame_buffers_reset(mpg123_handle *fr);
void INT123_frame_exit(mpg123_handle *fr); /* end, free all buffers */
/* Index functions... */
/* Well... print it... */
int mpg123_print_index(mpg123_handle *fr, FILE* out);
/* Find a seek position in index. */
off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame);
int64_t INT123_frame_index_find(mpg123_handle *fr, int64_t want_frame, int64_t* get_frame);
/* Apply index_size setting. */
int frame_index_setup(mpg123_handle *fr);
int INT123_frame_index_setup(mpg123_handle *fr);
void do_volume(mpg123_handle *fr, double factor);
void do_rva(mpg123_handle *fr);
void INT123_do_volume(mpg123_handle *fr, double factor);
void INT123_do_rva(mpg123_handle *fr);
/* samples per frame ...
Layer I
......@@ -396,20 +394,20 @@ MPEG 2.5
// The value is needed for mpg123_getstate() in any build.
#define GAPLESS_DELAY 529
#ifdef GAPLESS
void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip);
void frame_gapless_realinit(mpg123_handle *fr);
void frame_gapless_update(mpg123_handle *mh, off_t total_samples);
void INT123_frame_gapless_init(mpg123_handle *fr, int64_t framecount, int64_t bskip, int64_t eskip);
void INT123_frame_gapless_realinit(mpg123_handle *fr);
void INT123_frame_gapless_update(mpg123_handle *mh, int64_t total_samples);
/*void frame_gapless_position(mpg123_handle* fr);
void frame_gapless_bytify(mpg123_handle *fr);
void frame_gapless_ignore(mpg123_handle *fr, off_t frames);*/
void INT123_frame_gapless_bytify(mpg123_handle *fr);
void INT123_frame_gapless_ignore(mpg123_handle *fr, int64_t frames);*/
/* void frame_gapless_buffercheck(mpg123_handle *fr); */
#endif
/* Number of samples the decoding of the current frame should yield. */
off_t frame_expect_outsamples(mpg123_handle *fr);
int64_t INT123_frame_expect_outsamples(mpg123_handle *fr);
/* Skip this frame... do some fake action to get away without actually decoding it. */
void frame_skip(mpg123_handle *fr);
void INT123_frame_skip(mpg123_handle *fr);
/*
Seeking core functions:
......@@ -418,14 +416,14 @@ void frame_skip(mpg123_handle *fr);
- get leading frame offset for output sample offset
The offsets are "unadjusted"/internal; resampling is being taken care of.
*/
off_t frame_ins2outs(mpg123_handle *fr, off_t ins);
off_t frame_outs(mpg123_handle *fr, off_t num);
int64_t INT123_frame_ins2outs(mpg123_handle *fr, int64_t ins);
int64_t INT123_frame_outs(mpg123_handle *fr, int64_t num);
/* This one just computes the expected sample count for _this_ frame. */
off_t frame_expect_outsampels(mpg123_handle *fr);
off_t frame_offset(mpg123_handle *fr, off_t outs);
void frame_set_frameseek(mpg123_handle *fr, off_t fe);
void frame_set_seek(mpg123_handle *fr, off_t sp);
off_t frame_tell_seek(mpg123_handle *fr);
int64_t INT123_frame_expect_outsampels(mpg123_handle *fr);
int64_t INT123_frame_offset(mpg123_handle *fr, int64_t outs);
void INT123_frame_set_frameseek(mpg123_handle *fr, int64_t fe);
void INT123_frame_set_seek(mpg123_handle *fr, int64_t sp);
int64_t INT123_frame_tell_seek(mpg123_handle *fr);
/* Take a copy of the Xing VBR TOC for fuzzy seeking. */
int frame_fill_toc(mpg123_handle *fr, unsigned char* in);
int INT123_frame_fill_toc(mpg123_handle *fr, unsigned char* in);
#endif
/*
sampleadjust: gapless sample offset math
copyright 1995-2012 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1995-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
This is no stand-alone header, precisely to be able to fool it into using fake handle types for testing the math.
......@@ -11,9 +11,9 @@
#ifdef GAPLESS
/* From internal sample number to external. */
static off_t sample_adjust(mpg123_handle *mh, off_t x)
static int64_t sample_adjust(mpg123_handle *mh, int64_t x)
{
off_t s;
int64_t s;
if(mh->p.flags & MPG123_GAPLESS)
{
/* It's a bit tricky to do this computation for the padding samples.
......@@ -35,9 +35,9 @@ static off_t sample_adjust(mpg123_handle *mh, off_t x)
}
/* from external samples to internal */
static off_t sample_unadjust(mpg123_handle *mh, off_t x)
static int64_t sample_unadjust(mpg123_handle *mh, int64_t x)
{
off_t s;
int64_t s;
if(mh->p.flags & MPG123_GAPLESS)
{
s = x + mh->begin_os;
......@@ -74,24 +74,29 @@ static void frame_buffercheck(mpg123_handle *fr)
if(fr->lastframe > -1 && fr->num >= fr->lastframe)
{
/* There can be more than one frame of padding at the end, so we ignore the whole frame if we are beyond lastframe. */
off_t byteoff = (fr->num == fr->lastframe) ? samples_to_bytes(fr, fr->lastoff) : 0;
if((off_t)fr->buffer.fill > byteoff)
int64_t byteoff = (fr->num == fr->lastframe) ? INT123_samples_to_bytes(fr, fr->lastoff) : 0;
if((int64_t)fr->buffer.fill > byteoff)
{
fr->buffer.fill = byteoff;
}
if(VERBOSE3) fprintf(stderr, "\nNote: Cut frame %"OFF_P" buffer on end of stream to %"OFF_P" samples, fill now %"SIZE_P" bytes.\n", (off_p)fr->num, (off_p)(fr->num == fr->lastframe ? fr->lastoff : 0), (size_p)fr->buffer.fill);
if(VERBOSE3)
fprintf(stderr, "\nNote: Cut frame %" PRIi64 " buffer on end of stream to %"
PRIi64 " samples, fill now %"SIZE_P" bytes.\n"
, fr->num, (fr->num == fr->lastframe ? fr->lastoff : 0), (size_p)fr->buffer.fill);
}
/* The first interesting frame: Skip some leading samples. */
if(fr->firstoff && fr->num == fr->firstframe)
{
off_t byteoff = samples_to_bytes(fr, fr->firstoff);
if((off_t)fr->buffer.fill > byteoff)
int64_t byteoff = INT123_samples_to_bytes(fr, fr->firstoff);
if((int64_t)fr->buffer.fill > byteoff)
{
fr->buffer.fill -= byteoff;
/* buffer.p != buffer.data only for own buffer */
debug6("cutting %li samples/%li bytes on begin, own_buffer=%i at %p=%p, buf[1]=%i",
(long)fr->firstoff, (long)byteoff, fr->own_buffer, (void*)fr->buffer.p, (void*)fr->buffer.data, ((short*)fr->buffer.p)[2]);
debug6("cutting %" PRIi64 " samples/%" PRIi64
" bytes on begin, own_buffer=%i at %p=%p, buf[1]=%i"
, fr->firstoff, byteoff, fr->own_buffer
, (void*)fr->buffer.p, (void*)fr->buffer.data, ((short*)fr->buffer.p)[2]);
if(fr->own_buffer) fr->buffer.p = fr->buffer.data + byteoff;
else memmove(fr->buffer.data, fr->buffer.data + byteoff, fr->buffer.fill);
debug3("done cutting, buffer at %p =? %p, buf[1]=%i",
......@@ -99,7 +104,10 @@ static void frame_buffercheck(mpg123_handle *fr)
}
else fr->buffer.fill = 0;
if(VERBOSE3) fprintf(stderr, "\nNote: Cut frame %"OFF_P" buffer on beginning of stream by %"OFF_P" samples, fill now %"SIZE_P" bytes.\n", (off_p)fr->num, (off_p)fr->firstoff, (size_p)fr->buffer.fill);
if(VERBOSE3)
fprintf(stderr, "\nNote: Cut frame %" PRIi64
" buffer on beginning of stream by %" PRIi64 " samples, fill now %zu bytes.\n"
, fr->num, fr->firstoff, fr->buffer.fill);
/* We can only reach this frame again by seeking. And on seeking, firstoff will be recomputed.
So it is safe to null it here (and it makes the if() decision abort earlier). */
fr->firstoff = 0;
......
......@@ -42,7 +42,9 @@ struct cpuflags
#endif
};
unsigned int getcpuflags(struct cpuflags* cf);
unsigned int INT123_getcpuflags(struct cpuflags* cf);
#if ((defined OPT_X86) || (defined OPT_X86_64) || (defined OPT_NEON) || (defined OPT_NEON64)) && (defined OPT_MULTI)
#ifdef WANT_GETCPUFLAGS
#include <string.h>
......@@ -51,16 +53,10 @@ unsigned int getcpuflags(struct cpuflags* cf);
static unsigned int wrap_getcpuflags(struct cpuflags* cf)
{
memset(cf, 0, sizeof(*cf));
#if ((defined OPT_X86) || (defined OPT_X86_64) || (defined OPT_NEON) || (defined OPT_NEON64)) && (defined OPT_MULTI)
return getcpuflags(cf);
#else
return 0;
#endif
return INT123_getcpuflags(cf);
}
#endif
#if ((defined OPT_X86) || (defined OPT_X86_64) || (defined OPT_NEON) || (defined OPT_NEON64)) && (defined OPT_MULTI)
// We really evaluate the CPU flags.
#define OPT_CPU_FLAGS
......
/*
icy: Puny code to pretend for a serious ICY data structure.
copyright 2007-2015 by the mpg123 project
copyright 2007-2023 by the mpg123 project
-= free software under the terms of the LGPL 2.1 =-
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
#include "intsym.h"
#include "icy.h"
void init_icy(struct icy_meta *icy)
void INT123_init_icy(struct icy_meta *icy)
{
icy->data = NULL;
}
void clear_icy(struct icy_meta *icy)
void INT123_clear_icy(struct icy_meta *icy)
{
if(icy->data != NULL) free(icy->data);
init_icy(icy);
INT123_init_icy(icy);
}
void reset_icy(struct icy_meta *icy)
void INT123_reset_icy(struct icy_meta *icy)
{
clear_icy(icy);
init_icy(icy);
INT123_clear_icy(icy);
INT123_init_icy(icy);
}
/*void set_icy(struct icy_meta *icy, char* new_data)
{
......
/*
icy: support for SHOUTcast ICY meta info, an attempt to keep it organized
copyright 2006-7 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2006-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis and modelled after patch by Honza
*/
......@@ -16,22 +16,22 @@
struct icy_meta
{
char* data;
off_t interval;
off_t next;
int64_t interval;
int64_t next;
};
void init_icy(struct icy_meta *);
void clear_icy(struct icy_meta *);
void reset_icy(struct icy_meta *);
void INT123_init_icy(struct icy_meta *);
void INT123_clear_icy(struct icy_meta *);
void INT123_reset_icy(struct icy_meta *);
#else
#undef init_icy
#define init_icy(a)
#undef clear_icy
#define clear_icy(a)
#undef reset_icy
#define reset_icy(a)
#undef INT123_init_icy
#define INT123_init_icy(a)
#undef INT123_clear_icy
#define INT123_clear_icy(a)
#undef INT123_reset_icy
#define INT123_reset_icy(a)
#endif /* NO_ICY */
......
......@@ -27,7 +27,6 @@
*/
#include "config.h"
#include "intsym.h"
/* Includes string and stdlib headers... */
#include "compat.h"
......@@ -375,7 +374,7 @@ is_utf8(const char* src)
ICY in CP-1252 (or UTF-8 alreay) to UTF-8 encoded string.
If force is applied, it will always encode to UTF-8, without checking. */
char *
icy2utf8(const char *src, int force)
INT123_icy2utf8(const char *src, int force)
{
const uint8_t *s = (const uint8_t *)src;
size_t srclen, dstlen, i, k;
......@@ -384,7 +383,7 @@ icy2utf8(const char *src, int force)
/* Some funny streams from Apple/iTunes give ICY info in UTF-8 already.
So, be prepared and don't try to re-encode such. Unless forced. */
if(!force && is_utf8(src)) return (compat_strdup(src));
if(!force && is_utf8(src)) return (INT123_compat_strdup(src));
srclen = strlen(src) + 1;
/* allocate conservatively */
......@@ -419,13 +418,13 @@ main(void)
{
char *t, *t2;
if ((t = icy2utf8(intext, 0)) == NULL) {
if ((t = INT123_icy2utf8(intext, 0)) == NULL) {
fprintf(stderr, "out of memory\n");
return (1);
}
/* make sure it won't be converted twice */
if ((t2 = icy2utf8(t), 0) == NULL) {
if ((t2 = INT123_icy2utf8(t), 0) == NULL) {
fprintf(stderr, "out of memory\n");
return (1);
}
......
......@@ -4,7 +4,7 @@
#ifndef NO_ICY
/* (string, force conversion) */
char *icy2utf8(const char *, int);
char *INT123_icy2utf8(const char *, int);
#endif
#endif
/*
id3: ID3v2.3 and ID3v2.4 parsing (a relevant subset)
copyright 2006-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2006-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
......@@ -126,7 +126,7 @@ static void null_id3_links(mpg123_handle *fr)
fr->id3v2.comment = NULL;
}
void init_id3(mpg123_handle *fr)
void INT123_init_id3(mpg123_handle *fr)
{
fr->id3v2.version = 0; /* nothing there */
null_id3_links(fr);
......@@ -241,7 +241,7 @@ static mpg123_text *add_id3_text( mpg123_text **list, size_t *size
}
mdebug("add_id3_text: append to list of %zu", *size);
// Nothing found, add new one.
mpg123_text *x = safe_realloc(*list, sizeof(mpg123_text)*(*size+1));
mpg123_text *x = INT123_safe_realloc(*list, sizeof(mpg123_text)*(*size+1));
if(x == NULL) return NULL; /* bad */
*list = x;
......@@ -269,7 +269,7 @@ static mpg123_picture *add_id3_picture(mpg123_picture **list, size_t *size, char
return entry;
}
// Append a new one.
mpg123_picture *x = safe_realloc(*list, sizeof(mpg123_picture)*(*size+1));
mpg123_picture *x = INT123_safe_realloc(*list, sizeof(mpg123_picture)*(*size+1));
if(x == NULL) return NULL; /* bad */
*list = x;
......@@ -281,7 +281,7 @@ static mpg123_picture *add_id3_picture(mpg123_picture **list, size_t *size, char
/* OK, back to the higher level functions. */
void exit_id3(mpg123_handle *fr)
void INT123_exit_id3(mpg123_handle *fr)
{
free_picture(fr);
free_comment(fr);
......@@ -289,14 +289,14 @@ void exit_id3(mpg123_handle *fr)
free_text(fr);
}
void reset_id3(mpg123_handle *fr)
void INT123_reset_id3(mpg123_handle *fr)
{
exit_id3(fr);
init_id3(fr);
INT123_exit_id3(fr);
INT123_init_id3(fr);
}
/* Set the id3v2.artist id3v2.title ... links to elements of the array. */
void id3_link(mpg123_handle *fr)
void INT123_id3_link(mpg123_handle *fr)
{
size_t i;
mpg123_id3v2 *v2 = &fr->id3v2;
......@@ -363,7 +363,7 @@ static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t sour
error1("Unknown text encoding %u, I take no chances, sorry!", encoding);
return;
}
id3_to_utf8(sb, encoding, source+1, source_size-1, noquiet);
INT123_id3_to_utf8(sb, encoding, source+1, source_size-1, noquiet);
if(sb->fill) debug1("UTF-8 string (the first one): %s", sb->p);
else if(noquiet) error("unable to convert string to UTF-8 (out of memory, junk input?)!");
......@@ -371,7 +371,7 @@ static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t sour
/* On error, sb->size is 0. */
/* Also, encoding has been checked already! */
void id3_to_utf8(mpg123_string *sb, unsigned char encoding, const unsigned char *source, size_t source_size, int noquiet)
void INT123_id3_to_utf8(mpg123_string *sb, unsigned char encoding, const unsigned char *source, size_t source_size, int noquiet)
{
unsigned int bwidth;
if(sb)
......@@ -403,9 +403,12 @@ static unsigned char *next_text(unsigned char* prev, unsigned char encoding, siz
unsigned char *text = prev;
size_t width = encoding_widths[encoding];
if(limit > PTRDIFF_MAX)
return NULL;
/* So I go lengths to find zero or double zero...
Remember bug 2834636: Only check for aligned NULLs! */
while(text-prev < (ssize_t)limit)
while(text-prev < (ptrdiff_t)limit)
{
if(text[0] == 0)
{
......@@ -494,7 +497,7 @@ static void process_picture(mpg123_handle *fr, unsigned char *realdata, size_t r
error("Unable to get mime type for picture; skipping picture.");
return;
}
id3_to_utf8(&mime, 0, realdata, workpoint - realdata, NOQUIET);
INT123_id3_to_utf8(&mime, 0, realdata, workpoint - realdata, NOQUIET);
realsize -= workpoint - realdata;
realdata = workpoint;
/* get picture type */
......@@ -509,7 +512,7 @@ static void process_picture(mpg123_handle *fr, unsigned char *realdata, size_t r
mpg123_free_string(&mime);
return;
}
id3_to_utf8(&description, encoding, realdata, workpoint - realdata, NOQUIET);
INT123_id3_to_utf8(&description, encoding, realdata, workpoint - realdata, NOQUIET);
realsize -= workpoint - realdata;
if(realsize)
image_data = (unsigned char*)malloc(realsize);
......@@ -795,7 +798,7 @@ int store_id3v2( mpg123_handle *fr
, unsigned long first4bytes, unsigned char buf[6], unsigned long length )
{
int ret = 1;
off_t ret2;
int64_t ret2;
unsigned long fullen = 10+length;
if(fr->id3v2_raw)
free(fr->id3v2_raw);
......@@ -842,7 +845,7 @@ int store_id3v2( mpg123_handle *fr
1: good, (possibly) new tag info
<0: reader error (may need more data feed, try again)
*/
int parse_new_id3(mpg123_handle *fr, unsigned long first4bytes)
int INT123_parse_new_id3(mpg123_handle *fr, unsigned long first4bytes)
{
#define UNSYNC_FLAG 128
#define EXTHEAD_FLAG 64 /* ID3v2.3+ */
......@@ -855,7 +858,7 @@ int parse_new_id3(mpg123_handle *fr, unsigned long first4bytes)
unsigned long length=0;
unsigned char flags = 0;
int ret = 1;
off_t ret2;
int64_t ret2;
int storetag = 0;
unsigned int footlen = 0;
#ifndef NO_ID3V2
......@@ -961,7 +964,7 @@ int parse_new_id3(mpg123_handle *fr, unsigned long first4bytes)
{
if(VERBOSE3)
fprintf(stderr, "Note: skipped tag clearing possibly existing ID3v2 data");
reset_id3(fr); // Old data is invalid.
INT123_reset_id3(fr); // Old data is invalid.
#endif
if(!storetag && (ret2=fr->rd->skip_bytes(fr,length+footlen))<0)
ret=ret2;
......@@ -1025,7 +1028,7 @@ int parse_new_id3(mpg123_handle *fr, unsigned long first4bytes)
{
if(VERBOSE3)
fprintf(stderr, "Note: non-update tag replacing existing ID3v2 data\n");
reset_id3(fr);
INT123_reset_id3(fr);
}
if(ret > 0)
{
......@@ -1274,13 +1277,13 @@ int parse_new_id3(mpg123_handle *fr, unsigned long first4bytes)
{
if(VERBOSE3)
fprintf(stderr, "Note: faulty ID3v2 tag still clearing old data\n");
reset_id3(fr);
INT123_reset_id3(fr);
}
} else // No new data, but still there was a tag that invalidates old data.
{
if(VERBOSE3)
fprintf(stderr, "Note: empty ID3v2 clearing old data\n");
reset_id3(fr);
INT123_reset_id3(fr);
}
tagparse_cleanup:
/* Get rid of stored raw data that should not be kept. */
......
......@@ -13,31 +13,31 @@
#include "frame.h"
#ifdef NO_ID3V2
# ifdef init_id3
# undef init_id3
# ifdef INT123_init_id3
# undef INT123_init_id3
# endif
# define init_id3(fr)
# ifdef exit_id3
# undef exit_id3
# define INT123_init_id3(fr)
# ifdef INT123_exit_id3
# undef INT123_exit_id3
# endif
# define exit_id3(fr)
# ifdef reset_id3
# undef reset_id3
# define INT123_exit_id3(fr)
# ifdef INT123_reset_id3
# undef INT123_reset_id3
# endif
# define reset_id3(fr)
# ifdef id3_link
# undef id3_link
# define INT123_reset_id3(fr)
# ifdef INT123_id3_link
# undef INT123_id3_link
# endif
# define id3_link(fr)
# define INT123_id3_link(fr)
#else
void init_id3(mpg123_handle *fr);
void exit_id3(mpg123_handle *fr);
void reset_id3(mpg123_handle *fr);
void id3_link(mpg123_handle *fr);
void INT123_init_id3(mpg123_handle *fr);
void INT123_exit_id3(mpg123_handle *fr);
void INT123_reset_id3(mpg123_handle *fr);
void INT123_id3_link(mpg123_handle *fr);
#endif
int parse_new_id3(mpg123_handle *fr, unsigned long first4bytes);
int INT123_parse_new_id3(mpg123_handle *fr, unsigned long first4bytes);
/* Convert text from some ID3 encoding to UTf-8.
On error, sb->fill is 0. The noquiet flag enables warning/error messages. */
void id3_to_utf8(mpg123_string *sb, unsigned char encoding, const unsigned char *source, size_t source_size, int noquiet);
void INT123_id3_to_utf8(mpg123_string *sb, unsigned char encoding, const unsigned char *source, size_t source_size, int noquiet);
#endif
/*
index: frame index data structure and functions
copyright 2007-2020 by the mpg123 project
copyright 2007-2023 by the mpg123 project
-= free software under the terms of the LGPL 2.1 =-
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
#include "intsym.h"
#include "index.h"
#include "debug.h"
/* The next expected frame offset, one step ahead. */
static off_t fi_next(struct frame_index *fi)
static int64_t fi_next(struct frame_index *fi)
{
return (off_t)fi->fill*fi->step;
return (int64_t)fi->fill*fi->step;
}
/* Shrink down the used index to the half.
......@@ -36,7 +35,7 @@ static void fi_shrink(struct frame_index *fi)
fi->next = fi_next(fi);
}
void fi_init(struct frame_index *fi)
void INT123_fi_init(struct frame_index *fi)
{
fi->data = NULL;
fi->step = 1;
......@@ -46,17 +45,17 @@ void fi_init(struct frame_index *fi)
fi->next = fi_next(fi);
}
void fi_exit(struct frame_index *fi)
void INT123_fi_exit(struct frame_index *fi)
{
debug2("fi_exit: %p and %lu", (void*)fi->data, (unsigned long)fi->size);
debug2("INT123_fi_exit: %p and %lu", (void*)fi->data, (unsigned long)fi->size);
if(fi->size && fi->data != NULL) free(fi->data);
fi_init(fi); /* Be prepared for further fun, still. */
INT123_fi_init(fi); /* Be prepared for further fun, still. */
}
int fi_resize(struct frame_index *fi, size_t newsize)
int INT123_fi_resize(struct frame_index *fi, size_t newsize)
{
off_t *newdata = NULL;
int64_t *newdata = NULL;
if(newsize == fi->size) return 0;
if(newsize > 0 && newsize < fi->size)
......@@ -64,7 +63,7 @@ int fi_resize(struct frame_index *fi, size_t newsize)
while(fi->fill > newsize){ fi_shrink(fi); }
}
newdata = safe_realloc(fi->data, newsize*sizeof(off_t));
newdata = INT123_safe_realloc(fi->data, newsize*sizeof(int64_t));
if(newsize == 0 || newdata != NULL)
{
fi->data = newdata;
......@@ -78,15 +77,15 @@ int fi_resize(struct frame_index *fi, size_t newsize)
return -1;
}
void fi_add(struct frame_index *fi, off_t pos)
void INT123_fi_add(struct frame_index *fi, int64_t pos)
{
debug3("wanting to add to fill %lu, step %lu, size %lu", (unsigned long)fi->fill, (unsigned long)fi->step, (unsigned long)fi->size);
if(fi->fill == fi->size)
{ /* Index is full, we need to shrink... or grow. */
/* Store the current frame number to check later if we still want it. */
off_t framenum = fi->fill*fi->step;
int64_t framenum = fi->fill*fi->step;
/* If we want not / cannot grow, we shrink. */
if( !(fi->grow_size && fi_resize(fi, fi->size+fi->grow_size)==0) )
if( !(fi->grow_size && INT123_fi_resize(fi, fi->size+fi->grow_size)==0) )
fi_shrink(fi);
/* Now check if we still want to add this frame (could be that not, because of changed step). */
......@@ -103,13 +102,13 @@ void fi_add(struct frame_index *fi, off_t pos)
}
}
int fi_set(struct frame_index *fi, off_t *offsets, off_t step, size_t fill)
int INT123_fi_set(struct frame_index *fi, int64_t *offsets, int64_t step, size_t fill)
{
if(fi_resize(fi, fill) == -1) return -1;
if(INT123_fi_resize(fi, fill) == -1) return -1;
fi->step = step;
if(offsets != NULL)
{
memcpy(fi->data, offsets, fill*sizeof(off_t));
memcpy(fi->data, offsets, fill*sizeof(int64_t));
fi->fill = fill;
}
else
......@@ -123,7 +122,7 @@ int fi_set(struct frame_index *fi, off_t *offsets, off_t step, size_t fill)
return 0;
}
void fi_reset(struct frame_index *fi)
void INT123_fi_reset(struct frame_index *fi)
{
debug1("reset with size %"SIZE_P, (size_p)fi->size);
fi->fill = 0;
......
......@@ -15,7 +15,7 @@
In this manner we maintain a good resolution with the given
maximum index size while covering the whole stream.
copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
......@@ -25,35 +25,35 @@
struct frame_index
{
off_t *data; /* actual data, the frame positions */
off_t step; /* advancement in frame number per index point */
off_t next; /* frame offset supposed to come next into the index */
int64_t *data; /* actual data, the frame positions */
int64_t step; /* advancement in frame number per index point */
int64_t next; /* frame offset supposed to come next into the index */
size_t size; /* total number of possible entries */
size_t fill; /* number of used entries */
size_t grow_size; /* if > 0: index allowed to grow on need with these steps, instead of lowering resolution */
};
/* The condition for a framenum to be appended to the index.
if(FI_NEXT(fr->index, fr->num)) fi_add(offset); */
if(FI_NEXT(fr->index, fr->num)) INT123_fi_add(offset); */
#define FI_NEXT(fi, framenum) ((fi).size && framenum == (fi).next)
/* Initialize stuff, set things to zero and NULL... */
void fi_init(struct frame_index *fi);
void INT123_fi_init(struct frame_index *fi);
/* Deallocate/zero things. */
void fi_exit(struct frame_index *fi);
void INT123_fi_exit(struct frame_index *fi);
/* Prepare a given size, preserving current fill, if possible.
If the new size is smaller than fill, the entry density is reduced.
Return 0 on success. */
int fi_resize(struct frame_index *fi, size_t newsize);
int INT123_fi_resize(struct frame_index *fi, size_t newsize);
/* Append a frame position, reducing index density if needed. */
void fi_add(struct frame_index *fi, off_t pos);
void INT123_fi_add(struct frame_index *fi, int64_t pos);
/* Replace the frame index */
int fi_set(struct frame_index *fi, off_t *offsets, off_t step, size_t fill);
int INT123_fi_set(struct frame_index *fi, int64_t *offsets, int64_t step, size_t fill);
/* Empty the index (setting fill=0 and step=1), but keep current size. */
void fi_reset(struct frame_index *fi);
void INT123_fi_reset(struct frame_index *fi);
#endif
......@@ -27,490 +27,490 @@ static unsigned char grp_9tab[3072];
static const ALIGNED(16) real layer12_table[27][64] =
{
{
0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f
}
, {
-1.33333333e+00, -1.05826737e+00, -8.39947367e-01, -6.66666667e-01
, -5.29133684e-01, -4.19973683e-01, -3.33333333e-01, -2.64566842e-01
, -2.09986842e-01, -1.66666667e-01, -1.32283421e-01, -1.04993421e-01
, -8.33333333e-02, -6.61417105e-02, -5.24967104e-02, -4.16666667e-02
, -3.30708552e-02, -2.62483552e-02, -2.08333333e-02, -1.65354276e-02
, -1.31241776e-02, -1.04166667e-02, -8.26771381e-03, -6.56208880e-03
, -5.20833333e-03, -4.13385691e-03, -3.28104440e-03, -2.60416667e-03
, -2.06692845e-03, -1.64052220e-03, -1.30208333e-03, -1.03346423e-03
, -8.20261100e-04, -6.51041667e-04, -5.16732113e-04, -4.10130550e-04
, -3.25520833e-04, -2.58366057e-04, -2.05065275e-04, -1.62760417e-04
, -1.29183028e-04, -1.02532638e-04, -8.13802083e-05, -6.45915142e-05
, -5.12663188e-05, -4.06901042e-05, -3.22957571e-05, -2.56331594e-05
, -2.03450521e-05, -1.61478785e-05, -1.28165797e-05, -1.01725260e-05
, -8.07393927e-06, -6.40828985e-06, -5.08626302e-06, -4.03696963e-06
, -3.20414492e-06, -2.54313151e-06, -2.01848482e-06, -1.60207246e-06
, -1.27156576e-06, -1.00924241e-06, -8.01036231e-07, 0.00000000e+00
-1.33333333e+00f, -1.05826737e+00f, -8.39947367e-01f, -6.66666667e-01f
, -5.29133684e-01f, -4.19973683e-01f, -3.33333333e-01f, -2.64566842e-01f
, -2.09986842e-01f, -1.66666667e-01f, -1.32283421e-01f, -1.04993421e-01f
, -8.33333333e-02f, -6.61417105e-02f, -5.24967104e-02f, -4.16666667e-02f
, -3.30708552e-02f, -2.62483552e-02f, -2.08333333e-02f, -1.65354276e-02f
, -1.31241776e-02f, -1.04166667e-02f, -8.26771381e-03f, -6.56208880e-03f
, -5.20833333e-03f, -4.13385691e-03f, -3.28104440e-03f, -2.60416667e-03f
, -2.06692845e-03f, -1.64052220e-03f, -1.30208333e-03f, -1.03346423e-03f
, -8.20261100e-04f, -6.51041667e-04f, -5.16732113e-04f, -4.10130550e-04f
, -3.25520833e-04f, -2.58366057e-04f, -2.05065275e-04f, -1.62760417e-04f
, -1.29183028e-04f, -1.02532638e-04f, -8.13802083e-05f, -6.45915142e-05f
, -5.12663188e-05f, -4.06901042e-05f, -3.22957571e-05f, -2.56331594e-05f
, -2.03450521e-05f, -1.61478785e-05f, -1.28165797e-05f, -1.01725260e-05f
, -8.07393927e-06f, -6.40828985e-06f, -5.08626302e-06f, -4.03696963e-06f
, -3.20414492e-06f, -2.54313151e-06f, -2.01848482e-06f, -1.60207246e-06f
, -1.27156576e-06f, -1.00924241e-06f, -8.01036231e-07f, 0.00000000e+00f
}
, {
1.33333333e+00, 1.05826737e+00, 8.39947367e-01, 6.66666667e-01
, 5.29133684e-01, 4.19973683e-01, 3.33333333e-01, 2.64566842e-01
, 2.09986842e-01, 1.66666667e-01, 1.32283421e-01, 1.04993421e-01
, 8.33333333e-02, 6.61417105e-02, 5.24967104e-02, 4.16666667e-02
, 3.30708552e-02, 2.62483552e-02, 2.08333333e-02, 1.65354276e-02
, 1.31241776e-02, 1.04166667e-02, 8.26771381e-03, 6.56208880e-03
, 5.20833333e-03, 4.13385691e-03, 3.28104440e-03, 2.60416667e-03
, 2.06692845e-03, 1.64052220e-03, 1.30208333e-03, 1.03346423e-03
, 8.20261100e-04, 6.51041667e-04, 5.16732113e-04, 4.10130550e-04
, 3.25520833e-04, 2.58366057e-04, 2.05065275e-04, 1.62760417e-04
, 1.29183028e-04, 1.02532638e-04, 8.13802083e-05, 6.45915142e-05
, 5.12663188e-05, 4.06901042e-05, 3.22957571e-05, 2.56331594e-05
, 2.03450521e-05, 1.61478785e-05, 1.28165797e-05, 1.01725260e-05
, 8.07393927e-06, 6.40828985e-06, 5.08626302e-06, 4.03696963e-06
, 3.20414492e-06, 2.54313151e-06, 2.01848482e-06, 1.60207246e-06
, 1.27156576e-06, 1.00924241e-06, 8.01036231e-07, 0.00000000e+00
1.33333333e+00f, 1.05826737e+00f, 8.39947367e-01f, 6.66666667e-01f
, 5.29133684e-01f, 4.19973683e-01f, 3.33333333e-01f, 2.64566842e-01f
, 2.09986842e-01f, 1.66666667e-01f, 1.32283421e-01f, 1.04993421e-01f
, 8.33333333e-02f, 6.61417105e-02f, 5.24967104e-02f, 4.16666667e-02f
, 3.30708552e-02f, 2.62483552e-02f, 2.08333333e-02f, 1.65354276e-02f
, 1.31241776e-02f, 1.04166667e-02f, 8.26771381e-03f, 6.56208880e-03f
, 5.20833333e-03f, 4.13385691e-03f, 3.28104440e-03f, 2.60416667e-03f
, 2.06692845e-03f, 1.64052220e-03f, 1.30208333e-03f, 1.03346423e-03f
, 8.20261100e-04f, 6.51041667e-04f, 5.16732113e-04f, 4.10130550e-04f
, 3.25520833e-04f, 2.58366057e-04f, 2.05065275e-04f, 1.62760417e-04f
, 1.29183028e-04f, 1.02532638e-04f, 8.13802083e-05f, 6.45915142e-05f
, 5.12663188e-05f, 4.06901042e-05f, 3.22957571e-05f, 2.56331594e-05f
, 2.03450521e-05f, 1.61478785e-05f, 1.28165797e-05f, 1.01725260e-05f
, 8.07393927e-06f, 6.40828985e-06f, 5.08626302e-06f, 4.03696963e-06f
, 3.20414492e-06f, 2.54313151e-06f, 2.01848482e-06f, 1.60207246e-06f
, 1.27156576e-06f, 1.00924241e-06f, 8.01036231e-07f, 0.00000000e+00f
}
, {
5.71428571e-01, 4.53543158e-01, 3.59977443e-01, 2.85714286e-01
, 2.26771579e-01, 1.79988721e-01, 1.42857143e-01, 1.13385789e-01
, 8.99943607e-02, 7.14285714e-02, 5.66928947e-02, 4.49971804e-02
, 3.57142857e-02, 2.83464474e-02, 2.24985902e-02, 1.78571429e-02
, 1.41732237e-02, 1.12492951e-02, 8.92857143e-03, 7.08661184e-03
, 5.62464754e-03, 4.46428571e-03, 3.54330592e-03, 2.81232377e-03
, 2.23214286e-03, 1.77165296e-03, 1.40616189e-03, 1.11607143e-03
, 8.85826480e-04, 7.03080943e-04, 5.58035714e-04, 4.42913240e-04
, 3.51540472e-04, 2.79017857e-04, 2.21456620e-04, 1.75770236e-04
, 1.39508929e-04, 1.10728310e-04, 8.78851179e-05, 6.97544643e-05
, 5.53641550e-05, 4.39425589e-05, 3.48772321e-05, 2.76820775e-05
, 2.19712795e-05, 1.74386161e-05, 1.38410387e-05, 1.09856397e-05
, 8.71930804e-06, 6.92051937e-06, 5.49281987e-06, 4.35965402e-06
, 3.46025969e-06, 2.74640993e-06, 2.17982701e-06, 1.73012984e-06
, 1.37320497e-06, 1.08991350e-06, 8.65064922e-07, 6.86602483e-07
, 5.44956752e-07, 4.32532461e-07, 3.43301242e-07, 0.00000000e+00
5.71428571e-01f, 4.53543158e-01f, 3.59977443e-01f, 2.85714286e-01f
, 2.26771579e-01f, 1.79988721e-01f, 1.42857143e-01f, 1.13385789e-01f
, 8.99943607e-02f, 7.14285714e-02f, 5.66928947e-02f, 4.49971804e-02f
, 3.57142857e-02f, 2.83464474e-02f, 2.24985902e-02f, 1.78571429e-02f
, 1.41732237e-02f, 1.12492951e-02f, 8.92857143e-03f, 7.08661184e-03f
, 5.62464754e-03f, 4.46428571e-03f, 3.54330592e-03f, 2.81232377e-03f
, 2.23214286e-03f, 1.77165296e-03f, 1.40616189e-03f, 1.11607143e-03f
, 8.85826480e-04f, 7.03080943e-04f, 5.58035714e-04f, 4.42913240e-04f
, 3.51540472e-04f, 2.79017857e-04f, 2.21456620e-04f, 1.75770236e-04f
, 1.39508929e-04f, 1.10728310e-04f, 8.78851179e-05f, 6.97544643e-05f
, 5.53641550e-05f, 4.39425589e-05f, 3.48772321e-05f, 2.76820775e-05f
, 2.19712795e-05f, 1.74386161e-05f, 1.38410387e-05f, 1.09856397e-05f
, 8.71930804e-06f, 6.92051937e-06f, 5.49281987e-06f, 4.35965402e-06f
, 3.46025969e-06f, 2.74640993e-06f, 2.17982701e-06f, 1.73012984e-06f
, 1.37320497e-06f, 1.08991350e-06f, 8.65064922e-07f, 6.86602483e-07f
, 5.44956752e-07f, 4.32532461e-07f, 3.43301242e-07f, 0.00000000e+00f
}
, {
2.66666667e-01, 2.11653474e-01, 1.67989473e-01, 1.33333333e-01
, 1.05826737e-01, 8.39947367e-02, 6.66666667e-02, 5.29133684e-02
, 4.19973683e-02, 3.33333333e-02, 2.64566842e-02, 2.09986842e-02
, 1.66666667e-02, 1.32283421e-02, 1.04993421e-02, 8.33333333e-03
, 6.61417105e-03, 5.24967104e-03, 4.16666667e-03, 3.30708552e-03
, 2.62483552e-03, 2.08333333e-03, 1.65354276e-03, 1.31241776e-03
, 1.04166667e-03, 8.26771381e-04, 6.56208880e-04, 5.20833333e-04
, 4.13385691e-04, 3.28104440e-04, 2.60416667e-04, 2.06692845e-04
, 1.64052220e-04, 1.30208333e-04, 1.03346423e-04, 8.20261100e-05
, 6.51041667e-05, 5.16732113e-05, 4.10130550e-05, 3.25520833e-05
, 2.58366057e-05, 2.05065275e-05, 1.62760417e-05, 1.29183028e-05
, 1.02532638e-05, 8.13802083e-06, 6.45915142e-06, 5.12663188e-06
, 4.06901042e-06, 3.22957571e-06, 2.56331594e-06, 2.03450521e-06
, 1.61478785e-06, 1.28165797e-06, 1.01725260e-06, 8.07393927e-07
, 6.40828985e-07, 5.08626302e-07, 4.03696963e-07, 3.20414492e-07
, 2.54313151e-07, 2.01848482e-07, 1.60207246e-07, 0.00000000e+00
2.66666667e-01f, 2.11653474e-01f, 1.67989473e-01f, 1.33333333e-01f
, 1.05826737e-01f, 8.39947367e-02f, 6.66666667e-02f, 5.29133684e-02f
, 4.19973683e-02f, 3.33333333e-02f, 2.64566842e-02f, 2.09986842e-02f
, 1.66666667e-02f, 1.32283421e-02f, 1.04993421e-02f, 8.33333333e-03f
, 6.61417105e-03f, 5.24967104e-03f, 4.16666667e-03f, 3.30708552e-03f
, 2.62483552e-03f, 2.08333333e-03f, 1.65354276e-03f, 1.31241776e-03f
, 1.04166667e-03f, 8.26771381e-04f, 6.56208880e-04f, 5.20833333e-04f
, 4.13385691e-04f, 3.28104440e-04f, 2.60416667e-04f, 2.06692845e-04f
, 1.64052220e-04f, 1.30208333e-04f, 1.03346423e-04f, 8.20261100e-05f
, 6.51041667e-05f, 5.16732113e-05f, 4.10130550e-05f, 3.25520833e-05f
, 2.58366057e-05f, 2.05065275e-05f, 1.62760417e-05f, 1.29183028e-05f
, 1.02532638e-05f, 8.13802083e-06f, 6.45915142e-06f, 5.12663188e-06f
, 4.06901042e-06f, 3.22957571e-06f, 2.56331594e-06f, 2.03450521e-06f
, 1.61478785e-06f, 1.28165797e-06f, 1.01725260e-06f, 8.07393927e-07f
, 6.40828985e-07f, 5.08626302e-07f, 4.03696963e-07f, 3.20414492e-07f
, 2.54313151e-07f, 2.01848482e-07f, 1.60207246e-07f, 0.00000000e+00f
}
, {
1.29032258e-01, 1.02412971e-01, 8.12852290e-02, 6.45161290e-02
, 5.12064855e-02, 4.06426145e-02, 3.22580645e-02, 2.56032428e-02
, 2.03213073e-02, 1.61290323e-02, 1.28016214e-02, 1.01606536e-02
, 8.06451613e-03, 6.40081069e-03, 5.08032681e-03, 4.03225806e-03
, 3.20040535e-03, 2.54016341e-03, 2.01612903e-03, 1.60020267e-03
, 1.27008170e-03, 1.00806452e-03, 8.00101337e-04, 6.35040852e-04
, 5.04032258e-04, 4.00050668e-04, 3.17520426e-04, 2.52016129e-04
, 2.00025334e-04, 1.58760213e-04, 1.26008065e-04, 1.00012667e-04
, 7.93801065e-05, 6.30040323e-05, 5.00063335e-05, 3.96900532e-05
, 3.15020161e-05, 2.50031668e-05, 1.98450266e-05, 1.57510081e-05
, 1.25015834e-05, 9.92251331e-06, 7.87550403e-06, 6.25079169e-06
, 4.96125665e-06, 3.93775202e-06, 3.12539585e-06, 2.48062833e-06
, 1.96887601e-06, 1.56269792e-06, 1.24031416e-06, 9.84438004e-07
, 7.81348962e-07, 6.20157082e-07, 4.92219002e-07, 3.90674481e-07
, 3.10078541e-07, 2.46109501e-07, 1.95337240e-07, 1.55039270e-07
, 1.23054751e-07, 9.76686202e-08, 7.75196352e-08, 0.00000000e+00
1.29032258e-01f, 1.02412971e-01f, 8.12852290e-02f, 6.45161290e-02f
, 5.12064855e-02f, 4.06426145e-02f, 3.22580645e-02f, 2.56032428e-02f
, 2.03213073e-02f, 1.61290323e-02f, 1.28016214e-02f, 1.01606536e-02f
, 8.06451613e-03f, 6.40081069e-03f, 5.08032681e-03f, 4.03225806e-03f
, 3.20040535e-03f, 2.54016341e-03f, 2.01612903e-03f, 1.60020267e-03f
, 1.27008170e-03f, 1.00806452e-03f, 8.00101337e-04f, 6.35040852e-04f
, 5.04032258e-04f, 4.00050668e-04f, 3.17520426e-04f, 2.52016129e-04f
, 2.00025334e-04f, 1.58760213e-04f, 1.26008065e-04f, 1.00012667e-04f
, 7.93801065e-05f, 6.30040323e-05f, 5.00063335e-05f, 3.96900532e-05f
, 3.15020161e-05f, 2.50031668e-05f, 1.98450266e-05f, 1.57510081e-05f
, 1.25015834e-05f, 9.92251331e-06f, 7.87550403e-06f, 6.25079169e-06f
, 4.96125665e-06f, 3.93775202e-06f, 3.12539585e-06f, 2.48062833e-06f
, 1.96887601e-06f, 1.56269792e-06f, 1.24031416e-06f, 9.84438004e-07f
, 7.81348962e-07f, 6.20157082e-07f, 4.92219002e-07f, 3.90674481e-07f
, 3.10078541e-07f, 2.46109501e-07f, 1.95337240e-07f, 1.55039270e-07f
, 1.23054751e-07f, 9.76686202e-08f, 7.75196352e-08f, 0.00000000e+00f
}
, {
6.34920635e-02, 5.03936842e-02, 3.99974936e-02, 3.17460317e-02
, 2.51968421e-02, 1.99987468e-02, 1.58730159e-02, 1.25984210e-02
, 9.99937341e-03, 7.93650794e-03, 6.29921052e-03, 4.99968671e-03
, 3.96825397e-03, 3.14960526e-03, 2.49984335e-03, 1.98412698e-03
, 1.57480263e-03, 1.24992168e-03, 9.92063492e-04, 7.87401315e-04
, 6.24960838e-04, 4.96031746e-04, 3.93700658e-04, 3.12480419e-04
, 2.48015873e-04, 1.96850329e-04, 1.56240210e-04, 1.24007937e-04
, 9.84251644e-05, 7.81201048e-05, 6.20039683e-05, 4.92125822e-05
, 3.90600524e-05, 3.10019841e-05, 2.46062911e-05, 1.95300262e-05
, 1.55009921e-05, 1.23031456e-05, 9.76501310e-06, 7.75049603e-06
, 6.15157278e-06, 4.88250655e-06, 3.87524802e-06, 3.07578639e-06
, 2.44125327e-06, 1.93762401e-06, 1.53789319e-06, 1.22062664e-06
, 9.68812004e-07, 7.68946597e-07, 6.10313319e-07, 4.84406002e-07
, 3.84473299e-07, 3.05156659e-07, 2.42203001e-07, 1.92236649e-07
, 1.52578330e-07, 1.21101500e-07, 9.61183246e-08, 7.62891648e-08
, 6.05507502e-08, 4.80591623e-08, 3.81445824e-08, 0.00000000e+00
6.34920635e-02f, 5.03936842e-02f, 3.99974936e-02f, 3.17460317e-02f
, 2.51968421e-02f, 1.99987468e-02f, 1.58730159e-02f, 1.25984210e-02f
, 9.99937341e-03f, 7.93650794e-03f, 6.29921052e-03f, 4.99968671e-03f
, 3.96825397e-03f, 3.14960526e-03f, 2.49984335e-03f, 1.98412698e-03f
, 1.57480263e-03f, 1.24992168e-03f, 9.92063492e-04f, 7.87401315e-04f
, 6.24960838e-04f, 4.96031746e-04f, 3.93700658e-04f, 3.12480419e-04f
, 2.48015873e-04f, 1.96850329e-04f, 1.56240210e-04f, 1.24007937e-04f
, 9.84251644e-05f, 7.81201048e-05f, 6.20039683e-05f, 4.92125822e-05f
, 3.90600524e-05f, 3.10019841e-05f, 2.46062911e-05f, 1.95300262e-05f
, 1.55009921e-05f, 1.23031456e-05f, 9.76501310e-06f, 7.75049603e-06f
, 6.15157278e-06f, 4.88250655e-06f, 3.87524802e-06f, 3.07578639e-06f
, 2.44125327e-06f, 1.93762401e-06f, 1.53789319e-06f, 1.22062664e-06f
, 9.68812004e-07f, 7.68946597e-07f, 6.10313319e-07f, 4.84406002e-07f
, 3.84473299e-07f, 3.05156659e-07f, 2.42203001e-07f, 1.92236649e-07f
, 1.52578330e-07f, 1.21101500e-07f, 9.61183246e-08f, 7.62891648e-08f
, 6.05507502e-08f, 4.80591623e-08f, 3.81445824e-08f, 0.00000000e+00f
}
, {
3.14960630e-02, 2.49984418e-02, 1.98412764e-02, 1.57480315e-02
, 1.24992209e-02, 9.92063819e-03, 7.87401575e-03, 6.24961044e-03
, 4.96031909e-03, 3.93700787e-03, 3.12480522e-03, 2.48015955e-03
, 1.96850394e-03, 1.56240261e-03, 1.24007977e-03, 9.84251969e-04
, 7.81201305e-04, 6.20039887e-04, 4.92125984e-04, 3.90600653e-04
, 3.10019943e-04, 2.46062992e-04, 1.95300326e-04, 1.55009972e-04
, 1.23031496e-04, 9.76501631e-05, 7.75049858e-05, 6.15157480e-05
, 4.88250816e-05, 3.87524929e-05, 3.07578740e-05, 2.44125408e-05
, 1.93762465e-05, 1.53789370e-05, 1.22062704e-05, 9.68812323e-06
, 7.68946850e-06, 6.10313520e-06, 4.84406162e-06, 3.84473425e-06
, 3.05156760e-06, 2.42203081e-06, 1.92236713e-06, 1.52578380e-06
, 1.21101540e-06, 9.61183563e-07, 7.62891900e-07, 6.05507702e-07
, 4.80591781e-07, 3.81445950e-07, 3.02753851e-07, 2.40295891e-07
, 1.90722975e-07, 1.51376925e-07, 1.20147945e-07, 9.53614874e-08
, 7.56884627e-08, 6.00739727e-08, 4.76807437e-08, 3.78442314e-08
, 3.00369863e-08, 2.38403719e-08, 1.89221157e-08, 0.00000000e+00
3.14960630e-02f, 2.49984418e-02f, 1.98412764e-02f, 1.57480315e-02f
, 1.24992209e-02f, 9.92063819e-03f, 7.87401575e-03f, 6.24961044e-03f
, 4.96031909e-03f, 3.93700787e-03f, 3.12480522e-03f, 2.48015955e-03f
, 1.96850394e-03f, 1.56240261e-03f, 1.24007977e-03f, 9.84251969e-04f
, 7.81201305e-04f, 6.20039887e-04f, 4.92125984e-04f, 3.90600653e-04f
, 3.10019943e-04f, 2.46062992e-04f, 1.95300326e-04f, 1.55009972e-04f
, 1.23031496e-04f, 9.76501631e-05f, 7.75049858e-05f, 6.15157480e-05f
, 4.88250816e-05f, 3.87524929e-05f, 3.07578740e-05f, 2.44125408e-05f
, 1.93762465e-05f, 1.53789370e-05f, 1.22062704e-05f, 9.68812323e-06f
, 7.68946850e-06f, 6.10313520e-06f, 4.84406162e-06f, 3.84473425e-06f
, 3.05156760e-06f, 2.42203081e-06f, 1.92236713e-06f, 1.52578380e-06f
, 1.21101540e-06f, 9.61183563e-07f, 7.62891900e-07f, 6.05507702e-07f
, 4.80591781e-07f, 3.81445950e-07f, 3.02753851e-07f, 2.40295891e-07f
, 1.90722975e-07f, 1.51376925e-07f, 1.20147945e-07f, 9.53614874e-08f
, 7.56884627e-08f, 6.00739727e-08f, 4.76807437e-08f, 3.78442314e-08f
, 3.00369863e-08f, 2.38403719e-08f, 1.89221157e-08f, 0.00000000e+00f
}
, {
1.56862745e-02, 1.24502043e-02, 9.88173372e-03, 7.84313725e-03
, 6.22510216e-03, 4.94086686e-03, 3.92156863e-03, 3.11255108e-03
, 2.47043343e-03, 1.96078431e-03, 1.55627554e-03, 1.23521672e-03
, 9.80392157e-04, 7.78137771e-04, 6.17608358e-04, 4.90196078e-04
, 3.89068885e-04, 3.08804179e-04, 2.45098039e-04, 1.94534443e-04
, 1.54402089e-04, 1.22549020e-04, 9.72672213e-05, 7.72010447e-05
, 6.12745098e-05, 4.86336107e-05, 3.86005224e-05, 3.06372549e-05
, 2.43168053e-05, 1.93002612e-05, 1.53186275e-05, 1.21584027e-05
, 9.65013059e-06, 7.65931373e-06, 6.07920133e-06, 4.82506530e-06
, 3.82965686e-06, 3.03960067e-06, 2.41253265e-06, 1.91482843e-06
, 1.51980033e-06, 1.20626632e-06, 9.57414216e-07, 7.59900167e-07
, 6.03133162e-07, 4.78707108e-07, 3.79950083e-07, 3.01566581e-07
, 2.39353554e-07, 1.89975042e-07, 1.50783290e-07, 1.19676777e-07
, 9.49875208e-08, 7.53916452e-08, 5.98383885e-08, 4.74937604e-08
, 3.76958226e-08, 2.99191942e-08, 2.37468802e-08, 1.88479113e-08
, 1.49595971e-08, 1.18734401e-08, 9.42395565e-09, 0.00000000e+00
1.56862745e-02f, 1.24502043e-02f, 9.88173372e-03f, 7.84313725e-03f
, 6.22510216e-03f, 4.94086686e-03f, 3.92156863e-03f, 3.11255108e-03f
, 2.47043343e-03f, 1.96078431e-03f, 1.55627554e-03f, 1.23521672e-03f
, 9.80392157e-04f, 7.78137771e-04f, 6.17608358e-04f, 4.90196078e-04f
, 3.89068885e-04f, 3.08804179e-04f, 2.45098039e-04f, 1.94534443e-04f
, 1.54402089e-04f, 1.22549020e-04f, 9.72672213e-05f, 7.72010447e-05f
, 6.12745098e-05f, 4.86336107e-05f, 3.86005224e-05f, 3.06372549e-05f
, 2.43168053e-05f, 1.93002612e-05f, 1.53186275e-05f, 1.21584027e-05f
, 9.65013059e-06f, 7.65931373e-06f, 6.07920133e-06f, 4.82506530e-06f
, 3.82965686e-06f, 3.03960067e-06f, 2.41253265e-06f, 1.91482843e-06f
, 1.51980033e-06f, 1.20626632e-06f, 9.57414216e-07f, 7.59900167e-07f
, 6.03133162e-07f, 4.78707108e-07f, 3.79950083e-07f, 3.01566581e-07f
, 2.39353554e-07f, 1.89975042e-07f, 1.50783290e-07f, 1.19676777e-07f
, 9.49875208e-08f, 7.53916452e-08f, 5.98383885e-08f, 4.74937604e-08f
, 3.76958226e-08f, 2.99191942e-08f, 2.37468802e-08f, 1.88479113e-08f
, 1.49595971e-08f, 1.18734401e-08f, 9.42395565e-09f, 0.00000000e+00f
}
, {
7.82778865e-03, 6.21291997e-03, 4.93119785e-03, 3.91389432e-03
, 3.10645998e-03, 2.46559892e-03, 1.95694716e-03, 1.55322999e-03
, 1.23279946e-03, 9.78473581e-04, 7.76614996e-04, 6.16399731e-04
, 4.89236791e-04, 3.88307498e-04, 3.08199865e-04, 2.44618395e-04
, 1.94153749e-04, 1.54099933e-04, 1.22309198e-04, 9.70768745e-05
, 7.70499664e-05, 6.11545988e-05, 4.85384373e-05, 3.85249832e-05
, 3.05772994e-05, 2.42692186e-05, 1.92624916e-05, 1.52886497e-05
, 1.21346093e-05, 9.63124579e-06, 7.64432485e-06, 6.06730466e-06
, 4.81562290e-06, 3.82216243e-06, 3.03365233e-06, 2.40781145e-06
, 1.91108121e-06, 1.51682616e-06, 1.20390572e-06, 9.55540607e-07
, 7.58413082e-07, 6.01952862e-07, 4.77770303e-07, 3.79206541e-07
, 3.00976431e-07, 2.38885152e-07, 1.89603271e-07, 1.50488216e-07
, 1.19442576e-07, 9.48016353e-08, 7.52441078e-08, 5.97212879e-08
, 4.74008176e-08, 3.76220539e-08, 2.98606440e-08, 2.37004088e-08
, 1.88110269e-08, 1.49303220e-08, 1.18502044e-08, 9.40551347e-09
, 7.46516099e-09, 5.92510220e-09, 4.70275674e-09, 0.00000000e+00
7.82778865e-03f, 6.21291997e-03f, 4.93119785e-03f, 3.91389432e-03f
, 3.10645998e-03f, 2.46559892e-03f, 1.95694716e-03f, 1.55322999e-03f
, 1.23279946e-03f, 9.78473581e-04f, 7.76614996e-04f, 6.16399731e-04f
, 4.89236791e-04f, 3.88307498e-04f, 3.08199865e-04f, 2.44618395e-04f
, 1.94153749e-04f, 1.54099933e-04f, 1.22309198e-04f, 9.70768745e-05f
, 7.70499664e-05f, 6.11545988e-05f, 4.85384373e-05f, 3.85249832e-05f
, 3.05772994e-05f, 2.42692186e-05f, 1.92624916e-05f, 1.52886497e-05f
, 1.21346093e-05f, 9.63124579e-06f, 7.64432485e-06f, 6.06730466e-06f
, 4.81562290e-06f, 3.82216243e-06f, 3.03365233e-06f, 2.40781145e-06f
, 1.91108121e-06f, 1.51682616e-06f, 1.20390572e-06f, 9.55540607e-07f
, 7.58413082e-07f, 6.01952862e-07f, 4.77770303e-07f, 3.79206541e-07f
, 3.00976431e-07f, 2.38885152e-07f, 1.89603271e-07f, 1.50488216e-07f
, 1.19442576e-07f, 9.48016353e-08f, 7.52441078e-08f, 5.97212879e-08f
, 4.74008176e-08f, 3.76220539e-08f, 2.98606440e-08f, 2.37004088e-08f
, 1.88110269e-08f, 1.49303220e-08f, 1.18502044e-08f, 9.40551347e-09f
, 7.46516099e-09f, 5.92510220e-09f, 4.70275674e-09f, 0.00000000e+00f
}
, {
3.91006843e-03, 3.10342337e-03, 2.46318876e-03, 1.95503421e-03
, 1.55171168e-03, 1.23159438e-03, 9.77517107e-04, 7.75855842e-04
, 6.15797190e-04, 4.88758553e-04, 3.87927921e-04, 3.07898595e-04
, 2.44379277e-04, 1.93963960e-04, 1.53949297e-04, 1.22189638e-04
, 9.69819802e-05, 7.69746487e-05, 6.10948192e-05, 4.84909901e-05
, 3.84873243e-05, 3.05474096e-05, 2.42454951e-05, 1.92436622e-05
, 1.52737048e-05, 1.21227475e-05, 9.62183109e-06, 7.63685239e-06
, 6.06137376e-06, 4.81091554e-06, 3.81842620e-06, 3.03068688e-06
, 2.40545777e-06, 1.90921310e-06, 1.51534344e-06, 1.20272889e-06
, 9.54606549e-07, 7.57671720e-07, 6.01364443e-07, 4.77303275e-07
, 3.78835860e-07, 3.00682221e-07, 2.38651637e-07, 1.89417930e-07
, 1.50341111e-07, 1.19325819e-07, 9.47089650e-08, 7.51705554e-08
, 5.96629093e-08, 4.73544825e-08, 3.75852777e-08, 2.98314547e-08
, 2.36772413e-08, 1.87926388e-08, 1.49157273e-08, 1.18386206e-08
, 9.39631942e-09, 7.45786367e-09, 5.91931032e-09, 4.69815971e-09
, 3.72893183e-09, 2.95965516e-09, 2.34907986e-09, 0.00000000e+00
3.91006843e-03f, 3.10342337e-03f, 2.46318876e-03f, 1.95503421e-03f
, 1.55171168e-03f, 1.23159438e-03f, 9.77517107e-04f, 7.75855842e-04f
, 6.15797190e-04f, 4.88758553e-04f, 3.87927921e-04f, 3.07898595e-04f
, 2.44379277e-04f, 1.93963960e-04f, 1.53949297e-04f, 1.22189638e-04f
, 9.69819802e-05f, 7.69746487e-05f, 6.10948192e-05f, 4.84909901e-05f
, 3.84873243e-05f, 3.05474096e-05f, 2.42454951e-05f, 1.92436622e-05f
, 1.52737048e-05f, 1.21227475e-05f, 9.62183109e-06f, 7.63685239e-06f
, 6.06137376e-06f, 4.81091554e-06f, 3.81842620e-06f, 3.03068688e-06f
, 2.40545777e-06f, 1.90921310e-06f, 1.51534344e-06f, 1.20272889e-06f
, 9.54606549e-07f, 7.57671720e-07f, 6.01364443e-07f, 4.77303275e-07f
, 3.78835860e-07f, 3.00682221e-07f, 2.38651637e-07f, 1.89417930e-07f
, 1.50341111e-07f, 1.19325819e-07f, 9.47089650e-08f, 7.51705554e-08f
, 5.96629093e-08f, 4.73544825e-08f, 3.75852777e-08f, 2.98314547e-08f
, 2.36772413e-08f, 1.87926388e-08f, 1.49157273e-08f, 1.18386206e-08f
, 9.39631942e-09f, 7.45786367e-09f, 5.91931032e-09f, 4.69815971e-09f
, 3.72893183e-09f, 2.95965516e-09f, 2.34907986e-09f, 0.00000000e+00f
}
, {
1.95407914e-03, 1.55095364e-03, 1.23099272e-03, 9.77039570e-04
, 7.75476821e-04, 6.15496360e-04, 4.88519785e-04, 3.87738410e-04
, 3.07748180e-04, 2.44259893e-04, 1.93869205e-04, 1.53874090e-04
, 1.22129946e-04, 9.69346026e-05, 7.69370451e-05, 6.10649731e-05
, 4.84673013e-05, 3.84685225e-05, 3.05324866e-05, 2.42336506e-05
, 1.92342613e-05, 1.52662433e-05, 1.21168253e-05, 9.61713063e-06
, 7.63312164e-06, 6.05841266e-06, 4.80856532e-06, 3.81656082e-06
, 3.02920633e-06, 2.40428266e-06, 1.90828041e-06, 1.51460317e-06
, 1.20214133e-06, 9.54140205e-07, 7.57301583e-07, 6.01070665e-07
, 4.77070103e-07, 3.78650791e-07, 3.00535332e-07, 2.38535051e-07
, 1.89325396e-07, 1.50267666e-07, 1.19267526e-07, 9.46626978e-08
, 7.51338331e-08, 5.96337628e-08, 4.73313489e-08, 3.75669165e-08
, 2.98168814e-08, 2.36656745e-08, 1.87834583e-08, 1.49084407e-08
, 1.18328372e-08, 9.39172913e-09, 7.45422035e-09, 5.91641861e-09
, 4.69586457e-09, 3.72711018e-09, 2.95820931e-09, 2.34793228e-09
, 1.86355509e-09, 1.47910465e-09, 1.17396614e-09, 0.00000000e+00
1.95407914e-03f, 1.55095364e-03f, 1.23099272e-03f, 9.77039570e-04f
, 7.75476821e-04f, 6.15496360e-04f, 4.88519785e-04f, 3.87738410e-04f
, 3.07748180e-04f, 2.44259893e-04f, 1.93869205e-04f, 1.53874090e-04f
, 1.22129946e-04f, 9.69346026e-05f, 7.69370451e-05f, 6.10649731e-05f
, 4.84673013e-05f, 3.84685225e-05f, 3.05324866e-05f, 2.42336506e-05f
, 1.92342613e-05f, 1.52662433e-05f, 1.21168253e-05f, 9.61713063e-06f
, 7.63312164e-06f, 6.05841266e-06f, 4.80856532e-06f, 3.81656082e-06f
, 3.02920633e-06f, 2.40428266e-06f, 1.90828041e-06f, 1.51460317e-06f
, 1.20214133e-06f, 9.54140205e-07f, 7.57301583e-07f, 6.01070665e-07f
, 4.77070103e-07f, 3.78650791e-07f, 3.00535332e-07f, 2.38535051e-07f
, 1.89325396e-07f, 1.50267666e-07f, 1.19267526e-07f, 9.46626978e-08f
, 7.51338331e-08f, 5.96337628e-08f, 4.73313489e-08f, 3.75669165e-08f
, 2.98168814e-08f, 2.36656745e-08f, 1.87834583e-08f, 1.49084407e-08f
, 1.18328372e-08f, 9.39172913e-09f, 7.45422035e-09f, 5.91641861e-09f
, 4.69586457e-09f, 3.72711018e-09f, 2.95820931e-09f, 2.34793228e-09f
, 1.86355509e-09f, 1.47910465e-09f, 1.17396614e-09f, 0.00000000e+00f
}
, {
9.76800977e-04, 7.75287449e-04, 6.15346056e-04, 4.88400488e-04
, 3.87643725e-04, 3.07673028e-04, 2.44200244e-04, 1.93821862e-04
, 1.53836514e-04, 1.22100122e-04, 9.69109311e-05, 7.69182570e-05
, 6.10500611e-05, 4.84554656e-05, 3.84591285e-05, 3.05250305e-05
, 2.42277328e-05, 1.92295643e-05, 1.52625153e-05, 1.21138664e-05
, 9.61478213e-06, 7.63125763e-06, 6.05693320e-06, 4.80739106e-06
, 3.81562882e-06, 3.02846660e-06, 2.40369553e-06, 1.90781441e-06
, 1.51423330e-06, 1.20184777e-06, 9.53907204e-07, 7.57116649e-07
, 6.00923883e-07, 4.76953602e-07, 3.78558325e-07, 3.00461941e-07
, 2.38476801e-07, 1.89279162e-07, 1.50230971e-07, 1.19238400e-07
, 9.46395812e-08, 7.51154854e-08, 5.96192002e-08, 4.73197906e-08
, 3.75577427e-08, 2.98096001e-08, 2.36598953e-08, 1.87788713e-08
, 1.49048001e-08, 1.18299476e-08, 9.38943567e-09, 7.45240003e-09
, 5.91497382e-09, 4.69471784e-09, 3.72620002e-09, 2.95748691e-09
, 2.34735892e-09, 1.86310001e-09, 1.47874346e-09, 1.17367946e-09
, 9.31550004e-10, 7.39371728e-10, 5.86839729e-10, 0.00000000e+00
9.76800977e-04f, 7.75287449e-04f, 6.15346056e-04f, 4.88400488e-04f
, 3.87643725e-04f, 3.07673028e-04f, 2.44200244e-04f, 1.93821862e-04f
, 1.53836514e-04f, 1.22100122e-04f, 9.69109311e-05f, 7.69182570e-05f
, 6.10500611e-05f, 4.84554656e-05f, 3.84591285e-05f, 3.05250305e-05f
, 2.42277328e-05f, 1.92295643e-05f, 1.52625153e-05f, 1.21138664e-05f
, 9.61478213e-06f, 7.63125763e-06f, 6.05693320e-06f, 4.80739106e-06f
, 3.81562882e-06f, 3.02846660e-06f, 2.40369553e-06f, 1.90781441e-06f
, 1.51423330e-06f, 1.20184777e-06f, 9.53907204e-07f, 7.57116649e-07f
, 6.00923883e-07f, 4.76953602e-07f, 3.78558325e-07f, 3.00461941e-07f
, 2.38476801e-07f, 1.89279162e-07f, 1.50230971e-07f, 1.19238400e-07f
, 9.46395812e-08f, 7.51154854e-08f, 5.96192002e-08f, 4.73197906e-08f
, 3.75577427e-08f, 2.98096001e-08f, 2.36598953e-08f, 1.87788713e-08f
, 1.49048001e-08f, 1.18299476e-08f, 9.38943567e-09f, 7.45240003e-09f
, 5.91497382e-09f, 4.69471784e-09f, 3.72620002e-09f, 2.95748691e-09f
, 2.34735892e-09f, 1.86310001e-09f, 1.47874346e-09f, 1.17367946e-09f
, 9.31550004e-10f, 7.39371728e-10f, 5.86839729e-10f, 0.00000000e+00f
}
, {
4.88340862e-04, 3.87596399e-04, 3.07635466e-04, 2.44170431e-04
, 1.93798199e-04, 1.53817733e-04, 1.22085215e-04, 9.68990997e-05
, 7.69088664e-05, 6.10426077e-05, 4.84495499e-05, 3.84544332e-05
, 3.05213039e-05, 2.42247749e-05, 1.92272166e-05, 1.52606519e-05
, 1.21123875e-05, 9.61360830e-06, 7.63032597e-06, 6.05619373e-06
, 4.80680415e-06, 3.81516298e-06, 3.02809687e-06, 2.40340208e-06
, 1.90758149e-06, 1.51404843e-06, 1.20170104e-06, 9.53790746e-07
, 7.57024217e-07, 6.00850519e-07, 4.76895373e-07, 3.78512108e-07
, 3.00425260e-07, 2.38447686e-07, 1.89256054e-07, 1.50212630e-07
, 1.19223843e-07, 9.46280271e-08, 7.51063149e-08, 5.96119216e-08
, 4.73140135e-08, 3.75531574e-08, 2.98059608e-08, 2.36570068e-08
, 1.87765787e-08, 1.49029804e-08, 1.18285034e-08, 9.38828936e-09
, 7.45149020e-09, 5.91425169e-09, 4.69414468e-09, 3.72574510e-09
, 2.95712585e-09, 2.34707234e-09, 1.86287255e-09, 1.47856292e-09
, 1.17353617e-09, 9.31436275e-10, 7.39281462e-10, 5.86768085e-10
, 4.65718138e-10, 3.69640731e-10, 2.93384042e-10, 0.00000000e+00
4.88340862e-04f, 3.87596399e-04f, 3.07635466e-04f, 2.44170431e-04f
, 1.93798199e-04f, 1.53817733e-04f, 1.22085215e-04f, 9.68990997e-05f
, 7.69088664e-05f, 6.10426077e-05f, 4.84495499e-05f, 3.84544332e-05f
, 3.05213039e-05f, 2.42247749e-05f, 1.92272166e-05f, 1.52606519e-05f
, 1.21123875e-05f, 9.61360830e-06f, 7.63032597e-06f, 6.05619373e-06f
, 4.80680415e-06f, 3.81516298e-06f, 3.02809687e-06f, 2.40340208e-06f
, 1.90758149e-06f, 1.51404843e-06f, 1.20170104e-06f, 9.53790746e-07f
, 7.57024217e-07f, 6.00850519e-07f, 4.76895373e-07f, 3.78512108e-07f
, 3.00425260e-07f, 2.38447686e-07f, 1.89256054e-07f, 1.50212630e-07f
, 1.19223843e-07f, 9.46280271e-08f, 7.51063149e-08f, 5.96119216e-08f
, 4.73140135e-08f, 3.75531574e-08f, 2.98059608e-08f, 2.36570068e-08f
, 1.87765787e-08f, 1.49029804e-08f, 1.18285034e-08f, 9.38828936e-09f
, 7.45149020e-09f, 5.91425169e-09f, 4.69414468e-09f, 3.72574510e-09f
, 2.95712585e-09f, 2.34707234e-09f, 1.86287255e-09f, 1.47856292e-09f
, 1.17353617e-09f, 9.31436275e-10f, 7.39281462e-10f, 5.86768085e-10f
, 4.65718138e-10f, 3.69640731e-10f, 2.93384042e-10f, 0.00000000e+00f
}
, {
2.44155527e-04, 1.93786370e-04, 1.53808344e-04, 1.22077764e-04
, 9.68931851e-05, 7.69041720e-05, 6.10388818e-05, 4.84465926e-05
, 3.84520860e-05, 3.05194409e-05, 2.42232963e-05, 1.92260430e-05
, 1.52597204e-05, 1.21116481e-05, 9.61302150e-06, 7.62986022e-06
, 6.05582407e-06, 4.80651075e-06, 3.81493011e-06, 3.02791204e-06
, 2.40325538e-06, 1.90746506e-06, 1.51395602e-06, 1.20162769e-06
, 9.53732528e-07, 7.56978009e-07, 6.00813844e-07, 4.76866264e-07
, 3.78489004e-07, 3.00406922e-07, 2.38433132e-07, 1.89244502e-07
, 1.50203461e-07, 1.19216566e-07, 9.46222511e-08, 7.51017305e-08
, 5.96082830e-08, 4.73111256e-08, 3.75508652e-08, 2.98041415e-08
, 2.36555628e-08, 1.87754326e-08, 1.49020707e-08, 1.18277814e-08
, 9.38771631e-09, 7.45103537e-09, 5.91389069e-09, 4.69385815e-09
, 3.72551769e-09, 2.95694535e-09, 2.34692908e-09, 1.86275884e-09
, 1.47847267e-09, 1.17346454e-09, 9.31379422e-10, 7.39236337e-10
, 5.86732269e-10, 4.65689711e-10, 3.69618168e-10, 2.93366135e-10
, 2.32844855e-10, 1.84809084e-10, 1.46683067e-10, 0.00000000e+00
2.44155527e-04f, 1.93786370e-04f, 1.53808344e-04f, 1.22077764e-04f
, 9.68931851e-05f, 7.69041720e-05f, 6.10388818e-05f, 4.84465926e-05f
, 3.84520860e-05f, 3.05194409e-05f, 2.42232963e-05f, 1.92260430e-05f
, 1.52597204e-05f, 1.21116481e-05f, 9.61302150e-06f, 7.62986022e-06f
, 6.05582407e-06f, 4.80651075e-06f, 3.81493011e-06f, 3.02791204e-06f
, 2.40325538e-06f, 1.90746506e-06f, 1.51395602e-06f, 1.20162769e-06f
, 9.53732528e-07f, 7.56978009e-07f, 6.00813844e-07f, 4.76866264e-07f
, 3.78489004e-07f, 3.00406922e-07f, 2.38433132e-07f, 1.89244502e-07f
, 1.50203461e-07f, 1.19216566e-07f, 9.46222511e-08f, 7.51017305e-08f
, 5.96082830e-08f, 4.73111256e-08f, 3.75508652e-08f, 2.98041415e-08f
, 2.36555628e-08f, 1.87754326e-08f, 1.49020707e-08f, 1.18277814e-08f
, 9.38771631e-09f, 7.45103537e-09f, 5.91389069e-09f, 4.69385815e-09f
, 3.72551769e-09f, 2.95694535e-09f, 2.34692908e-09f, 1.86275884e-09f
, 1.47847267e-09f, 1.17346454e-09f, 9.31379422e-10f, 7.39236337e-10f
, 5.86732269e-10f, 4.65689711e-10f, 3.69618168e-10f, 2.93366135e-10f
, 2.32844855e-10f, 1.84809084e-10f, 1.46683067e-10f, 0.00000000e+00f
}
, {
1.22074038e-04, 9.68902281e-05, 7.69018250e-05, 6.10370190e-05
, 4.84451140e-05, 3.84509125e-05, 3.05185095e-05, 2.42225570e-05
, 1.92254563e-05, 1.52592547e-05, 1.21112785e-05, 9.61272813e-06
, 7.62962737e-06, 6.05563926e-06, 4.80636406e-06, 3.81481368e-06
, 3.02781963e-06, 2.40318203e-06, 1.90740684e-06, 1.51390981e-06
, 1.20159102e-06, 9.53703421e-07, 7.56954907e-07, 6.00795508e-07
, 4.76851711e-07, 3.78477453e-07, 3.00397754e-07, 2.38425855e-07
, 1.89238727e-07, 1.50198877e-07, 1.19212928e-07, 9.46193634e-08
, 7.50994385e-08, 5.96064638e-08, 4.73096817e-08, 3.75497192e-08
, 2.98032319e-08, 2.36548408e-08, 1.87748596e-08, 1.49016160e-08
, 1.18274204e-08, 9.38742981e-09, 7.45080798e-09, 5.91371021e-09
, 4.69371490e-09, 3.72540399e-09, 2.95685511e-09, 2.34685745e-09
, 1.86270199e-09, 1.47842755e-09, 1.17342873e-09, 9.31350997e-10
, 7.39213776e-10, 5.86714363e-10, 4.65675499e-10, 3.69606888e-10
, 2.93357182e-10, 2.32837749e-10, 1.84803444e-10, 1.46678591e-10
, 1.16418875e-10, 9.24017220e-11, 7.33392954e-11, 0.00000000e+00
1.22074038e-04f, 9.68902281e-05f, 7.69018250e-05f, 6.10370190e-05f
, 4.84451140e-05f, 3.84509125e-05f, 3.05185095e-05f, 2.42225570e-05f
, 1.92254563e-05f, 1.52592547e-05f, 1.21112785e-05f, 9.61272813e-06f
, 7.62962737e-06f, 6.05563926e-06f, 4.80636406e-06f, 3.81481368e-06f
, 3.02781963e-06f, 2.40318203e-06f, 1.90740684e-06f, 1.51390981e-06f
, 1.20159102e-06f, 9.53703421e-07f, 7.56954907e-07f, 6.00795508e-07f
, 4.76851711e-07f, 3.78477453e-07f, 3.00397754e-07f, 2.38425855e-07f
, 1.89238727e-07f, 1.50198877e-07f, 1.19212928e-07f, 9.46193634e-08f
, 7.50994385e-08f, 5.96064638e-08f, 4.73096817e-08f, 3.75497192e-08f
, 2.98032319e-08f, 2.36548408e-08f, 1.87748596e-08f, 1.49016160e-08f
, 1.18274204e-08f, 9.38742981e-09f, 7.45080798e-09f, 5.91371021e-09f
, 4.69371490e-09f, 3.72540399e-09f, 2.95685511e-09f, 2.34685745e-09f
, 1.86270199e-09f, 1.47842755e-09f, 1.17342873e-09f, 9.31350997e-10f
, 7.39213776e-10f, 5.86714363e-10f, 4.65675499e-10f, 3.69606888e-10f
, 2.93357182e-10f, 2.32837749e-10f, 1.84803444e-10f, 1.46678591e-10f
, 1.16418875e-10f, 9.24017220e-11f, 7.33392954e-11f, 0.00000000e+00f
}
, {
6.10360876e-05, 4.84443748e-05, 3.84503258e-05, 3.05180438e-05
, 2.42221874e-05, 1.92251629e-05, 1.52590219e-05, 1.21110937e-05
, 9.61258144e-06, 7.62951095e-06, 6.05554685e-06, 4.80629072e-06
, 3.81475547e-06, 3.02777343e-06, 2.40314536e-06, 1.90737774e-06
, 1.51388671e-06, 1.20157268e-06, 9.53688869e-07, 7.56943357e-07
, 6.00786340e-07, 4.76844434e-07, 3.78471678e-07, 3.00393170e-07
, 2.38422217e-07, 1.89235839e-07, 1.50196585e-07, 1.19211109e-07
, 9.46179196e-08, 7.50982925e-08, 5.96055543e-08, 4.73089598e-08
, 3.75491463e-08, 2.98027771e-08, 2.36544799e-08, 1.87745731e-08
, 1.49013886e-08, 1.18272399e-08, 9.38728657e-09, 7.45069429e-09
, 5.91361997e-09, 4.69364328e-09, 3.72534714e-09, 2.95680999e-09
, 2.34682164e-09, 1.86267357e-09, 1.47840499e-09, 1.17341082e-09
, 9.31336786e-10, 7.39202497e-10, 5.86705410e-10, 4.65668393e-10
, 3.69601248e-10, 2.93352705e-10, 2.32834196e-10, 1.84800624e-10
, 1.46676353e-10, 1.16417098e-10, 9.24003121e-11, 7.33381763e-11
, 5.82085491e-11, 4.62001560e-11, 3.66690882e-11, 0.00000000e+00
6.10360876e-05f, 4.84443748e-05f, 3.84503258e-05f, 3.05180438e-05f
, 2.42221874e-05f, 1.92251629e-05f, 1.52590219e-05f, 1.21110937e-05f
, 9.61258144e-06f, 7.62951095e-06f, 6.05554685e-06f, 4.80629072e-06f
, 3.81475547e-06f, 3.02777343e-06f, 2.40314536e-06f, 1.90737774e-06f
, 1.51388671e-06f, 1.20157268e-06f, 9.53688869e-07f, 7.56943357e-07f
, 6.00786340e-07f, 4.76844434e-07f, 3.78471678e-07f, 3.00393170e-07f
, 2.38422217e-07f, 1.89235839e-07f, 1.50196585e-07f, 1.19211109e-07f
, 9.46179196e-08f, 7.50982925e-08f, 5.96055543e-08f, 4.73089598e-08f
, 3.75491463e-08f, 2.98027771e-08f, 2.36544799e-08f, 1.87745731e-08f
, 1.49013886e-08f, 1.18272399e-08f, 9.38728657e-09f, 7.45069429e-09f
, 5.91361997e-09f, 4.69364328e-09f, 3.72534714e-09f, 2.95680999e-09f
, 2.34682164e-09f, 1.86267357e-09f, 1.47840499e-09f, 1.17341082e-09f
, 9.31336786e-10f, 7.39202497e-10f, 5.86705410e-10f, 4.65668393e-10f
, 3.69601248e-10f, 2.93352705e-10f, 2.32834196e-10f, 1.84800624e-10f
, 1.46676353e-10f, 1.16417098e-10f, 9.24003121e-11f, 7.33381763e-11f
, 5.82085491e-11f, 4.62001560e-11f, 3.66690882e-11f, 0.00000000e+00f
}
, {
-1.60000000e+00, -1.26992084e+00, -1.00793684e+00, -8.00000000e-01
, -6.34960421e-01, -5.03968420e-01, -4.00000000e-01, -3.17480210e-01
, -2.51984210e-01, -2.00000000e-01, -1.58740105e-01, -1.25992105e-01
, -1.00000000e-01, -7.93700526e-02, -6.29960525e-02, -5.00000000e-02
, -3.96850263e-02, -3.14980262e-02, -2.50000000e-02, -1.98425131e-02
, -1.57490131e-02, -1.25000000e-02, -9.92125657e-03, -7.87450656e-03
, -6.25000000e-03, -4.96062829e-03, -3.93725328e-03, -3.12500000e-03
, -2.48031414e-03, -1.96862664e-03, -1.56250000e-03, -1.24015707e-03
, -9.84313320e-04, -7.81250000e-04, -6.20078536e-04, -4.92156660e-04
, -3.90625000e-04, -3.10039268e-04, -2.46078330e-04, -1.95312500e-04
, -1.55019634e-04, -1.23039165e-04, -9.76562500e-05, -7.75098170e-05
, -6.15195825e-05, -4.88281250e-05, -3.87549085e-05, -3.07597913e-05
, -2.44140625e-05, -1.93774542e-05, -1.53798956e-05, -1.22070313e-05
, -9.68872712e-06, -7.68994781e-06, -6.10351563e-06, -4.84436356e-06
, -3.84497391e-06, -3.05175781e-06, -2.42218178e-06, -1.92248695e-06
, -1.52587891e-06, -1.21109089e-06, -9.61243477e-07, 0.00000000e+00
-1.60000000e+00f, -1.26992084e+00f, -1.00793684e+00f, -8.00000000e-01f
, -6.34960421e-01f, -5.03968420e-01f, -4.00000000e-01f, -3.17480210e-01f
, -2.51984210e-01f, -2.00000000e-01f, -1.58740105e-01f, -1.25992105e-01f
, -1.00000000e-01f, -7.93700526e-02f, -6.29960525e-02f, -5.00000000e-02f
, -3.96850263e-02f, -3.14980262e-02f, -2.50000000e-02f, -1.98425131e-02f
, -1.57490131e-02f, -1.25000000e-02f, -9.92125657e-03f, -7.87450656e-03f
, -6.25000000e-03f, -4.96062829e-03f, -3.93725328e-03f, -3.12500000e-03f
, -2.48031414e-03f, -1.96862664e-03f, -1.56250000e-03f, -1.24015707e-03f
, -9.84313320e-04f, -7.81250000e-04f, -6.20078536e-04f, -4.92156660e-04f
, -3.90625000e-04f, -3.10039268e-04f, -2.46078330e-04f, -1.95312500e-04f
, -1.55019634e-04f, -1.23039165e-04f, -9.76562500e-05f, -7.75098170e-05f
, -6.15195825e-05f, -4.88281250e-05f, -3.87549085e-05f, -3.07597913e-05f
, -2.44140625e-05f, -1.93774542e-05f, -1.53798956e-05f, -1.22070313e-05f
, -9.68872712e-06f, -7.68994781e-06f, -6.10351563e-06f, -4.84436356e-06f
, -3.84497391e-06f, -3.05175781e-06f, -2.42218178e-06f, -1.92248695e-06f
, -1.52587891e-06f, -1.21109089e-06f, -9.61243477e-07f, 0.00000000e+00f
}
, {
-8.00000000e-01, -6.34960421e-01, -5.03968420e-01, -4.00000000e-01
, -3.17480210e-01, -2.51984210e-01, -2.00000000e-01, -1.58740105e-01
, -1.25992105e-01, -1.00000000e-01, -7.93700526e-02, -6.29960525e-02
, -5.00000000e-02, -3.96850263e-02, -3.14980262e-02, -2.50000000e-02
, -1.98425131e-02, -1.57490131e-02, -1.25000000e-02, -9.92125657e-03
, -7.87450656e-03, -6.25000000e-03, -4.96062829e-03, -3.93725328e-03
, -3.12500000e-03, -2.48031414e-03, -1.96862664e-03, -1.56250000e-03
, -1.24015707e-03, -9.84313320e-04, -7.81250000e-04, -6.20078536e-04
, -4.92156660e-04, -3.90625000e-04, -3.10039268e-04, -2.46078330e-04
, -1.95312500e-04, -1.55019634e-04, -1.23039165e-04, -9.76562500e-05
, -7.75098170e-05, -6.15195825e-05, -4.88281250e-05, -3.87549085e-05
, -3.07597913e-05, -2.44140625e-05, -1.93774542e-05, -1.53798956e-05
, -1.22070313e-05, -9.68872712e-06, -7.68994781e-06, -6.10351563e-06
, -4.84436356e-06, -3.84497391e-06, -3.05175781e-06, -2.42218178e-06
, -1.92248695e-06, -1.52587891e-06, -1.21109089e-06, -9.61243477e-07
, -7.62939453e-07, -6.05545445e-07, -4.80621738e-07, 0.00000000e+00
-8.00000000e-01f, -6.34960421e-01f, -5.03968420e-01f, -4.00000000e-01f
, -3.17480210e-01f, -2.51984210e-01f, -2.00000000e-01f, -1.58740105e-01f
, -1.25992105e-01f, -1.00000000e-01f, -7.93700526e-02f, -6.29960525e-02f
, -5.00000000e-02f, -3.96850263e-02f, -3.14980262e-02f, -2.50000000e-02f
, -1.98425131e-02f, -1.57490131e-02f, -1.25000000e-02f, -9.92125657e-03f
, -7.87450656e-03f, -6.25000000e-03f, -4.96062829e-03f, -3.93725328e-03f
, -3.12500000e-03f, -2.48031414e-03f, -1.96862664e-03f, -1.56250000e-03f
, -1.24015707e-03f, -9.84313320e-04f, -7.81250000e-04f, -6.20078536e-04f
, -4.92156660e-04f, -3.90625000e-04f, -3.10039268e-04f, -2.46078330e-04f
, -1.95312500e-04f, -1.55019634e-04f, -1.23039165e-04f, -9.76562500e-05f
, -7.75098170e-05f, -6.15195825e-05f, -4.88281250e-05f, -3.87549085e-05f
, -3.07597913e-05f, -2.44140625e-05f, -1.93774542e-05f, -1.53798956e-05f
, -1.22070313e-05f, -9.68872712e-06f, -7.68994781e-06f, -6.10351563e-06f
, -4.84436356e-06f, -3.84497391e-06f, -3.05175781e-06f, -2.42218178e-06f
, -1.92248695e-06f, -1.52587891e-06f, -1.21109089e-06f, -9.61243477e-07f
, -7.62939453e-07f, -6.05545445e-07f, -4.80621738e-07f, 0.00000000e+00f
}
, {
8.00000000e-01, 6.34960421e-01, 5.03968420e-01, 4.00000000e-01
, 3.17480210e-01, 2.51984210e-01, 2.00000000e-01, 1.58740105e-01
, 1.25992105e-01, 1.00000000e-01, 7.93700526e-02, 6.29960525e-02
, 5.00000000e-02, 3.96850263e-02, 3.14980262e-02, 2.50000000e-02
, 1.98425131e-02, 1.57490131e-02, 1.25000000e-02, 9.92125657e-03
, 7.87450656e-03, 6.25000000e-03, 4.96062829e-03, 3.93725328e-03
, 3.12500000e-03, 2.48031414e-03, 1.96862664e-03, 1.56250000e-03
, 1.24015707e-03, 9.84313320e-04, 7.81250000e-04, 6.20078536e-04
, 4.92156660e-04, 3.90625000e-04, 3.10039268e-04, 2.46078330e-04
, 1.95312500e-04, 1.55019634e-04, 1.23039165e-04, 9.76562500e-05
, 7.75098170e-05, 6.15195825e-05, 4.88281250e-05, 3.87549085e-05
, 3.07597913e-05, 2.44140625e-05, 1.93774542e-05, 1.53798956e-05
, 1.22070313e-05, 9.68872712e-06, 7.68994781e-06, 6.10351563e-06
, 4.84436356e-06, 3.84497391e-06, 3.05175781e-06, 2.42218178e-06
, 1.92248695e-06, 1.52587891e-06, 1.21109089e-06, 9.61243477e-07
, 7.62939453e-07, 6.05545445e-07, 4.80621738e-07, 0.00000000e+00
8.00000000e-01f, 6.34960421e-01f, 5.03968420e-01f, 4.00000000e-01f
, 3.17480210e-01f, 2.51984210e-01f, 2.00000000e-01f, 1.58740105e-01f
, 1.25992105e-01f, 1.00000000e-01f, 7.93700526e-02f, 6.29960525e-02f
, 5.00000000e-02f, 3.96850263e-02f, 3.14980262e-02f, 2.50000000e-02f
, 1.98425131e-02f, 1.57490131e-02f, 1.25000000e-02f, 9.92125657e-03f
, 7.87450656e-03f, 6.25000000e-03f, 4.96062829e-03f, 3.93725328e-03f
, 3.12500000e-03f, 2.48031414e-03f, 1.96862664e-03f, 1.56250000e-03f
, 1.24015707e-03f, 9.84313320e-04f, 7.81250000e-04f, 6.20078536e-04f
, 4.92156660e-04f, 3.90625000e-04f, 3.10039268e-04f, 2.46078330e-04f
, 1.95312500e-04f, 1.55019634e-04f, 1.23039165e-04f, 9.76562500e-05f
, 7.75098170e-05f, 6.15195825e-05f, 4.88281250e-05f, 3.87549085e-05f
, 3.07597913e-05f, 2.44140625e-05f, 1.93774542e-05f, 1.53798956e-05f
, 1.22070313e-05f, 9.68872712e-06f, 7.68994781e-06f, 6.10351563e-06f
, 4.84436356e-06f, 3.84497391e-06f, 3.05175781e-06f, 2.42218178e-06f
, 1.92248695e-06f, 1.52587891e-06f, 1.21109089e-06f, 9.61243477e-07f
, 7.62939453e-07f, 6.05545445e-07f, 4.80621738e-07f, 0.00000000e+00f
}
, {
1.60000000e+00, 1.26992084e+00, 1.00793684e+00, 8.00000000e-01
, 6.34960421e-01, 5.03968420e-01, 4.00000000e-01, 3.17480210e-01
, 2.51984210e-01, 2.00000000e-01, 1.58740105e-01, 1.25992105e-01
, 1.00000000e-01, 7.93700526e-02, 6.29960525e-02, 5.00000000e-02
, 3.96850263e-02, 3.14980262e-02, 2.50000000e-02, 1.98425131e-02
, 1.57490131e-02, 1.25000000e-02, 9.92125657e-03, 7.87450656e-03
, 6.25000000e-03, 4.96062829e-03, 3.93725328e-03, 3.12500000e-03
, 2.48031414e-03, 1.96862664e-03, 1.56250000e-03, 1.24015707e-03
, 9.84313320e-04, 7.81250000e-04, 6.20078536e-04, 4.92156660e-04
, 3.90625000e-04, 3.10039268e-04, 2.46078330e-04, 1.95312500e-04
, 1.55019634e-04, 1.23039165e-04, 9.76562500e-05, 7.75098170e-05
, 6.15195825e-05, 4.88281250e-05, 3.87549085e-05, 3.07597913e-05
, 2.44140625e-05, 1.93774542e-05, 1.53798956e-05, 1.22070313e-05
, 9.68872712e-06, 7.68994781e-06, 6.10351563e-06, 4.84436356e-06
, 3.84497391e-06, 3.05175781e-06, 2.42218178e-06, 1.92248695e-06
, 1.52587891e-06, 1.21109089e-06, 9.61243477e-07, 0.00000000e+00
1.60000000e+00f, 1.26992084e+00f, 1.00793684e+00f, 8.00000000e-01f
, 6.34960421e-01f, 5.03968420e-01f, 4.00000000e-01f, 3.17480210e-01f
, 2.51984210e-01f, 2.00000000e-01f, 1.58740105e-01f, 1.25992105e-01f
, 1.00000000e-01f, 7.93700526e-02f, 6.29960525e-02f, 5.00000000e-02f
, 3.96850263e-02f, 3.14980262e-02f, 2.50000000e-02f, 1.98425131e-02f
, 1.57490131e-02f, 1.25000000e-02f, 9.92125657e-03f, 7.87450656e-03f
, 6.25000000e-03f, 4.96062829e-03f, 3.93725328e-03f, 3.12500000e-03f
, 2.48031414e-03f, 1.96862664e-03f, 1.56250000e-03f, 1.24015707e-03f
, 9.84313320e-04f, 7.81250000e-04f, 6.20078536e-04f, 4.92156660e-04f
, 3.90625000e-04f, 3.10039268e-04f, 2.46078330e-04f, 1.95312500e-04f
, 1.55019634e-04f, 1.23039165e-04f, 9.76562500e-05f, 7.75098170e-05f
, 6.15195825e-05f, 4.88281250e-05f, 3.87549085e-05f, 3.07597913e-05f
, 2.44140625e-05f, 1.93774542e-05f, 1.53798956e-05f, 1.22070313e-05f
, 9.68872712e-06f, 7.68994781e-06f, 6.10351563e-06f, 4.84436356e-06f
, 3.84497391e-06f, 3.05175781e-06f, 2.42218178e-06f, 1.92248695e-06f
, 1.52587891e-06f, 1.21109089e-06f, 9.61243477e-07f, 0.00000000e+00f
}
, {
-1.77777778e+00, -1.41102316e+00, -1.11992982e+00, -8.88888889e-01
, -7.05511579e-01, -5.59964911e-01, -4.44444444e-01, -3.52755789e-01
, -2.79982456e-01, -2.22222222e-01, -1.76377895e-01, -1.39991228e-01
, -1.11111111e-01, -8.81889473e-02, -6.99956139e-02, -5.55555556e-02
, -4.40944737e-02, -3.49978069e-02, -2.77777778e-02, -2.20472368e-02
, -1.74989035e-02, -1.38888889e-02, -1.10236184e-02, -8.74945174e-03
, -6.94444444e-03, -5.51180921e-03, -4.37472587e-03, -3.47222222e-03
, -2.75590460e-03, -2.18736293e-03, -1.73611111e-03, -1.37795230e-03
, -1.09368147e-03, -8.68055556e-04, -6.88976151e-04, -5.46840733e-04
, -4.34027778e-04, -3.44488076e-04, -2.73420367e-04, -2.17013889e-04
, -1.72244038e-04, -1.36710183e-04, -1.08506944e-04, -8.61220189e-05
, -6.83550917e-05, -5.42534722e-05, -4.30610094e-05, -3.41775458e-05
, -2.71267361e-05, -2.15305047e-05, -1.70887729e-05, -1.35633681e-05
, -1.07652524e-05, -8.54438646e-06, -6.78168403e-06, -5.38262618e-06
, -4.27219323e-06, -3.39084201e-06, -2.69131309e-06, -2.13609662e-06
, -1.69542101e-06, -1.34565654e-06, -1.06804831e-06, 0.00000000e+00
-1.77777778e+00f, -1.41102316e+00f, -1.11992982e+00f, -8.88888889e-01f
, -7.05511579e-01f, -5.59964911e-01f, -4.44444444e-01f, -3.52755789e-01f
, -2.79982456e-01f, -2.22222222e-01f, -1.76377895e-01f, -1.39991228e-01f
, -1.11111111e-01f, -8.81889473e-02f, -6.99956139e-02f, -5.55555556e-02f
, -4.40944737e-02f, -3.49978069e-02f, -2.77777778e-02f, -2.20472368e-02f
, -1.74989035e-02f, -1.38888889e-02f, -1.10236184e-02f, -8.74945174e-03f
, -6.94444444e-03f, -5.51180921e-03f, -4.37472587e-03f, -3.47222222e-03f
, -2.75590460e-03f, -2.18736293e-03f, -1.73611111e-03f, -1.37795230e-03f
, -1.09368147e-03f, -8.68055556e-04f, -6.88976151e-04f, -5.46840733e-04f
, -4.34027778e-04f, -3.44488076e-04f, -2.73420367e-04f, -2.17013889e-04f
, -1.72244038e-04f, -1.36710183e-04f, -1.08506944e-04f, -8.61220189e-05f
, -6.83550917e-05f, -5.42534722e-05f, -4.30610094e-05f, -3.41775458e-05f
, -2.71267361e-05f, -2.15305047e-05f, -1.70887729e-05f, -1.35633681e-05f
, -1.07652524e-05f, -8.54438646e-06f, -6.78168403e-06f, -5.38262618e-06f
, -4.27219323e-06f, -3.39084201e-06f, -2.69131309e-06f, -2.13609662e-06f
, -1.69542101e-06f, -1.34565654e-06f, -1.06804831e-06f, 0.00000000e+00f
}
, {
-8.88888889e-01, -7.05511579e-01, -5.59964911e-01, -4.44444444e-01
, -3.52755789e-01, -2.79982456e-01, -2.22222222e-01, -1.76377895e-01
, -1.39991228e-01, -1.11111111e-01, -8.81889473e-02, -6.99956139e-02
, -5.55555556e-02, -4.40944737e-02, -3.49978069e-02, -2.77777778e-02
, -2.20472368e-02, -1.74989035e-02, -1.38888889e-02, -1.10236184e-02
, -8.74945174e-03, -6.94444444e-03, -5.51180921e-03, -4.37472587e-03
, -3.47222222e-03, -2.75590460e-03, -2.18736293e-03, -1.73611111e-03
, -1.37795230e-03, -1.09368147e-03, -8.68055556e-04, -6.88976151e-04
, -5.46840733e-04, -4.34027778e-04, -3.44488076e-04, -2.73420367e-04
, -2.17013889e-04, -1.72244038e-04, -1.36710183e-04, -1.08506944e-04
, -8.61220189e-05, -6.83550917e-05, -5.42534722e-05, -4.30610094e-05
, -3.41775458e-05, -2.71267361e-05, -2.15305047e-05, -1.70887729e-05
, -1.35633681e-05, -1.07652524e-05, -8.54438646e-06, -6.78168403e-06
, -5.38262618e-06, -4.27219323e-06, -3.39084201e-06, -2.69131309e-06
, -2.13609662e-06, -1.69542101e-06, -1.34565654e-06, -1.06804831e-06
, -8.47710503e-07, -6.72828272e-07, -5.34024154e-07, 0.00000000e+00
-8.88888889e-01f, -7.05511579e-01f, -5.59964911e-01f, -4.44444444e-01f
, -3.52755789e-01f, -2.79982456e-01f, -2.22222222e-01f, -1.76377895e-01f
, -1.39991228e-01f, -1.11111111e-01f, -8.81889473e-02f, -6.99956139e-02f
, -5.55555556e-02f, -4.40944737e-02f, -3.49978069e-02f, -2.77777778e-02f
, -2.20472368e-02f, -1.74989035e-02f, -1.38888889e-02f, -1.10236184e-02f
, -8.74945174e-03f, -6.94444444e-03f, -5.51180921e-03f, -4.37472587e-03f
, -3.47222222e-03f, -2.75590460e-03f, -2.18736293e-03f, -1.73611111e-03f
, -1.37795230e-03f, -1.09368147e-03f, -8.68055556e-04f, -6.88976151e-04f
, -5.46840733e-04f, -4.34027778e-04f, -3.44488076e-04f, -2.73420367e-04f
, -2.17013889e-04f, -1.72244038e-04f, -1.36710183e-04f, -1.08506944e-04f
, -8.61220189e-05f, -6.83550917e-05f, -5.42534722e-05f, -4.30610094e-05f
, -3.41775458e-05f, -2.71267361e-05f, -2.15305047e-05f, -1.70887729e-05f
, -1.35633681e-05f, -1.07652524e-05f, -8.54438646e-06f, -6.78168403e-06f
, -5.38262618e-06f, -4.27219323e-06f, -3.39084201e-06f, -2.69131309e-06f
, -2.13609662e-06f, -1.69542101e-06f, -1.34565654e-06f, -1.06804831e-06f
, -8.47710503e-07f, -6.72828272e-07f, -5.34024154e-07f, 0.00000000e+00f
}
, {
-4.44444444e-01, -3.52755789e-01, -2.79982456e-01, -2.22222222e-01
, -1.76377895e-01, -1.39991228e-01, -1.11111111e-01, -8.81889473e-02
, -6.99956139e-02, -5.55555556e-02, -4.40944737e-02, -3.49978069e-02
, -2.77777778e-02, -2.20472368e-02, -1.74989035e-02, -1.38888889e-02
, -1.10236184e-02, -8.74945174e-03, -6.94444444e-03, -5.51180921e-03
, -4.37472587e-03, -3.47222222e-03, -2.75590460e-03, -2.18736293e-03
, -1.73611111e-03, -1.37795230e-03, -1.09368147e-03, -8.68055556e-04
, -6.88976151e-04, -5.46840733e-04, -4.34027778e-04, -3.44488076e-04
, -2.73420367e-04, -2.17013889e-04, -1.72244038e-04, -1.36710183e-04
, -1.08506944e-04, -8.61220189e-05, -6.83550917e-05, -5.42534722e-05
, -4.30610094e-05, -3.41775458e-05, -2.71267361e-05, -2.15305047e-05
, -1.70887729e-05, -1.35633681e-05, -1.07652524e-05, -8.54438646e-06
, -6.78168403e-06, -5.38262618e-06, -4.27219323e-06, -3.39084201e-06
, -2.69131309e-06, -2.13609662e-06, -1.69542101e-06, -1.34565654e-06
, -1.06804831e-06, -8.47710503e-07, -6.72828272e-07, -5.34024154e-07
, -4.23855252e-07, -3.36414136e-07, -2.67012077e-07, 0.00000000e+00
-4.44444444e-01f, -3.52755789e-01f, -2.79982456e-01f, -2.22222222e-01f
, -1.76377895e-01f, -1.39991228e-01f, -1.11111111e-01f, -8.81889473e-02f
, -6.99956139e-02f, -5.55555556e-02f, -4.40944737e-02f, -3.49978069e-02f
, -2.77777778e-02f, -2.20472368e-02f, -1.74989035e-02f, -1.38888889e-02f
, -1.10236184e-02f, -8.74945174e-03f, -6.94444444e-03f, -5.51180921e-03f
, -4.37472587e-03f, -3.47222222e-03f, -2.75590460e-03f, -2.18736293e-03f
, -1.73611111e-03f, -1.37795230e-03f, -1.09368147e-03f, -8.68055556e-04f
, -6.88976151e-04f, -5.46840733e-04f, -4.34027778e-04f, -3.44488076e-04f
, -2.73420367e-04f, -2.17013889e-04f, -1.72244038e-04f, -1.36710183e-04f
, -1.08506944e-04f, -8.61220189e-05f, -6.83550917e-05f, -5.42534722e-05f
, -4.30610094e-05f, -3.41775458e-05f, -2.71267361e-05f, -2.15305047e-05f
, -1.70887729e-05f, -1.35633681e-05f, -1.07652524e-05f, -8.54438646e-06f
, -6.78168403e-06f, -5.38262618e-06f, -4.27219323e-06f, -3.39084201e-06f
, -2.69131309e-06f, -2.13609662e-06f, -1.69542101e-06f, -1.34565654e-06f
, -1.06804831e-06f, -8.47710503e-07f, -6.72828272e-07f, -5.34024154e-07f
, -4.23855252e-07f, -3.36414136e-07f, -2.67012077e-07f, 0.00000000e+00f
}
, {
4.44444444e-01, 3.52755789e-01, 2.79982456e-01, 2.22222222e-01
, 1.76377895e-01, 1.39991228e-01, 1.11111111e-01, 8.81889473e-02
, 6.99956139e-02, 5.55555556e-02, 4.40944737e-02, 3.49978069e-02
, 2.77777778e-02, 2.20472368e-02, 1.74989035e-02, 1.38888889e-02
, 1.10236184e-02, 8.74945174e-03, 6.94444444e-03, 5.51180921e-03
, 4.37472587e-03, 3.47222222e-03, 2.75590460e-03, 2.18736293e-03
, 1.73611111e-03, 1.37795230e-03, 1.09368147e-03, 8.68055556e-04
, 6.88976151e-04, 5.46840733e-04, 4.34027778e-04, 3.44488076e-04
, 2.73420367e-04, 2.17013889e-04, 1.72244038e-04, 1.36710183e-04
, 1.08506944e-04, 8.61220189e-05, 6.83550917e-05, 5.42534722e-05
, 4.30610094e-05, 3.41775458e-05, 2.71267361e-05, 2.15305047e-05
, 1.70887729e-05, 1.35633681e-05, 1.07652524e-05, 8.54438646e-06
, 6.78168403e-06, 5.38262618e-06, 4.27219323e-06, 3.39084201e-06
, 2.69131309e-06, 2.13609662e-06, 1.69542101e-06, 1.34565654e-06
, 1.06804831e-06, 8.47710503e-07, 6.72828272e-07, 5.34024154e-07
, 4.23855252e-07, 3.36414136e-07, 2.67012077e-07, 0.00000000e+00
4.44444444e-01f, 3.52755789e-01f, 2.79982456e-01f, 2.22222222e-01f
, 1.76377895e-01f, 1.39991228e-01f, 1.11111111e-01f, 8.81889473e-02f
, 6.99956139e-02f, 5.55555556e-02f, 4.40944737e-02f, 3.49978069e-02f
, 2.77777778e-02f, 2.20472368e-02f, 1.74989035e-02f, 1.38888889e-02f
, 1.10236184e-02f, 8.74945174e-03f, 6.94444444e-03f, 5.51180921e-03f
, 4.37472587e-03f, 3.47222222e-03f, 2.75590460e-03f, 2.18736293e-03f
, 1.73611111e-03f, 1.37795230e-03f, 1.09368147e-03f, 8.68055556e-04f
, 6.88976151e-04f, 5.46840733e-04f, 4.34027778e-04f, 3.44488076e-04f
, 2.73420367e-04f, 2.17013889e-04f, 1.72244038e-04f, 1.36710183e-04f
, 1.08506944e-04f, 8.61220189e-05f, 6.83550917e-05f, 5.42534722e-05f
, 4.30610094e-05f, 3.41775458e-05f, 2.71267361e-05f, 2.15305047e-05f
, 1.70887729e-05f, 1.35633681e-05f, 1.07652524e-05f, 8.54438646e-06f
, 6.78168403e-06f, 5.38262618e-06f, 4.27219323e-06f, 3.39084201e-06f
, 2.69131309e-06f, 2.13609662e-06f, 1.69542101e-06f, 1.34565654e-06f
, 1.06804831e-06f, 8.47710503e-07f, 6.72828272e-07f, 5.34024154e-07f
, 4.23855252e-07f, 3.36414136e-07f, 2.67012077e-07f, 0.00000000e+00f
}
, {
8.88888889e-01, 7.05511579e-01, 5.59964911e-01, 4.44444444e-01
, 3.52755789e-01, 2.79982456e-01, 2.22222222e-01, 1.76377895e-01
, 1.39991228e-01, 1.11111111e-01, 8.81889473e-02, 6.99956139e-02
, 5.55555556e-02, 4.40944737e-02, 3.49978069e-02, 2.77777778e-02
, 2.20472368e-02, 1.74989035e-02, 1.38888889e-02, 1.10236184e-02
, 8.74945174e-03, 6.94444444e-03, 5.51180921e-03, 4.37472587e-03
, 3.47222222e-03, 2.75590460e-03, 2.18736293e-03, 1.73611111e-03
, 1.37795230e-03, 1.09368147e-03, 8.68055556e-04, 6.88976151e-04
, 5.46840733e-04, 4.34027778e-04, 3.44488076e-04, 2.73420367e-04
, 2.17013889e-04, 1.72244038e-04, 1.36710183e-04, 1.08506944e-04
, 8.61220189e-05, 6.83550917e-05, 5.42534722e-05, 4.30610094e-05
, 3.41775458e-05, 2.71267361e-05, 2.15305047e-05, 1.70887729e-05
, 1.35633681e-05, 1.07652524e-05, 8.54438646e-06, 6.78168403e-06
, 5.38262618e-06, 4.27219323e-06, 3.39084201e-06, 2.69131309e-06
, 2.13609662e-06, 1.69542101e-06, 1.34565654e-06, 1.06804831e-06
, 8.47710503e-07, 6.72828272e-07, 5.34024154e-07, 0.00000000e+00
8.88888889e-01f, 7.05511579e-01f, 5.59964911e-01f, 4.44444444e-01f
, 3.52755789e-01f, 2.79982456e-01f, 2.22222222e-01f, 1.76377895e-01f
, 1.39991228e-01f, 1.11111111e-01f, 8.81889473e-02f, 6.99956139e-02f
, 5.55555556e-02f, 4.40944737e-02f, 3.49978069e-02f, 2.77777778e-02f
, 2.20472368e-02f, 1.74989035e-02f, 1.38888889e-02f, 1.10236184e-02f
, 8.74945174e-03f, 6.94444444e-03f, 5.51180921e-03f, 4.37472587e-03f
, 3.47222222e-03f, 2.75590460e-03f, 2.18736293e-03f, 1.73611111e-03f
, 1.37795230e-03f, 1.09368147e-03f, 8.68055556e-04f, 6.88976151e-04f
, 5.46840733e-04f, 4.34027778e-04f, 3.44488076e-04f, 2.73420367e-04f
, 2.17013889e-04f, 1.72244038e-04f, 1.36710183e-04f, 1.08506944e-04f
, 8.61220189e-05f, 6.83550917e-05f, 5.42534722e-05f, 4.30610094e-05f
, 3.41775458e-05f, 2.71267361e-05f, 2.15305047e-05f, 1.70887729e-05f
, 1.35633681e-05f, 1.07652524e-05f, 8.54438646e-06f, 6.78168403e-06f
, 5.38262618e-06f, 4.27219323e-06f, 3.39084201e-06f, 2.69131309e-06f
, 2.13609662e-06f, 1.69542101e-06f, 1.34565654e-06f, 1.06804831e-06f
, 8.47710503e-07f, 6.72828272e-07f, 5.34024154e-07f, 0.00000000e+00f
}
, {
1.77777778e+00, 1.41102316e+00, 1.11992982e+00, 8.88888889e-01
, 7.05511579e-01, 5.59964911e-01, 4.44444444e-01, 3.52755789e-01
, 2.79982456e-01, 2.22222222e-01, 1.76377895e-01, 1.39991228e-01
, 1.11111111e-01, 8.81889473e-02, 6.99956139e-02, 5.55555556e-02
, 4.40944737e-02, 3.49978069e-02, 2.77777778e-02, 2.20472368e-02
, 1.74989035e-02, 1.38888889e-02, 1.10236184e-02, 8.74945174e-03
, 6.94444444e-03, 5.51180921e-03, 4.37472587e-03, 3.47222222e-03
, 2.75590460e-03, 2.18736293e-03, 1.73611111e-03, 1.37795230e-03
, 1.09368147e-03, 8.68055556e-04, 6.88976151e-04, 5.46840733e-04
, 4.34027778e-04, 3.44488076e-04, 2.73420367e-04, 2.17013889e-04
, 1.72244038e-04, 1.36710183e-04, 1.08506944e-04, 8.61220189e-05
, 6.83550917e-05, 5.42534722e-05, 4.30610094e-05, 3.41775458e-05
, 2.71267361e-05, 2.15305047e-05, 1.70887729e-05, 1.35633681e-05
, 1.07652524e-05, 8.54438646e-06, 6.78168403e-06, 5.38262618e-06
, 4.27219323e-06, 3.39084201e-06, 2.69131309e-06, 2.13609662e-06
, 1.69542101e-06, 1.34565654e-06, 1.06804831e-06, 0.00000000e+00
1.77777778e+00f, 1.41102316e+00f, 1.11992982e+00f, 8.88888889e-01f
, 7.05511579e-01f, 5.59964911e-01f, 4.44444444e-01f, 3.52755789e-01f
, 2.79982456e-01f, 2.22222222e-01f, 1.76377895e-01f, 1.39991228e-01f
, 1.11111111e-01f, 8.81889473e-02f, 6.99956139e-02f, 5.55555556e-02f
, 4.40944737e-02f, 3.49978069e-02f, 2.77777778e-02f, 2.20472368e-02f
, 1.74989035e-02f, 1.38888889e-02f, 1.10236184e-02f, 8.74945174e-03f
, 6.94444444e-03f, 5.51180921e-03f, 4.37472587e-03f, 3.47222222e-03f
, 2.75590460e-03f, 2.18736293e-03f, 1.73611111e-03f, 1.37795230e-03f
, 1.09368147e-03f, 8.68055556e-04f, 6.88976151e-04f, 5.46840733e-04f
, 4.34027778e-04f, 3.44488076e-04f, 2.73420367e-04f, 2.17013889e-04f
, 1.72244038e-04f, 1.36710183e-04f, 1.08506944e-04f, 8.61220189e-05f
, 6.83550917e-05f, 5.42534722e-05f, 4.30610094e-05f, 3.41775458e-05f
, 2.71267361e-05f, 2.15305047e-05f, 1.70887729e-05f, 1.35633681e-05f
, 1.07652524e-05f, 8.54438646e-06f, 6.78168403e-06f, 5.38262618e-06f
, 4.27219323e-06f, 3.39084201e-06f, 2.69131309e-06f, 2.13609662e-06f
, 1.69542101e-06f, 1.34565654e-06f, 1.06804831e-06f, 0.00000000e+00f
}
};
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -208,7 +208,7 @@ static int I_step_two(real fraction[2][SBLIMIT],unsigned int balloc[2*SBLIMIT],
return 0;
}
int do_layer1(mpg123_handle *fr)
int INT123_do_layer1(mpg123_handle *fr)
{
int clip=0;
int i,stereo = fr->stereo;
......@@ -246,5 +246,3 @@ int do_layer1(mpg123_handle *fr)
return clip;
}
......@@ -29,7 +29,7 @@
// The layer12_table is already in real format (fixed or float), just needs
// a little scaling in the MMX/SSE case.
void init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr, real *table, int m))
void INT123_init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr, real *table, int m))
{
int k;
real *table;
......@@ -40,7 +40,7 @@ void init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr
}
}
real* init_layer12_table(mpg123_handle *fr, real *table, int m)
real* INT123_init_layer12_table(mpg123_handle *fr, real *table, int m)
{
int i;
for(i=0;i<63;i++)
......@@ -49,7 +49,7 @@ real* init_layer12_table(mpg123_handle *fr, real *table, int m)
}
#ifdef OPT_MMXORSSE
real* init_layer12_table_mmx(mpg123_handle *fr, real *table, int m)
real* INT123_init_layer12_table_mmx(mpg123_handle *fr, real *table, int m)
{
int i,j;
if(!fr->p.down_sample)
......@@ -324,7 +324,7 @@ static void II_select_table(mpg123_handle *fr)
}
int do_layer2(mpg123_handle *fr)
int INT123_do_layer2(mpg123_handle *fr)
{
int clip=0;
int i,j;
......
......@@ -37,7 +37,7 @@
#include "init_layer3.h"
#endif
/* Decoder state data, living on the stack of do_layer3. */
/* Decoder state data, living on the stack of INT123_do_layer3. */
struct gr_info_s
{
......@@ -75,19 +75,19 @@ struct III_sideinfo
};
#ifdef OPT_MMXORSSE
real init_layer3_gainpow2_mmx(mpg123_handle *fr, int i)
real INT123_init_layer3_gainpow2_mmx(mpg123_handle *fr, int i)
{
if(!fr->p.down_sample) return DOUBLE_TO_REAL(16384.0 * pow((double)2.0,-0.25 * (double) (i+210) ));
else return DOUBLE_TO_REAL(pow((double)2.0,-0.25 * (double) (i+210)));
}
#endif
real init_layer3_gainpow2(mpg123_handle *fr, int i)
real INT123_init_layer3_gainpow2(mpg123_handle *fr, int i)
{
return DOUBLE_TO_REAL_SCALE_LAYER3(pow((double)2.0,-0.25 * (double) (i+210)),i+256);
}
void init_layer3_stuff(mpg123_handle *fr, real (*gainpow2_func)(mpg123_handle *fr, int i))
void INT123_init_layer3_stuff(mpg123_handle *fr, real (*gainpow2_func)(mpg123_handle *fr, int i))
{
int i,j;
......@@ -414,7 +414,7 @@ static int III_get_scale_factors_2(mpg123_handle *fr, int *scf,struct gr_info_s
}
};
if(i_stereo) /* i_stereo AND second channel -> do_layer3() checks this */
if(i_stereo) /* i_stereo AND second channel -> INT123_do_layer3() checks this */
slen = i_slen2[gr_info->scalefac_compress>>1];
else
slen = n_slen2[gr_info->scalefac_compress];
......@@ -499,7 +499,10 @@ static unsigned char pretab_choice[2][22] =
static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],int *scf, struct gr_info_s *gr_info,int sfreq,int part2bits)
{
int shift = 1 + gr_info->scalefac_scale;
real *xrpnt = (real *) xr;
// Pointer cast to make pedantic compilers happy.
real *xrpnt = (real*)xr;
// Some compiler freaks out over &xr[SBLIMIT][0], which is the same.
real *xrpntlimit = (real*)xr+SBLIMIT*SSLIMIT;
int l[3],l3;
int part2remain = gr_info->part2_3_length - part2bits;
const short *me;
......@@ -552,10 +555,10 @@ static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],in
}
}
#define CHECK_XRPNT if(xrpnt >= &xr[SBLIMIT][0]) \
#define CHECK_XRPNT if(xrpnt >= xrpntlimit) \
{ \
if(NOQUIET) \
error2("attempted xrpnt overflow (%p !< %p)", (void*) xrpnt, (void*) &xr[SBLIMIT][0]); \
error2("attempted xrpnt overflow (%p !< %p)", (void*) xrpnt, (void*) xrpntlimit); \
return 1; \
}
......@@ -992,7 +995,7 @@ static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],in
gr_info->maxb = 1;
}
while(xrpnt < &xr[SBLIMIT][0])
while(xrpnt < xrpntlimit)
*xrpnt++ = DOUBLE_TO_REAL(0.0);
while( part2remain > 16 )
......@@ -1256,7 +1259,7 @@ static void III_antialias(real xr[SBLIMIT][SSLIMIT],struct gr_info_s *gr_info)
/* Calculation of the inverse MDCT
used to be static without 3dnow - does that really matter? */
void dct36(real *inbuf,real *o1,real *o2,const real *wintab,real *tsbuf)
void INT123_dct36(real *inbuf,real *o1,real *o2,const real *wintab,real *tsbuf)
{
real tmp[18];
......@@ -1388,7 +1391,7 @@ void dct36(real *inbuf,real *o1,real *o2,const real *wintab,real *tsbuf)
t0 = REAL_MUL(cos9[0], (in[5] + in[9]));
t1 = REAL_MUL(cos9[1], (in[9] - in[17]));
tmp[13] = REAL_MUL((t4 + t2 + t2), tfcos36[17-13]);
tmp[13] = REAL_MUL((t4 + t2 + t2), INT123_tfcos36[17-13]);
t2 = REAL_MUL(cos9[2], (in[5] + in[17]));
t6 = t3 - t0 - t2;
......@@ -1400,21 +1403,21 @@ void dct36(real *inbuf,real *o1,real *o2,const real *wintab,real *tsbuf)
t7 = REAL_MUL(COS6_1, in[7]);
t1 = t2 + t4 + t7;
tmp[17] = REAL_MUL((t0 + t1), tfcos36[17-17]);
tmp[9] = REAL_MUL((t0 - t1), tfcos36[17-9]);
tmp[17] = REAL_MUL((t0 + t1), INT123_tfcos36[17-17]);
tmp[9] = REAL_MUL((t0 - t1), INT123_tfcos36[17-9]);
t1 = REAL_MUL(cos18[2], (in[3] + in[15]));
t2 += t1 - t7;
tmp[14] = REAL_MUL((t3 + t2), tfcos36[17-14]);
tmp[14] = REAL_MUL((t3 + t2), INT123_tfcos36[17-14]);
t0 = REAL_MUL(COS6_1, (in[11] + in[15] - in[3]));
tmp[12] = REAL_MUL((t3 - t2), tfcos36[17-12]);
tmp[12] = REAL_MUL((t3 - t2), INT123_tfcos36[17-12]);
t4 -= t1 + t7;
tmp[16] = REAL_MUL((t5 - t0), tfcos36[17-16]);
tmp[10] = REAL_MUL((t5 + t0), tfcos36[17-10]);
tmp[15] = REAL_MUL((t6 + t4), tfcos36[17-15]);
tmp[11] = REAL_MUL((t6 - t4), tfcos36[17-11]);
tmp[16] = REAL_MUL((t5 - t0), INT123_tfcos36[17-16]);
tmp[10] = REAL_MUL((t5 + t0), INT123_tfcos36[17-10]);
tmp[15] = REAL_MUL((t6 + t4), INT123_tfcos36[17-15]);
tmp[11] = REAL_MUL((t6 - t4), INT123_tfcos36[17-11]);
}
#define MACRO(v) { \
......@@ -1645,7 +1648,7 @@ static void fill_pinfo_side(mpg123_handle *fr, struct III_sideinfo *si, int gr,
{
int i, sb;
float ifqstep; /* Why not double? */
int ch, ss;;
int ch, ss;
for(ch = 0; ch < stereo1; ++ch)
{
......@@ -1709,7 +1712,7 @@ static void fill_pinfo_side(mpg123_handle *fr, struct III_sideinfo *si, int gr,
#endif
/* And at the end... the main layer3 handler */
int do_layer3(mpg123_handle *fr)
int INT123_do_layer3(mpg123_handle *fr)
{
int gr, ch, ss,clip=0;
int scalefacs[2][39]; /* max 39 for short[13][3] mode, mixed: 38, long: 22 */
......@@ -1747,7 +1750,7 @@ int do_layer3(mpg123_handle *fr)
return clip;
}
set_pointer(fr, 1, sideinfo.main_data_begin);
INT123_set_pointer(fr, 1, sideinfo.main_data_begin);
#ifndef NO_MOREINFO
if(fr->pinfo)
{
......@@ -1930,8 +1933,8 @@ int do_layer3(mpg123_handle *fr)
if(n > (SSLIMIT-ss)) n=SSLIMIT-ss;
/* Clip counting makes no sense with this function. */
absynth_1to1_i486(hybridOut[0][ss], 0, fr, n);
absynth_1to1_i486(hybridOut[1][ss], 1, fr, n);
INT123_absynth_1to1_i486(hybridOut[0][ss], 0, fr, n);
INT123_absynth_1to1_i486(hybridOut[1][ss], 1, fr, n);
ss+=n;
fr->buffer.fill+=(2*2*32)*n;
}
......
/*
lfs_wrap: Wrapper code for reader functions, both internal and external.
copyright 2010-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, thanks to Guido Draheim for consulting
and later manx for stirring it all up again
This file used to wrap 32 bit off_t client API to 64 bit off_t API. Now it is
mapping any user API with either off_t to portable int64_t API, while also
providing the guts of that also via a wrapper handle. This keeps the actual
read and seek implementation out of readers.c.
See doc/LARGEFILE for the big picture.
Note about file descriptors: We just assume that they are generally
interchangeable between large and small file code... and that a large file
descriptor will trigger errors when accessed with small file code where it
may cause trouble (a really large file).
*/
#include "config.h"
// Only activate the explicit largefile stuff here. The rest of the code shall
// work with abstract 64 bit offsets, or just plain default off_t (possibly
// using _FILE_OFFSET_BYTES magic).
// Note that this macro does not influence normal off_t-using code.
#ifdef LFS_LARGEFILE_64
#define _LARGEFILE64_SOURCE
#endif
// For correct MPG123_EXPORT.
#include "abi_align.h"
// Need the full header with non-portable API, for the bare mpg123_open*()
// declarations. But no renaming shenanigans.
#include "mpg123.h"
#include "lfs_wrap.h"
#include "abi_align.h"
#include "compat.h"
#include <sys/stat.h>
#include <fcntl.h>
#include "debug.h"
// We do not want to expose this publicly, but it is cleaner to have it also defined
// as portable API to offer the legacy function wrapper over. It's an undocumented
// function for int64_t arguments.
int attribute_align_arg mpg123_position64( mpg123_handle *fr, int64_t no, int64_t buffsize
, int64_t *current_frame, int64_t *frames_left
, double *current_seconds, double *seconds_left );
/* I see that I will need custom data storage. Main use is for the replaced I/O later, but the seek table for small file offsets needs extra storage, too. */
// The wrapper handle for descriptor and handle I/O.
// It is also used for storing a converted frame index.
// Plain portable API I/O should not need it at all.
#define IO_HANDLE64 0 /* no wrapping at all: client-provided callbacks */
#define IO_FD 1 /* default off_t callbacks */
#define IO_HANDLE 2 /* Wrapping over custom handle callbacks with off_t. */
#ifdef LFS_LARGEFILE_64
#define IO_FD_64 3 /* off64_t callbacks */
#define IO_HANDLE_64 4 /* ... with off64_t. */
#endif
#define IO_INT_FD 5 /* Internal I/O using a file descriptor and wrappers defined here. */
struct wrap_data
{
/* Storage for small offset index table. */
#if SIZEOF_OFF_T == 4
off_t *indextable;
// And ironically, another big offset table for mpg123_set_index_32.
// I wand to avoid having to change a line of code in the internals.
int64_t *set_indextable;
#endif
/* I/O handle stuff */
int iotype; // one of the above numbers
/* Data for IO_FD variants. */
int fd;
int my_fd; /* A descriptor that the wrapper code opened itself. */
#ifdef TIMEOUT_READ
time_t timeout_sec;
#endif
void* handle; // for IO_HANDLE variants
/* The actual callbacks from the outside. */
mpg123_ssize_t (*r_read) (int, void *, size_t);
off_t (*r_lseek)(int, off_t, int);
mpg123_ssize_t (*r_h_read)(void *, void *, size_t);
off_t (*r_h_lseek)(void*, off_t, int);
#if LFS_LARGEFILE_64
mpg123_ssize_t (*r_read_64) (int, void *, size_t);
off64_t (*r_lseek_64)(int, off64_t, int);
mpg123_ssize_t (*r_h_read_64)(void *, void *, size_t);
off64_t (*r_h_lseek_64)(void*, off64_t, int);
#endif
void (*h_cleanup)(void*);
};
/* Cleanup I/O part of the handle handle... but not deleting the wrapper handle itself.
That is stored in the frame and only deleted on mpg123_delete(). */
static void wrap_io_cleanup(void *handle)
{
struct wrap_data *ioh = handle;
debug("wrapper I/O cleanup");
if(ioh->iotype == IO_HANDLE
#ifdef LFS_LARGEFILE_64
|| ioh->iotype == IO_HANDLE_64
#endif
){
if(ioh->h_cleanup != NULL && ioh->handle != NULL)
{
mdebug("calling client handle cleanup %p", ioh->handle);
ioh->h_cleanup(ioh->handle);
}
ioh->handle = NULL;
}
if(ioh->my_fd >= 0)
{
mdebug("closing my fd %d", ioh->my_fd);
close(ioh->my_fd);
ioh->my_fd = -1;
}
}
/* Really finish off the handle... freeing all memory. */
void INT123_wrap_destroy(void *handle)
{
struct wrap_data *wh = handle;
if(!wh)
return;
wrap_io_cleanup(handle);
#if SIZEOF_OFF_T == 4
if(wh->indextable != NULL)
free(wh->indextable);
if(wh->set_indextable != NULL)
free(wh->set_indextable);
#endif
free(wh);
}
/* More helper code... extract the special wrapper handle, possible allocate and initialize it. */
static struct wrap_data* wrap_get(mpg123_handle *mh, int force_alloc)
{
struct wrap_data* whd;
void ** whd_ = INT123_wrap_handle(mh);
if(whd_ == NULL)
return NULL;
/* Access the private storage inside the mpg123 handle.
The real callback functions and handles are stored there. */
if(*whd_ == NULL && force_alloc)
{
/* Create a new one. */
*whd_ = malloc(sizeof(struct wrap_data));
if(*whd_ == NULL)
{
INT123_set_err(mh, MPG123_OUT_OF_MEM);
return NULL;
}
whd = *whd_;
#if SIZEOF_OFF_T == 4
whd->indextable = NULL;
whd->set_indextable = NULL;
#endif
whd->iotype = IO_HANDLE64; // By default, the I/O path is not affected.
whd->fd = -1;
whd->my_fd = -1;
whd->handle = NULL;
whd->r_read = NULL;
whd->r_lseek = NULL;
whd->r_h_read = NULL;
whd->r_h_lseek = NULL;
#if LFS_LARGEFILE_64
whd->r_read_64 = NULL;
whd->r_lseek_64 = NULL;
whd->r_h_read_64 = NULL;
whd->r_h_lseek_64 = NULL;
#endif
whd->h_cleanup = NULL;
}
else whd = *whd_;
return whd;
}
/* After settling the data... start with some simple wrappers. */
// The fist block of wrappers is always present, using the native off_t width.
// A second block mirrors that in case of sizeof(off_t)==4 with _32 suffix.
// A third block follows if 64 bit off_t is available with _64 suffix, just aliasing
// the int64_t functions.
#define OFF_CONV(value, variable, handle) \
if((value) >= OFF_MIN && (value) <= OFF_MAX) \
variable = (off_t)(value); \
else return INT123_set_err(handle, MPG123_LFS_OVERFLOW);
#define OFF_CONVP(value, varpointer, handle) \
if(varpointer){ OFF_CONV(value, *(varpointer), handle) }
#define OFF_RETURN(value, handle) \
return ((value) >= OFF_MIN && (value) <= OFF_MAX) \
? (off_t)(value) \
: INT123_set_err(handle, MPG123_LFS_OVERFLOW);
int attribute_align_arg mpg123_framebyframe_decode(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
{
int64_t fnum = 0;
int ret = mpg123_framebyframe_decode64(mh, &fnum, audio, bytes);
OFF_CONVP(fnum, num, mh)
return ret;
}
int attribute_align_arg mpg123_decode_frame(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
{
int64_t fnum = 0;
int ret = mpg123_decode_frame64(mh, &fnum, audio, bytes);
OFF_CONVP(fnum, num, mh)
return ret;
}
off_t attribute_align_arg mpg123_timeframe(mpg123_handle *mh, double seconds)
{
int64_t b = mpg123_timeframe64(mh, seconds);
OFF_RETURN(b, mh)
}
off_t attribute_align_arg mpg123_tell(mpg123_handle *mh)
{
int64_t pos = mpg123_tell64(mh);
OFF_RETURN(pos, mh)
}
off_t attribute_align_arg mpg123_tellframe(mpg123_handle *mh)
{
int64_t frame = mpg123_tellframe64(mh);
OFF_RETURN(frame, mh)
}
off_t attribute_align_arg mpg123_tell_stream(mpg123_handle *mh)
{
int64_t off = mpg123_tell_stream64(mh);
OFF_RETURN(off, mh)
}
off_t attribute_align_arg mpg123_seek(mpg123_handle *mh, off_t sampleoff, int whence)
{
int64_t ret = mpg123_seek64(mh, (int64_t)sampleoff, whence);
OFF_RETURN(ret, mh)
}
off_t attribute_align_arg mpg123_feedseek(mpg123_handle *mh, off_t sampleoff, int whence, off_t *input_offset)
{
int64_t inoff = 0;
int64_t ret = mpg123_feedseek64(mh, (int64_t)sampleoff, whence, &inoff);
OFF_CONVP(inoff, input_offset, mh)
OFF_RETURN(ret, mh)
}
off_t attribute_align_arg mpg123_seek_frame(mpg123_handle *mh, off_t offset, int whence)
{
int64_t ret = mpg123_seek_frame64(mh, (int64_t)offset, whence);
OFF_RETURN(ret, mh)
}
int attribute_align_arg mpg123_set_filesize(mpg123_handle *mh, off_t size)
{
return mpg123_set_filesize64(mh, (int64_t)size);
}
off_t attribute_align_arg mpg123_framelength(mpg123_handle *mh)
{
int64_t ret = mpg123_framelength64(mh);
OFF_RETURN(ret, mh)
}
off_t attribute_align_arg mpg123_length(mpg123_handle *mh)
{
int64_t ret = mpg123_length64(mh);
OFF_RETURN(ret, mh)
}
// Native off_t is either identical to int32_t or int64_t.
// If the former, we create a copy of the index table.
int attribute_align_arg mpg123_index(mpg123_handle *mh, off_t **offsets, off_t *step, size_t *fill)
{
#if SIZEOF_OFF_T == 8
return mpg123_index64(mh, (int64_t**)offsets, (int64_t*)step, fill);
#else
int err;
int64_t largestep;
int64_t *largeoffsets;
struct wrap_data *whd;
if(mh == NULL)
return MPG123_BAD_HANDLE;
if(offsets == NULL || step == NULL || fill == NULL)
return INT123_set_err(mh, MPG123_BAD_INDEX_PAR);
*fill = 0; // better safe than sorry
whd = wrap_get(mh, 1);
if(whd == NULL) return MPG123_ERR;
err = mpg123_index64(mh, &largeoffsets, &largestep, fill);
if(err != MPG123_OK) return err;
/* For a _very_ large file, even the step could overflow. */
OFF_CONV(largestep, *step, mh);
/* When there are no values stored, there is no table content to take care of.
Table pointer does not matter. Mission completed. */
if(*fill == 0) return MPG123_OK;
/* Construct a copy of the index to hand over to the small-minded client. */
*offsets = INT123_safe_realloc(whd->indextable, (*fill)*sizeof(int32_t));
if(*offsets == NULL)
return INT123_set_err(mh, MPG123_OUT_OF_MEM);
whd->indextable = *offsets;
/* Elaborate conversion of each index value, with overflow check. */
for(size_t i=0; i<*fill; ++i)
OFF_CONV(largeoffsets[i], whd->indextable[i], mh);
/* If we came that far... there should be a valid copy of the table now. */
return MPG123_OK;
#endif
}
int attribute_align_arg mpg123_set_index(mpg123_handle *mh, off_t *offsets, off_t step, size_t fill)
{
#if SIZEOF_OFF_T == 8
return mpg123_set_index64(mh, (int64_t*)offsets, (int64_t)step, fill);
#else
int err;
struct wrap_data *whd;
int64_t *indextmp;
if(mh == NULL) return MPG123_BAD_HANDLE;
whd = wrap_get(mh, 1);
if(whd == NULL) return MPG123_ERR;
if(fill > 0 && offsets == NULL)
return INT123_set_err(mh, MPG123_BAD_INDEX_PAR);
else
{
/* Expensive temporary storage... for staying outside at the API layer. */
indextmp = INT123_safe_realloc(whd->set_indextable, fill*sizeof(int64_t));
if(indextmp == NULL)
return INT123_set_err(mh, MPG123_OUT_OF_MEM);
whd->set_indextable = indextmp;
/* Fill the large-file copy of the provided index, then feed it to mpg123. */
for(size_t i=0; i<fill; ++i)
indextmp[i] = offsets[i];
err = mpg123_set_index64(mh, indextmp, (int64_t)step, fill);
}
return err;
#endif
}
off_t attribute_align_arg mpg123_framepos(mpg123_handle *mh)
{
int64_t pos = mpg123_framepos64(mh);
OFF_RETURN(pos, mh)
}
int attribute_align_arg mpg123_position( mpg123_handle *mh, off_t INT123_frame_offset
, off_t buffered_bytes, off_t *current_frame, off_t *frames_left
, double *current_seconds, double *seconds_left )
{
int64_t curframe, frameleft;
int err;
err = mpg123_position64( mh, (int64_t)INT123_frame_offset, (int64_t)buffered_bytes
, &curframe, &frameleft, current_seconds, seconds_left );
if(err != MPG123_OK) return err;
OFF_CONVP(curframe, current_frame, mh)
OFF_CONVP(frameleft, frames_left, mh);
return MPG123_OK;
}
// _32 aliases only for native 32 bit off_t
// Will compilers be smart enough to optimize away the extra function call?
#if SIZEOF_OFF_T == 4
// The open routines are trivial now. I only have differeing symbols suffixes
// to keep legacy ABI.
int attribute_align_arg mpg123_open_32(mpg123_handle *mh, const char *path)
{
return mpg123_open(mh, path);
}
int attribute_align_arg mpg123_open_fixed_32( mpg123_handle *mh, const char *path
, int channels, int encoding )
{
return mpg123_open_fixed(mh, path, channels, encoding);
}
int attribute_align_arg mpg123_open_fd_32(mpg123_handle *mh, int fd)
{
return mpg123_open_fd(mh, fd);
}
int attribute_align_arg mpg123_open_handle_32(mpg123_handle *mh, void *iohandle)
{
return mpg123_open_handle(mh, iohandle);
}
int attribute_align_arg mpg123_framebyframe_decode_32(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
{
return mpg123_framebyframe_decode(mh, num, audio, bytes);
}
int attribute_align_arg mpg123_decode_frame_32(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
{
return mpg123_decode_frame(mh, num, audio, bytes);
}
off_t attribute_align_arg mpg123_timeframe_32(mpg123_handle *mh, double seconds)
{
return mpg123_timeframe64(mh, seconds);
}
off_t attribute_align_arg mpg123_tell_32(mpg123_handle *mh)
{
return mpg123_tell(mh);
}
off_t attribute_align_arg mpg123_tellframe_32(mpg123_handle *mh)
{
return mpg123_tellframe(mh);
}
off_t attribute_align_arg mpg123_tell_stream_32(mpg123_handle *mh)
{
return mpg123_tell_stream(mh);
}
off_t attribute_align_arg mpg123_seek_32(mpg123_handle *mh, off_t sampleoff, int whence)
{
return mpg123_seek(mh, sampleoff, whence);
}
off_t attribute_align_arg mpg123_feedseek_32(mpg123_handle *mh, off_t sampleoff, int whence, off_t *input_offset)
{
return mpg123_feedseek(mh, sampleoff, whence, input_offset);
}
off_t attribute_align_arg mpg123_seek_frame_32(mpg123_handle *mh, off_t offset, int whence)
{
return mpg123_seek_frame(mh, offset, whence);
}
int attribute_align_arg mpg123_set_filesize_32(mpg123_handle *mh, off_t size)
{
return mpg123_set_filesize(mh, size);
}
off_t attribute_align_arg mpg123_framelength_32(mpg123_handle *mh)
{
return mpg123_framelength(mh);
}
off_t attribute_align_arg mpg123_length_32(mpg123_handle *mh)
{
return mpg123_length(mh);
}
int attribute_align_arg mpg123_index_32(mpg123_handle *mh, off_t **offsets, off_t *step, size_t *fill)
{
return mpg123_index(mh, offsets, step, fill);
}
int attribute_align_arg mpg123_set_index_32(mpg123_handle *mh, off_t *offsets, off_t step, size_t fill)
{
return mpg123_set_index(mh, offsets, step, fill);
}
off_t attribute_align_arg mpg123_framepos_32(mpg123_handle *mh)
{
return mpg123_framepos(mh);
}
int attribute_align_arg mpg123_position_32( mpg123_handle *mh, off_t INT123_frame_offset
, off_t buffered_bytes, off_t *current_frame, off_t *frames_left
, double *current_seconds, double *seconds_left )
{
return mpg123_position( mh, INT123_frame_offset, buffered_bytes
, current_frame, frames_left, current_seconds, seconds_left );
}
#endif
// _64 aliases if we either got some off64_t to work with or
// if there is no explicit 64 bit API but off_t is just always
// 64 bits.
#if defined(LFS_LARGEFILE_64) || (SIZEOF_OFF_T == 8)
#ifdef LFS_LARGEFILE_64
#define OFF64 off64_t
#else
#define OFF64 off_t
#endif
int attribute_align_arg mpg123_open_64(mpg123_handle *mh, const char *path)
{
return mpg123_open(mh, path);
}
int attribute_align_arg mpg123_open_fixed_64( mpg123_handle *mh, const char *path
, int channels, int encoding )
{
return mpg123_open_fixed(mh, path, channels, encoding);
}
int attribute_align_arg mpg123_open_fd_64(mpg123_handle *mh, int fd)
{
return mpg123_open_fd(mh, fd);
}
int attribute_align_arg mpg123_open_handle_64(mpg123_handle *mh, void *iohandle)
{
return mpg123_open_handle(mh, iohandle);
}
int attribute_align_arg mpg123_framebyframe_decode_64(mpg123_handle *mh, OFF64 *num, unsigned char **audio, size_t *bytes)
{
return mpg123_framebyframe_decode64(mh, (int64_t*)num, audio, bytes);
}
int attribute_align_arg mpg123_decode_frame_64(mpg123_handle *mh, OFF64 *num, unsigned char **audio, size_t *bytes)
{
return mpg123_decode_frame64(mh, (int64_t*)num, audio, bytes);
}
OFF64 attribute_align_arg mpg123_timeframe_64(mpg123_handle *mh, double seconds)
{
return mpg123_timeframe64(mh, seconds);
}
OFF64 attribute_align_arg mpg123_tell_64(mpg123_handle *mh)
{
return mpg123_tell64(mh);
}
OFF64 attribute_align_arg mpg123_tellframe_64(mpg123_handle *mh)
{
return mpg123_tellframe64(mh);
}
OFF64 attribute_align_arg mpg123_tell_stream_64(mpg123_handle *mh)
{
return mpg123_tell_stream64(mh);
}
OFF64 attribute_align_arg mpg123_seek_64(mpg123_handle *mh, OFF64 sampleoff, int whence)
{
return mpg123_seek64(mh, (int64_t)sampleoff, whence);
}
OFF64 attribute_align_arg mpg123_feedseek_64(mpg123_handle *mh, OFF64 sampleoff, int whence, OFF64 *input_offset)
{
return mpg123_feedseek64(mh, (int64_t)sampleoff, whence, (int64_t*)input_offset);
}
OFF64 attribute_align_arg mpg123_seek_frame_64(mpg123_handle *mh, OFF64 offset, int whence)
{
return mpg123_seek_frame64(mh, (int64_t)offset, whence);
}
int attribute_align_arg mpg123_set_filesize_64(mpg123_handle *mh, OFF64 size)
{
return mpg123_set_filesize64(mh, (int64_t)size);
}
OFF64 attribute_align_arg mpg123_framelength_64(mpg123_handle *mh)
{
return mpg123_framelength64(mh);
}
OFF64 attribute_align_arg mpg123_length_64(mpg123_handle *mh)
{
return mpg123_length64(mh);
}
int attribute_align_arg mpg123_index_64(mpg123_handle *mh, OFF64 **offsets, OFF64 *step, size_t *fill)
{
return mpg123_index64(mh, (int64_t**)offsets, (int64_t*)step, fill);
}
int attribute_align_arg mpg123_set_index_64(mpg123_handle *mh, OFF64 *offsets, OFF64 step, size_t fill)
{
return mpg123_set_index64(mh, (int64_t*)offsets, (int64_t)step, fill);
}
OFF64 attribute_align_arg mpg123_framepos_64(mpg123_handle *mh)
{
return mpg123_framepos64(mh);
}
int attribute_align_arg mpg123_position_64( mpg123_handle *mh, OFF64 INT123_frame_offset
, OFF64 buffered_bytes, OFF64 *current_frame, OFF64 *frames_left
, double *current_seconds, double *seconds_left )
{
return mpg123_position64( mh, (int64_t)INT123_frame_offset, (int64_t)buffered_bytes
, (int64_t*)current_frame, (int64_t*)frames_left, current_seconds, seconds_left );
}
#undef OFF64
#endif
/* =========================================
THE BOUNDARY OF SANITY
Behold, stranger!
========================================= */
// One read callback wrapping over all 4 client callback variants.
static int wrap_read(void* handle, void *buf, size_t count, size_t *got)
{
struct wrap_data *ioh = handle;
ptrdiff_t retgot = -1;
switch(ioh->iotype)
{
case IO_FD:
retgot = ioh->r_read(ioh->fd, buf, count);
break;
case IO_HANDLE:
retgot = ioh->r_h_read(ioh->handle, buf, count);
break;
#ifdef LFS_LARGEFILE_64
case IO_FD_64:
retgot = ioh->r_read_64(ioh->fd, buf, count);
break;
case IO_HANDLE_64:
retgot = ioh->r_h_read_64(ioh->handle, buf, count);
break;
#endif
default:
error("Serious breakage - bad IO type in LFS wrapper!");
}
if(got)
*got = retgot > 0 ? (size_t)retgot : 0;
return retgot >= 0 ? 0 : -1;
}
// One seek callback wrapping over all 4 client callback variants.
static int64_t wrap_lseek(void *handle, int64_t offset, int whence)
{
struct wrap_data *ioh = handle;
if( (ioh->iotype == IO_FD || ioh->iotype == IO_HANDLE) &&
(offset < OFF_MIN || offset > OFF_MAX) )
{
errno = EOVERFLOW;
return -1;
}
switch(ioh->iotype)
{
case IO_FD: return ioh->r_lseek(ioh->fd, (off_t)offset, whence);
case IO_HANDLE: return ioh->r_h_lseek(ioh->handle, (off_t)offset, whence);
#ifdef LFS_LARGEFILE_64
case IO_FD_64: return ioh->r_lseek_64(ioh->fd, offset, whence);
case IO_HANDLE_64: return ioh->r_h_lseek_64(ioh->handle, offset, whence);
#endif
}
error("Serious breakage - bad IO type in LFS wrapper!");
return -1;
}
// This is assuming an internally opened file, which usually will be
// using 64 bit offsets. It keeps reading on on trivial interruptions.
// I guess any file descriptor that matches the libc should work fine.
static int internal_read64(void *handle, void *buf, size_t bytes, size_t *got_bytes)
{
int ret = 0;
if(!handle || (!buf && bytes))
return -1;
struct wrap_data* ioh = handle;
int fd = ioh->fd;
size_t got = 0;
errno = 0;
while(bytes)
{
#ifdef TIMEOUT_READ
if(ioh->timeout_sec)
{
fd_set fds;
tv.tv_sec = ioh->timeout_sec;
tv.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(fd, &fds);
int sret = select(fd+1, &fds, NULL, NULL, &tv);
if(sret < 1)
{
return -1; // timeout means error
// communicate quietness flag? if(NOQUIET) error("stream timed out");
}
}
#endif
errno = 0;
ptrdiff_t part = read(fd, (char*)buf+got, bytes);
if(part > 0) // == 0 is end of file
{
SATURATE_SUB(bytes, part, 0)
SATURATE_ADD(got, part, SIZE_MAX)
} else if(errno != EINTR && errno != EAGAIN
#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
&& errno != EWOULDBLOCK
#endif
){
if(part < 0)
ret = -1;
break;
}
}
if(got_bytes)
*got_bytes = got;
return ret;
}
static int64_t internal_lseek64(void *handle, int64_t offset, int whence)
{
struct wrap_data* ioh = handle;
#ifdef LFS_LARGEFILE_64
return lseek64(ioh->fd, offset, whence);
#else
if(offset < OFF_MIN || offset > OFF_MAX)
{
errno = EOVERFLOW;
return -1;
}
return lseek(ioh->fd, (off_t)offset, whence);
#endif
}
int INT123_wrap_open(mpg123_handle *mh, void *handle, const char *path, int fd, long timeout, int quiet)
{
int force_alloc = (path || fd >= 0) ? 1 : 0;
struct wrap_data *ioh = wrap_get(mh, force_alloc);
if(ioh == NULL && force_alloc)
return MPG123_ERR;
if(!path && fd < 0)
{
if(!ioh || ioh->iotype == IO_HANDLE64)
{
mdebug("user-supplied 64 bit I/O on user-supplied handle %p", handle);
return LFS_WRAP_NONE;
}
if(ioh->iotype == IO_HANDLE)
{
mdebug("wrapped user handle %p", handle);
ioh->handle = handle;
if(ioh->r_h_read && ioh->r_h_lseek)
return mpg123_reader64(mh, wrap_read, wrap_lseek, wrap_io_cleanup);
return INT123_set_err(mh, MPG123_NO_READER);
}
#ifdef LFS_LARGEFILE_64
if(ioh->iotype == IO_HANDLE_64)
{
mdebug("wrapped 64 bit user handle %p", handle);
ioh->handle = handle;
if(ioh->r_h_read_64 && ioh->r_h_lseek_64)
return mpg123_reader64(mh, wrap_read, wrap_lseek, wrap_io_cleanup);
return INT123_set_err(mh, MPG123_NO_READER);
}
#endif
}
if(path)
{
debug("opening path (providing fd)");
// Open the resource and store the descriptor for closing later.
int flags=O_RDONLY;
#ifdef O_BINARY
flags |= O_BINARY;
#endif
#if defined(LFS_LARGEFILE_64) && defined(HAVE_O_LARGEFILE)
flags |= O_LARGEFILE;
#endif
errno = 0;
ioh->my_fd = fd = INT123_compat_open(path, flags);
if(fd < 0)
{
if(!quiet)
error2("Cannot open file %s: %s", path, INT123_strerror(errno));
return INT123_set_err(mh, MPG123_BAD_FILE);
}
}
if(fd >= 0)
{
mdebug("working with given fd %d", fd);
ioh->fd = fd;
// Prepared I/O using external callbacks.
if(ioh->iotype == IO_FD)
{
debug("native fd callbacks");
if(ioh->r_read && ioh->r_lseek)
return mpg123_reader64(mh, wrap_read, wrap_lseek, wrap_io_cleanup);
return INT123_set_err(mh, MPG123_NO_READER);
}
#ifdef LFS_LARGEFILE_64
if(ioh->iotype == IO_FD_64)
{
debug("64 bit fd callbacks");
if(ioh->r_read_64 && ioh->r_lseek_64)
return mpg123_reader64(mh, wrap_read, wrap_lseek, wrap_io_cleanup);
return INT123_set_err(mh, MPG123_NO_READER);
}
debug("internal 64 bit I/O");
#else
debug("internal 32-behind-64 bit I/O");
#endif
// Doing our own thing using the given/just-opened descriptor.
ioh->iotype = IO_INT_FD;
#ifdef TIMEOUT_READ
ioh->timeout_sec = (time_t)(timeout > 0 ? timeout : 0);
if(ioh->timeout_sec > 0)
{
mdebug("timeout reader with %ld s", timeout);
int flags;
flags = fcntl(fd, F_GETFL);
flags |= O_NONBLOCK;
fcntl(fd, F_SETFL, flags);
}
#endif
return mpg123_reader64(mh, internal_read64, internal_lseek64, wrap_io_cleanup);
}
return MPG123_ERR;
}
// So, native off_t reader replacement.
// Defining a wrapper to the native read to be sure the prototype matches.
// There are platforms where it is read(int, void*, unsigned int).
// We know that we read small chunks where the difference does not matter. Could
// apply specific hackery, use a common compat_read() (INT123_unintr_read()?) with system
// specifics.
static mpg123_ssize_t fallback_read(int fd, void *buf, size_t count)
{
return read(fd, buf, count);
}
/* Reader replacement prepares the hidden handle storage for next mpg123_open_fd() or plain mpg123_open(). */
int attribute_align_arg mpg123_replace_reader(mpg123_handle *mh, mpg123_ssize_t (*r_read) (int, void *, size_t), off_t (*r_lseek)(int, off_t, int) )
{
struct wrap_data* ioh;
if(mh == NULL) return MPG123_ERR;
mpg123_close(mh);
ioh = wrap_get(mh, 1);
if(ioh == NULL) return MPG123_ERR;
/* If both callbacks are NULL, switch totally to internal I/O, else just use fallback for at most half of them. */
if(r_read == NULL && r_lseek == NULL)
{
ioh->iotype = IO_INT_FD;
ioh->fd = -1;
ioh->r_read = NULL;
ioh->r_lseek = NULL;
}
else
{
ioh->iotype = IO_FD;
ioh->fd = -1; /* On next mpg123_open_fd(), this gets a value. */
ioh->r_read = r_read != NULL ? r_read : fallback_read;
ioh->r_lseek = r_lseek != NULL ? (void *)r_lseek : (void *)lseek;
}
/* The real reader replacement will happen while opening. */
return MPG123_OK;
}
int attribute_align_arg mpg123_replace_reader_handle(mpg123_handle *mh, mpg123_ssize_t (*r_read) (void*, void *, size_t), off_t (*r_lseek)(void*, off_t, int), void (*cleanup)(void*))
{
struct wrap_data* ioh;
if(mh == NULL) return MPG123_ERR;
mpg123_close(mh);
ioh = wrap_get(mh, 1);
if(ioh == NULL) return MPG123_ERR;
ioh->iotype = IO_HANDLE;
ioh->handle = NULL;
ioh->r_h_read = r_read;
ioh->r_h_lseek = r_lseek;
ioh->h_cleanup = cleanup;
/* The real reader replacement will happen while opening. */
return MPG123_OK;
}
#if SIZEOF_OFF_T == 4
int attribute_align_arg mpg123_replace_reader_32(mpg123_handle *mh, mpg123_ssize_t (*r_read) (int, void *, size_t), off_t (*r_lseek)(int, off_t, int) )
{
return mpg123_replace_reader(mh, r_read, r_lseek);
}
int attribute_align_arg mpg123_replace_reader_handle_32(mpg123_handle *mh, mpg123_ssize_t (*r_read) (void*, void *, size_t), off_t (*r_lseek)(void*, off_t, int), void (*cleanup)(void*))
{
return mpg123_replace_reader_handle(mh, r_read, r_lseek, cleanup);
}
#endif
#ifdef LFS_LARGEFILE_64
int attribute_align_arg mpg123_replace_reader_64(mpg123_handle *mh, mpg123_ssize_t (*r_read) (int, void *, size_t), off64_t (*r_lseek)(int, off64_t, int) )
{
struct wrap_data* ioh;
if(mh == NULL) return MPG123_ERR;
mpg123_close(mh);
ioh = wrap_get(mh, 1);
if(ioh == NULL) return MPG123_ERR;
/* If both callbacks are NULL, switch totally to internal I/O, else just use fallback for at most half of them. */
if(r_read == NULL && r_lseek == NULL)
{
ioh->iotype = IO_INT_FD;
ioh->fd = -1;
ioh->r_read_64 = NULL;
ioh->r_lseek_64 = NULL;
}
else
{
ioh->iotype = IO_FD_64;
ioh->fd = -1; /* On next mpg123_open_fd(), this gets a value. */
ioh->r_read_64 = r_read != NULL ? r_read : fallback_read;
ioh->r_lseek_64 = r_lseek != NULL ? r_lseek : lseek64;
}
/* The real reader replacement will happen while opening. */
return MPG123_OK;
}
int attribute_align_arg mpg123_replace_reader_handle_64(mpg123_handle *mh, mpg123_ssize_t (*r_read) (void*, void *, size_t), off64_t (*r_lseek)(void*, off64_t, int), void (*cleanup)(void*))
{
struct wrap_data* ioh;
if(mh == NULL) return MPG123_ERR;
mpg123_close(mh);
ioh = wrap_get(mh, 1);
if(ioh == NULL) return MPG123_ERR;
ioh->iotype = IO_HANDLE_64;
ioh->handle = NULL;
ioh->r_h_read_64 = r_read;
ioh->r_h_lseek_64 = r_lseek;
ioh->h_cleanup = cleanup;
/* The real reader replacement will happen while opening. */
return MPG123_OK;
}
#elif SIZEOF_OFF_T == 8
int attribute_align_arg mpg123_replace_reader_64(mpg123_handle *mh, mpg123_ssize_t (*r_read) (int, void *, size_t), off_t (*r_lseek)(int, off_t, int) )
{
return mpg123_replace_reader(mh, r_read, r_lseek);
}
int attribute_align_arg mpg123_replace_reader_handle_64(mpg123_handle *mh, mpg123_ssize_t (*r_read) (void*, void *, size_t), off_t (*r_lseek)(void*, off_t, int), void (*cleanup)(void*))
{
return mpg123_replace_reader_handle(mh, r_read, r_lseek, cleanup);
}
#endif
/*
lfs_wrap: I/O wrapper code
copyright 2010-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis (after code from Michael Hipp)
This is the interface to the implementation of internal reading/seeking
as well as wrapping of client callbacks to the one and only 64 bit
callback API on opaque handles.
Code outside of this shall not be concerned with I/O details, and
code inside of this shall not be concerned with other
libmpg123 internals. Just the public portable API interface.
*/
// This is to be offered by libmpg123 code that has access to frame struct
// details. It returns the address to load/store the pointer to the
// wrapper handle from/into. A little hack to keep things disentangled.
void ** INT123_wrap_handle(mpg123_handle *mh);
// Set error code in the mpg123 handle and return MPG123_ERR.
int INT123_set_err(mpg123_handle *mh, int err);
// These are offered by the source associated with this header.
// This is one open routine for all ways. One of the given resource arguments is active:
// 1. handle: if path == NULL && fd < 0
// 2. path: if path != NULL
// 3. fd: if fd >= 0
// In case of 64 bit handle setup, this does nothing.
// Return values:
// 0: setup for wrapped I/O successful.
// 1: use user-supplied 64 bit I/O handle directly, no internal wrappery
// <0: error
#define LFS_WRAP_NONE 1
int INT123_wrap_open(mpg123_handle *mh, void *handle, const char *path, int fd, long timeout, int quiet);
// Deallocate all associated resources and handle memory itself.
void INT123_wrap_destroy(void * handle);
// The bulk of functions are implementations of the non-portable
// libmpg123 API declared or implied in the main header.
/*
libmpg123: MPEG Audio Decoder library
copyright 1995-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1995-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
*/
#include "mpg123lib_intern.h"
#include "version.h"
#include "icy2utf8.h"
#include "gapless.h"
......@@ -14,11 +15,33 @@
#define FORCE_ACCURATE
#include "sample.h"
#include "parse.h"
#ifndef PORTABLE_API
#include "lfs_wrap.h"
#endif
#include "debug.h"
#define SEEKFRAME(mh) ((mh)->ignoreframe < 0 ? 0 : (mh)->ignoreframe)
const char * attribute_align_arg mpg123_distversion(unsigned int *major, unsigned int *minor, unsigned int *patch)
{
if(major)
*major = MPG123_MAJOR;
if(minor)
*minor = MPG123_MINOR;
if(patch)
*patch = MPG123_PATCH;
return MPG123_VERSION;
}
unsigned int attribute_align_arg mpg123_libversion(unsigned int *patch)
{
if(patch)
*patch = MPG123_PATCHLEVEL;
return MPG123_API_VERSION;
}
int attribute_align_arg mpg123_init(void)
{
// Since 1.27.0, this is a no-op and shall stay that way.
......@@ -52,12 +75,12 @@ mpg123_handle attribute_align_arg *mpg123_parnew(mpg123_pars *mp, const char* de
if(!tables_initialized)
{
#ifndef NO_LAYER12
init_layer12(); /* inits also shared tables with layer1 */
INT123_init_layer12(); /* inits also shared tables with layer1 */
#endif
#ifndef NO_LAYER3
init_layer3();
INT123_init_layer3();
#endif
init_costabs();
INT123_init_costabs();
tables_initialized = 1;
}
#endif
......@@ -83,12 +106,12 @@ mpg123_handle attribute_align_arg *mpg123_parnew(mpg123_pars *mp, const char* de
fr = (mpg123_handle*) malloc(sizeof(mpg123_handle));
if(fr != NULL)
{
frame_init_par(fr, mp);
INT123_frame_init_par(fr, mp);
debug("cpu opt setting");
if(frame_cpu_opt(fr, decoder) != 1)
if(INT123_frame_cpu_opt(fr, decoder) != 1)
{
err = MPG123_BAD_DECODER;
frame_exit(fr);
INT123_frame_exit(fr);
free(fr);
fr = NULL;
}
......@@ -105,7 +128,7 @@ mpg123_handle attribute_align_arg *mpg123_parnew(mpg123_pars *mp, const char* de
int attribute_align_arg mpg123_decoder(mpg123_handle *mh, const char* decoder)
{
enum optdec dt = dectype(decoder);
enum optdec dt = INT123_dectype(decoder);
if(mh == NULL) return MPG123_BAD_HANDLE;
......@@ -117,23 +140,23 @@ int attribute_align_arg mpg123_decoder(mpg123_handle *mh, const char* decoder)
if(dt == mh->cpu_opts.type) return MPG123_OK;
/* Now really change. */
/* frame_exit(mh);
frame_init(mh); */
/* INT123_frame_exit(mh);
INT123_frame_init(mh); */
debug("cpu opt setting");
if(frame_cpu_opt(mh, decoder) != 1)
if(INT123_frame_cpu_opt(mh, decoder) != 1)
{
mh->err = MPG123_BAD_DECODER;
frame_exit(mh);
INT123_frame_exit(mh);
return MPG123_ERR;
}
/* New buffers for decoder are created in frame_buffers() */
if((frame_outbuffer(mh) != 0))
/* New buffers for decoder are created in INT123_frame_buffers() */
if((INT123_frame_outbuffer(mh) != 0))
{
mh->err = MPG123_NO_BUFFERS;
frame_exit(mh);
INT123_frame_exit(mh);
return MPG123_ERR;
}
/* Do _not_ call decode_update here! That is only allowed after a first MPEG frame has been met. */
/* Do _not_ call INT123_decode_update here! That is only allowed after a first MPEG frame has been met. */
mh->decoder_change = 1;
return MPG123_OK;
}
......@@ -150,14 +173,14 @@ int attribute_align_arg mpg123_param(mpg123_handle *mh, enum mpg123_parms key, l
#ifdef FRAME_INDEX
if(key == MPG123_INDEX_SIZE)
{ /* Apply frame index size and grow property on the fly. */
r = frame_index_setup(mh);
r = INT123_frame_index_setup(mh);
if(r != MPG123_OK) mh->err = MPG123_INDEX_FAIL;
}
#endif
#ifndef NO_FEEDER
/* Feeder pool size is applied right away, reader will react to that. */
if(key == MPG123_FEEDPOOL || key == MPG123_FEEDBUFFER)
bc_poolsize(&mh->rdat.buffer, mh->p.feedpool, mh->p.feedbuffer);
INT123_bc_poolsize(&mh->rdat.buffer, mh->p.feedpool, mh->p.feedbuffer);
#endif
}
return r;
......@@ -410,7 +433,7 @@ int attribute_align_arg mpg123_getstate(mpg123_handle *mh, enum mpg123_state key
case MPG123_BUFFERFILL:
#ifndef NO_FEEDER
{
size_t sval = bc_fill(&mh->rdat.buffer);
size_t sval = INT123_bc_fill(&mh->rdat.buffer);
theval = (long)sval;
if(theval < 0 || (size_t)theval != sval)
{
......@@ -504,7 +527,7 @@ int attribute_align_arg mpg123_eq_change(mpg123_handle *mh, int channel, int a,
if(channel & MPG123_LEFT)
mh->equalizer[0][band] = DOUBLE_TO_REAL(dbchange(REAL_TO_DOUBLE(mh->equalizer[0][band]), db));
if(channel & MPG123_RIGHT)
mh->equalizer[1][band] = DOUBLE_TO_REAL(dbchange(REAL_TO_DOUBLE(mh->equalizer[1][band]), db));;
mh->equalizer[1][band] = DOUBLE_TO_REAL(dbchange(REAL_TO_DOUBLE(mh->equalizer[1][band]), db));
mh->have_eq_settings = TRUE;
}
#endif
......@@ -536,19 +559,27 @@ double attribute_align_arg mpg123_geteq2(mpg123_handle *mh, int channel, int ban
return mpg123_geteq(mh, channel, band);
}
#ifndef PORTABLE_API
/* plain file access, no http! */
int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
mpg123_close(mh);
return open_stream(mh, path, -1);
if(!path)
return MPG123_ERR;
// sets callbacks, only allocating wrapperdata handle if internal callbacks involved
int ret = INT123_wrap_open( mh, NULL, path, -1
, mh->p.timeout, mh->p.flags & MPG123_QUIET );
if(!ret)
ret = INT123_open_stream_handle(mh, mh->wrapperdata);
return ret;
}
// The convenience function mpg123_open_fixed() wraps over acual mpg123_open
// and hence needs to have the exact same code in lfs_wrap.c. The flesh is
// in open_fixed_pre() and open_fixed_post(), wich are only defined here.
int open_fixed_pre(mpg123_handle *mh, int channels, int encoding)
// in INT123_open_fixed_pre() and INT123_open_fixed_post(), wich are only defined here.
int INT123_open_fixed_pre(mpg123_handle *mh, int channels, int encoding)
{
if(!mh)
return MPG123_BAD_HANDLE;
......@@ -559,7 +590,7 @@ int open_fixed_pre(mpg123_handle *mh, int channels, int encoding)
return err;
}
int open_fixed_post(mpg123_handle *mh, int channels, int encoding)
int INT123_open_fixed_post(mpg123_handle *mh, int channels, int encoding)
{
if(!mh)
return MPG123_BAD_HANDLE;
......@@ -573,7 +604,7 @@ int open_fixed_post(mpg123_handle *mh, int channels, int encoding)
{
if(mh->track_frames < 1 && (mh->rdat.flags & READER_SEEKABLE))
{
debug("open_fixed_post: scan because we can seek and do not know track_frames");
debug("INT123_open_fixed_post: scan because we can seek and do not know track_frames");
err = mpg123_scan(mh);
}
}
......@@ -585,11 +616,11 @@ int open_fixed_post(mpg123_handle *mh, int channels, int encoding)
int attribute_align_arg mpg123_open_fixed( mpg123_handle *mh, const char *path
, int channels, int encoding )
{
int err = open_fixed_pre(mh, channels, encoding);
int err = INT123_open_fixed_pre(mh, channels, encoding);
if(err == MPG123_OK)
err = mpg123_open(mh, path);
if(err == MPG123_OK)
err = open_fixed_post(mh, channels, encoding);
err = INT123_open_fixed_post(mh, channels, encoding);
return err;
}
......@@ -598,20 +629,29 @@ int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd)
if(mh == NULL) return MPG123_BAD_HANDLE;
mpg123_close(mh);
return open_stream(mh, NULL, fd);
if(fd < 0)
return MPG123_ERR;
int ret = INT123_wrap_open( mh, NULL, NULL, fd
, mh->p.timeout, mh->p.flags & MPG123_QUIET );
if(!ret)
ret = INT123_open_stream_handle(mh, mh->wrapperdata);
return ret;
}
#endif
int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *iohandle)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
mpg123_close(mh);
if(mh->rdat.r_read_handle == NULL)
{
mh->err = MPG123_BAD_CUSTOM_IO;
return MPG123_ERR;
}
return open_stream_handle(mh, iohandle);
int ret;
#ifndef PORTABLE_API
ret = INT123_wrap_open( mh, iohandle, NULL, -1
, mh->p.timeout, mh->p.flags & MPG123_QUIET );
if(ret >= 0)
#endif
ret = INT123_open_stream_handle(mh, ret == LFS_WRAP_NONE ? iohandle : mh->wrapperdata);
return ret;
}
int attribute_align_arg mpg123_open_feed(mpg123_handle *mh)
......@@ -619,40 +659,41 @@ int attribute_align_arg mpg123_open_feed(mpg123_handle *mh)
if(mh == NULL) return MPG123_BAD_HANDLE;
mpg123_close(mh);
return open_feed(mh);
return INT123_open_feed(mh);
}
int attribute_align_arg mpg123_replace_reader( mpg123_handle *mh,
ssize_t (*r_read) (int, void *, size_t),
off_t (*r_lseek)(int, off_t, int) )
static int64_t no_lseek64(void *handle, int64_t off, int whence)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
mpg123_close(mh);
mh->rdat.r_read = r_read;
mh->rdat.r_lseek = r_lseek;
return MPG123_OK;
return -1;
}
int attribute_align_arg mpg123_replace_reader_handle( mpg123_handle *mh,
ssize_t (*r_read) (void*, void *, size_t),
off_t (*r_lseek)(void*, off_t, int),
void (*cleanup)(void*) )
// The simplest direct wrapper, actually no wrapping at all.
int attribute_align_arg mpg123_reader64( mpg123_handle *mh
, int (*r_read) (void *, void *, size_t, size_t *)
, int64_t (*r_lseek)(void *, int64_t, int)
, void (*cleanup)(void*) )
{
if(mh == NULL) return MPG123_BAD_HANDLE;
if(mh == NULL)
return MPG123_BAD_HANDLE;
mpg123_close(mh);
mh->rdat.r_read_handle = r_read;
mh->rdat.r_lseek_handle = r_lseek;
if(!r_read)
return MPG123_NULL_POINTER;
mh->rdat.r_read64 = r_read;
mh->rdat.r_lseek64 = r_lseek ? r_lseek : no_lseek64;
mh->rdat.cleanup_handle = cleanup;
return MPG123_OK;
}
// All other I/O gets routed through predefined wrapper.
/* Update decoding engine for
a) a new choice of decoder
b) a changed native format of the MPEG stream
... calls are only valid after parsing some MPEG frame! */
int decode_update(mpg123_handle *mh)
int INT123_decode_update(mpg123_handle *mh)
{
long native_rate;
int b;
......@@ -660,16 +701,16 @@ int decode_update(mpg123_handle *mh)
mh->state_flags &= ~FRAME_DECODER_LIVE;
if(mh->num < 0)
{
if(!(mh->p.flags & MPG123_QUIET)) error("decode_update() has been called before reading the first MPEG frame! Internal programming error.");
if(!(mh->p.flags & MPG123_QUIET)) error("INT123_decode_update() has been called before reading the first MPEG frame! Internal programming error.");
mh->err = MPG123_BAD_DECODER_SETUP;
return MPG123_ERR;
}
mh->state_flags |= FRAME_FRESH_DECODER;
native_rate = frame_freq(mh);
native_rate = INT123_frame_freq(mh);
b = frame_output_format(mh); /* Select the new output format based on given constraints. */
b = INT123_frame_output_format(mh); /* Select the new output format based on given constraints. */
if(b < 0) return MPG123_ERR;
if(b == 1) mh->new_format = 1; /* Store for later... */
......@@ -686,23 +727,23 @@ int decode_update(mpg123_handle *mh)
case 2:
mh->down_sample_sblimit = SBLIMIT>>(mh->down_sample);
/* With downsampling I get less samples per frame */
mh->outblock = outblock_bytes(mh, (mh->spf>>mh->down_sample));
mh->outblock = INT123_outblock_bytes(mh, (mh->spf>>mh->down_sample));
break;
#ifndef NO_NTOM
case 3:
{
if(synth_ntom_set_step(mh) != 0) return -1;
if(frame_freq(mh) > mh->af.rate)
if(INT123_synth_ntom_set_step(mh) != 0) return -1;
if(INT123_frame_freq(mh) > mh->af.rate)
{
mh->down_sample_sblimit = SBLIMIT * mh->af.rate;
mh->down_sample_sblimit /= frame_freq(mh);
mh->down_sample_sblimit /= INT123_frame_freq(mh);
if(mh->down_sample_sblimit < 1)
mh->down_sample_sblimit = 1;
}
else mh->down_sample_sblimit = SBLIMIT;
mh->outblock = outblock_bytes(mh,
mh->outblock = INT123_outblock_bytes(mh,
( ( NTOM_MUL-1+mh->spf
* (((size_t)NTOM_MUL*mh->af.rate)/frame_freq(mh))
* (((size_t)NTOM_MUL*mh->af.rate)/INT123_frame_freq(mh))
)/NTOM_MUL ));
}
break;
......@@ -715,13 +756,13 @@ int decode_update(mpg123_handle *mh)
else mh->single = SINGLE_STEREO;
}
else mh->single = (mh->p.flags & MPG123_FORCE_MONO)-1;
if(set_synth_functions(mh) != 0) return -1;;
if(INT123_set_synth_functions(mh) != 0) return -1;
/* The needed size of output buffer may have changed. */
if(frame_outbuffer(mh) != MPG123_OK) return -1;
if(INT123_frame_outbuffer(mh) != MPG123_OK) return -1;
do_rva(mh);
debug3("done updating decoder structure with native rate %li and af.rate %li and down_sample %i", frame_freq(mh), mh->af.rate, mh->down_sample);
INT123_do_rva(mh);
debug3("done updating decoder structure with native rate %li and af.rate %li and down_sample %i", INT123_frame_freq(mh), mh->af.rate, mh->down_sample);
mh->decoder_change = 0;
mh->state_flags |= FRAME_DECODER_LIVE;
......@@ -754,7 +795,7 @@ static int get_next_frame(mpg123_handle *mh)
change = 1;
mh->header_change = 0;
debug("starting with big header change");
if(decode_update(mh) < 0)
if(INT123_decode_update(mh) < 0)
return MPG123_ERR;
}
......@@ -765,19 +806,19 @@ static int get_next_frame(mpg123_handle *mh)
if(mh->to_ignore && mh->num < mh->firstframe && mh->num >= mh->ignoreframe)
{
debug1("ignoring frame %li", (long)mh->num);
/* Decoder structure must be current! decode_update has been called before... */
/* Decoder structure must be current! INT123_decode_update has been called before... */
(mh->do_layer)(mh); mh->buffer.fill = 0;
#ifndef NO_NTOM
/* The ignored decoding may have failed. Make sure ntom stays consistent. */
if(mh->down_sample == 3) ntom_set_ntom(mh, mh->num+1);
if(mh->down_sample == 3) INT123_ntom_set_ntom(mh, mh->num+1);
#endif
mh->to_ignore = mh->to_decode = FALSE;
}
/* Read new frame data; possibly breaking out here for MPG123_NEED_MORE. */
debug("read frame");
mh->to_decode = FALSE;
b = read_frame(mh); /* That sets to_decode only if a full frame was read. */
debug4("read of frame %li returned %i (to_decode=%i) at sample %li", (long)mh->num, b, mh->to_decode, (long)mpg123_tell(mh));
b = INT123_read_frame(mh); /* That sets to_decode only if a full frame was read. */
debug4("read of frame %"PRIi64" returned %i (to_decode=%i) at sample %"PRIi64, mh->num, b, mh->to_decode, mpg123_tell64(mh));
if(b == MPG123_NEED_MORE) return MPG123_NEED_MORE; /* need another call with data */
else if(b <= 0)
{
......@@ -798,7 +839,7 @@ static int get_next_frame(mpg123_handle *mh)
mh->header_change = 0;
/* Need to update decoder structure right away since frame might need to
be decoded on next loop iteration for properly ignoring its output. */
if(decode_update(mh) < 0)
if(INT123_decode_update(mh) < 0)
return MPG123_ERR;
}
/* Now some accounting: Look at the numbers and decide if we want this frame. */
......@@ -808,7 +849,7 @@ static int get_next_frame(mpg123_handle *mh)
{
if(!(mh->to_ignore && mh->num < mh->firstframe && mh->num >= mh->ignoreframe))
{
frame_skip(mh);
INT123_frame_skip(mh);
/* Should one fix NtoM here or not?
It is not work the trouble for doublespeed, but what with leading frames? */
}
......@@ -826,9 +867,9 @@ static int get_next_frame(mpg123_handle *mh)
#ifdef GAPLESS
int b=0;
/* Prepare offsets for gapless decoding. */
debug1("preparing gapless stuff with native rate %li", frame_freq(mh));
frame_gapless_realinit(mh);
frame_set_frameseek(mh, mh->num);
debug1("preparing gapless stuff with native rate %li", INT123_frame_freq(mh));
INT123_frame_gapless_realinit(mh);
INT123_frame_set_frameseek(mh, mh->num);
#endif
mh->fresh = 0;
#ifdef GAPLESS
......@@ -859,9 +900,8 @@ static int zero_byte(mpg123_handle *fr)
*/
static void decode_the_frame(mpg123_handle *fr)
{
size_t needed_bytes = decoder_synth_bytes(fr, frame_expect_outsamples(fr));
size_t needed_bytes = INT123_decoder_synth_bytes(fr, INT123_frame_expect_outsamples(fr));
fr->clip += (fr->do_layer)(fr);
/*fprintf(stderr, "frame %"OFF_P": got %"SIZE_P" / %"SIZE_P"\n", fr->num,(size_p)fr->buffer.fill, (size_p)needed_bytes);*/
/* There could be less data than promised.
Also, then debugging, we look out for coding errors that could result in _more_ data than expected. */
#ifdef DEBUG
......@@ -883,8 +923,8 @@ static void decode_the_frame(mpg123_handle *fr)
fr->buffer.fill = needed_bytes;
#ifndef NO_NTOM
/* ntom_val will be wrong when the decoding wasn't carried out completely */
ntom_set_ntom(fr, fr->num+1);
/* INT123_ntom_val will be wrong when the decoding wasn't carried out completely */
INT123_ntom_set_ntom(fr, fr->num+1);
#endif
}
#ifdef DEBUG
......@@ -895,7 +935,7 @@ static void decode_the_frame(mpg123_handle *fr)
}
}
#endif
postprocess_buffer(fr);
INT123_postprocess_buffer(fr);
}
/*
......@@ -910,7 +950,7 @@ static void decode_the_frame(mpg123_handle *fr)
MPG123_BAD_HANDLE -- mh has not been initialized
MPG123_NO_SPACE -- not enough space in buffer for safe decoding, should not happen
*/
int attribute_align_arg mpg123_framebyframe_decode(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
int attribute_align_arg mpg123_framebyframe_decode64(mpg123_handle *mh, int64_t *num, unsigned char **audio, size_t *bytes)
{
if(bytes == NULL) return MPG123_ERR_NULL;
if(audio == NULL) return MPG123_ERR_NULL;
......@@ -982,7 +1022,7 @@ int attribute_align_arg mpg123_framebyframe_next(mpg123_handle *mh)
num will be updated to the last decoded frame number (may possibly _not_ increase, p.ex. when format changed).
*/
int attribute_align_arg mpg123_decode_frame(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes)
int attribute_align_arg mpg123_decode_frame64(mpg123_handle *mh, int64_t *num, unsigned char **audio, size_t *bytes)
{
if(bytes != NULL) *bytes = 0;
if(mh == NULL) return MPG123_BAD_HANDLE;
......@@ -1005,7 +1045,7 @@ int attribute_align_arg mpg123_decode_frame(mpg123_handle *mh, off_t *num, unsig
}
debug("decoding");
if( (mh->decoder_change && decode_update(mh) < 0)
if( (mh->decoder_change && INT123_decode_update(mh) < 0)
|| !(mh->state_flags & FRAME_DECODER_LIVE) )
return MPG123_ERR;
decode_the_frame(mh);
......@@ -1027,6 +1067,7 @@ int attribute_align_arg mpg123_decode_frame(mpg123_handle *mh, off_t *num, unsig
}
}
int attribute_align_arg mpg123_read(mpg123_handle *mh, void *out, size_t size, size_t *done)
{
return mpg123_decode(mh, NULL, 0, out, size, done);
......@@ -1040,7 +1081,7 @@ int attribute_align_arg mpg123_feed(mpg123_handle *mh, const unsigned char *in,
{
if(in != NULL)
{
if(feed_more(mh, in, size) != 0) return MPG123_ERR;
if(INT123_feed_more(mh, in, size) != 0) return MPG123_ERR;
else
{
/* The need for more data might have triggered an error.
......@@ -1111,7 +1152,7 @@ int attribute_align_arg mpg123_decode(mpg123_handle *mh, const unsigned char *in
ret = MPG123_NO_SPACE;
goto decodeend;
}
if( (mh->decoder_change && decode_update(mh) < 0)
if( (mh->decoder_change && INT123_decode_update(mh) < 0)
|| ! (mh->state_flags & FRAME_DECODER_LIVE) )
{
ret = MPG123_ERR;
......@@ -1120,7 +1161,7 @@ int attribute_align_arg mpg123_decode(mpg123_handle *mh, const unsigned char *in
decode_the_frame(mh);
mh->to_decode = mh->to_ignore = FALSE;
mh->buffer.p = mh->buffer.data;
debug2("decoded frame %li, got %li samples in buffer", (long)mh->num, (long)(mh->buffer.fill / (samples_to_bytes(mh, 1))));
debug2("decoded frame %li, got %li samples in buffer", (long)mh->num, (long)(mh->buffer.fill / (INT123_samples_to_bytes(mh, 1))));
FRAME_BUFFERCHECK(mh);
}
if(mh->buffer.fill) /* Copy (part of) the decoded data to the caller's buffer. */
......@@ -1189,7 +1230,7 @@ static int init_track(mpg123_handle *mh)
\
mi->version = mh->mpeg25 ? MPG123_2_5 : (mh->lsf ? MPG123_2_0 : MPG123_1_0); \
mi->layer = mh->lay; \
mi->rate = frame_freq(mh); \
mi->rate = INT123_frame_freq(mh); \
switch(mh->mode) \
{ \
case 0: mi->mode = MPG123_M_STEREO; break; \
......@@ -1206,7 +1247,7 @@ static int init_track(mpg123_handle *mh)
if(mh->extension) mi->flags |= MPG123_PRIVATE; \
if(mh->original) mi->flags |= MPG123_ORIGINAL; \
mi->emphasis = mh->emphasis; \
mi->bitrate = frame_bitrate(mh); \
mi->bitrate = INT123_frame_bitrate(mh); \
mi->abr_rate = mh->abr_rate; \
mi->vbr = mh->vbr; \
return MPG123_OK; \
......@@ -1239,14 +1280,15 @@ int attribute_align_arg mpg123_getformat(mpg123_handle *mh, long *rate, int *cha
return mpg123_getformat2(mh, rate, channels, encoding, 1);
}
off_t attribute_align_arg mpg123_timeframe(mpg123_handle *mh, double seconds)
int64_t attribute_align_arg mpg123_timeframe64(mpg123_handle *mh, double seconds)
{
off_t b;
int64_t b;
if(mh == NULL) return MPG123_ERR;
b = init_track(mh);
if(b<0) return b;
return (off_t)(seconds/mpg123_tpf(mh));
// Overflow checking here would be a bit more elaborate. TODO?
return (int64_t)(seconds/mpg123_tpf(mh));
}
/*
......@@ -1257,29 +1299,29 @@ off_t attribute_align_arg mpg123_timeframe(mpg123_handle *mh, double seconds)
Then, there is firstframe...when we didn't reach it yet, then the next data will come from there.
mh->num starts with -1
*/
off_t attribute_align_arg mpg123_tell(mpg123_handle *mh)
int64_t attribute_align_arg mpg123_tell64(mpg123_handle *mh)
{
if(mh == NULL) return MPG123_ERR;
if(track_need_init(mh)) return 0;
/* Now we have all the info at hand. */
debug5("tell: %li/%i first %li buffer %lu; frame_outs=%li", (long)mh->num, mh->to_decode, (long)mh->firstframe, (unsigned long)mh->buffer.fill, (long)frame_outs(mh, mh->num));
debug5("tell: %li/%i first %li buffer %lu; INT123_frame_outs=%li", (long)mh->num, mh->to_decode, (long)mh->firstframe, (unsigned long)mh->buffer.fill, (long)INT123_frame_outs(mh, mh->num));
{ /* Funny block to keep C89 happy. */
off_t pos = 0;
int64_t pos = 0;
if((mh->num < mh->firstframe) || (mh->num == mh->firstframe && mh->to_decode))
{ /* We are at the beginning, expect output from firstframe on. */
pos = frame_outs(mh, mh->firstframe);
pos = INT123_frame_outs(mh, mh->firstframe);
#ifdef GAPLESS
pos += mh->firstoff;
#endif
}
else if(mh->to_decode)
{ /* We start fresh with this frame. Buffer should be empty, but we make sure to count it in. */
pos = frame_outs(mh, mh->num) - bytes_to_samples(mh, mh->buffer.fill);
pos = INT123_frame_outs(mh, mh->num) - INT123_bytes_to_samples(mh, mh->buffer.fill);
}
else
{ /* We serve what we have in buffer and then the beginning of next frame... */
pos = frame_outs(mh, mh->num+1) - bytes_to_samples(mh, mh->buffer.fill);
pos = INT123_frame_outs(mh, mh->num+1) - INT123_bytes_to_samples(mh, mh->buffer.fill);
}
/* Substract padding and delay from the beginning. */
pos = SAMPLE_ADJUST(mh,pos);
......@@ -1288,7 +1330,7 @@ off_t attribute_align_arg mpg123_tell(mpg123_handle *mh)
}
}
off_t attribute_align_arg mpg123_tellframe(mpg123_handle *mh)
int64_t attribute_align_arg mpg123_tellframe64(mpg123_handle *mh)
{
if(mh == NULL) return MPG123_ERR;
if(mh->num < mh->firstframe) return mh->firstframe;
......@@ -1297,7 +1339,7 @@ off_t attribute_align_arg mpg123_tellframe(mpg123_handle *mh)
return mh->buffer.fill ? mh->num : mh->num + 1;
}
off_t attribute_align_arg mpg123_tell_stream(mpg123_handle *mh)
int64_t attribute_align_arg mpg123_tell_stream64(mpg123_handle *mh)
{
if(mh == NULL) return MPG123_ERR;
/* mh->rd is at least a bad_reader, so no worry. */
......@@ -1307,7 +1349,7 @@ off_t attribute_align_arg mpg123_tell_stream(mpg123_handle *mh)
static int do_the_seek(mpg123_handle *mh)
{
int b;
off_t fnum = SEEKFRAME(mh);
int64_t fnum = SEEKFRAME(mh);
mh->buffer.fill = 0;
/* If we are inside the ignoreframe - firstframe window, we may get away without actual seeking. */
......@@ -1327,18 +1369,18 @@ static int do_the_seek(mpg123_handle *mh)
}
/* OK, real seeking follows... clear buffers and go for it. */
frame_buffers_reset(mh);
INT123_frame_buffers_reset(mh);
#ifndef NO_NTOM
if(mh->down_sample == 3)
{
ntom_set_ntom(mh, fnum);
debug3("fixed ntom for frame %"OFF_P" to %lu, num=%"OFF_P, (off_p)fnum, mh->ntom_val[0], (off_p)mh->num);
INT123_ntom_set_ntom(mh, fnum);
debug3("fixed ntom for frame %"PRIi64" to %lu, num=%"PRIi64, fnum, mh->INT123_ntom_val[0], mh->num);
}
#endif
b = mh->rd->seek_frame(mh, fnum);
if(mh->header_change > 1)
{
if(decode_update(mh) < 0) return MPG123_ERR;
if(INT123_decode_update(mh) < 0) return MPG123_ERR;
mh->header_change = 0;
}
debug1("seek_frame returned: %i", b);
......@@ -1350,12 +1392,12 @@ static int do_the_seek(mpg123_handle *mh)
return 0;
}
off_t attribute_align_arg mpg123_seek(mpg123_handle *mh, off_t sampleoff, int whence)
int64_t attribute_align_arg mpg123_seek64(mpg123_handle *mh, int64_t sampleoff, int whence)
{
int b;
off_t pos;
int64_t pos;
pos = mpg123_tell(mh); /* adjusted samples */
pos = mpg123_tell64(mh); /* adjusted samples */
/* pos < 0 also can mean that simply a former seek failed at the lower levels.
In that case, we only allow absolute seeks. */
if(pos < 0 && whence != SEEK_SET)
......@@ -1369,12 +1411,20 @@ off_t attribute_align_arg mpg123_seek(mpg123_handle *mh, off_t sampleoff, int wh
case SEEK_CUR: pos += sampleoff; break;
case SEEK_SET: pos = sampleoff; break;
case SEEK_END:
// Fix for a bug that existed since the beginning of libmpg123: SEEK_END offsets are
// also pointing forward for SEEK_END in lseek(). In libmpg123, they used to interpreted
// as positive from the end towards the beginning. Since just swapping the sign now would
// break existing programs and seeks beyond the end just don't make sense for a
// read-only library, we simply ignore the sign and always assumne negative offsets
// (pointing towards the beginning). Assuming INT64_MIN <= -INT64_MAX.
if(sampleoff > 0)
sampleoff = -sampleoff;
/* When we do not know the end already, we can try to find it. */
if(mh->track_frames < 1 && (mh->rdat.flags & READER_SEEKABLE))
mpg123_scan(mh);
if(mh->track_frames > 0) pos = SAMPLE_ADJUST(mh,frame_outs(mh, mh->track_frames)) - sampleoff;
if(mh->track_frames > 0) pos = SAMPLE_ADJUST(mh,INT123_frame_outs(mh, mh->track_frames)) + sampleoff;
#ifdef GAPLESS
else if(mh->end_os > 0) pos = SAMPLE_ADJUST(mh,mh->end_os) - sampleoff;
else if(mh->end_os > 0) pos = SAMPLE_ADJUST(mh,mh->end_os) + sampleoff;
#endif
else
{
......@@ -1386,11 +1436,11 @@ off_t attribute_align_arg mpg123_seek(mpg123_handle *mh, off_t sampleoff, int wh
}
if(pos < 0) pos = 0;
/* pos now holds the wanted sample offset in adjusted samples */
frame_set_seek(mh, SAMPLE_UNADJUST(mh,pos));
INT123_frame_set_seek(mh, SAMPLE_UNADJUST(mh,pos));
pos = do_the_seek(mh);
if(pos < 0) return pos;
return mpg123_tell(mh);
return mpg123_tell64(mh);
}
/*
......@@ -1398,13 +1448,18 @@ off_t attribute_align_arg mpg123_seek(mpg123_handle *mh, off_t sampleoff, int wh
All it can do is to ignore frames until the wanted one is there.
The caller doesn't know where a specific frame starts and mpg123 also only knows the general region after it scanned the file.
Well, it is tricky...
Wow, there was no input checking at all ... I'll better add it.
*/
off_t attribute_align_arg mpg123_feedseek(mpg123_handle *mh, off_t sampleoff, int whence, off_t *input_offset)
int64_t attribute_align_arg mpg123_feedseek64(mpg123_handle *mh, int64_t sampleoff, int whence, int64_t *input_offset)
{
int b;
off_t pos;
int64_t pos;
int64_t inoff = 0;
if(!mh)
return MPG123_BAD_HANDLE;
pos = mpg123_tell(mh); /* adjusted samples */
pos = mpg123_tell64(mh); /* adjusted samples */
debug3("seek from %li to %li (whence=%i)", (long)pos, (long)sampleoff, whence);
/* The special seek error handling does not apply here... there is no lowlevel I/O. */
if(pos < 0) return pos; /* mh == NULL is covered in mpg123_tell() */
......@@ -1422,7 +1477,7 @@ off_t attribute_align_arg mpg123_feedseek(mpg123_handle *mh, off_t sampleoff, in
case SEEK_CUR: pos += sampleoff; break;
case SEEK_SET: pos = sampleoff; break;
case SEEK_END:
if(mh->track_frames > 0) pos = SAMPLE_ADJUST(mh,frame_outs(mh, mh->track_frames)) - sampleoff;
if(mh->track_frames > 0) pos = SAMPLE_ADJUST(mh,INT123_frame_outs(mh, mh->track_frames)) - sampleoff;
#ifdef GAPLESS
else if(mh->end_os >= 0) pos = SAMPLE_ADJUST(mh,mh->end_os) - sampleoff;
#endif
......@@ -1435,32 +1490,35 @@ off_t attribute_align_arg mpg123_feedseek(mpg123_handle *mh, off_t sampleoff, in
default: mh->err = MPG123_BAD_WHENCE; return MPG123_ERR;
}
if(pos < 0) pos = 0;
frame_set_seek(mh, SAMPLE_UNADJUST(mh,pos));
INT123_frame_set_seek(mh, SAMPLE_UNADJUST(mh,pos));
pos = SEEKFRAME(mh);
mh->buffer.fill = 0;
/* Shortcuts without modifying input stream. */
*input_offset = mh->rdat.buffer.fileoff + mh->rdat.buffer.size;
inoff = mh->rdat.buffer.fileoff + mh->rdat.buffer.size;
if(mh->num < mh->firstframe) mh->to_decode = FALSE;
if(mh->num == pos && mh->to_decode) goto feedseekend;
if(mh->num == pos-1) goto feedseekend;
/* Whole way. */
*input_offset = feed_set_pos(mh, frame_index_find(mh, SEEKFRAME(mh), &pos));
inoff = INT123_feed_set_pos(mh, INT123_frame_index_find(mh, SEEKFRAME(mh), &pos));
mh->num = pos-1; /* The next read frame will have num = pos. */
if(*input_offset < 0) return MPG123_ERR;
if(input_offset)
*input_offset = inoff;
if(inoff < 0)
return MPG123_ERR;
feedseekend:
return mpg123_tell(mh);
return mpg123_tell64(mh);
#else
mh->err = MPG123_MISSING_FEATURE;
return MPG123_ERR;
#endif
}
off_t attribute_align_arg mpg123_seek_frame(mpg123_handle *mh, off_t offset, int whence)
int64_t attribute_align_arg mpg123_seek_frame64(mpg123_handle *mh, int64_t offset, int whence)
{
int b;
off_t pos = 0;
int64_t pos = 0;
if(mh == NULL) return MPG123_ERR;
if((b=init_track(mh)) < 0) return b;
......@@ -1486,14 +1544,14 @@ off_t attribute_align_arg mpg123_seek_frame(mpg123_handle *mh, off_t offset, int
if(pos < 0) pos = 0;
/* Not limiting the possible position on end for the chance that there might be more to the stream than announced via track_frames. */
frame_set_frameseek(mh, pos);
INT123_frame_set_frameseek(mh, pos);
pos = do_the_seek(mh);
if(pos < 0) return pos;
return mpg123_tellframe(mh);
return mpg123_tellframe64(mh);
}
int attribute_align_arg mpg123_set_filesize(mpg123_handle *mh, off_t size)
int attribute_align_arg mpg123_set_filesize64(mpg123_handle *mh, int64_t size)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
......@@ -1501,7 +1559,7 @@ int attribute_align_arg mpg123_set_filesize(mpg123_handle *mh, off_t size)
return MPG123_OK;
}
off_t attribute_align_arg mpg123_framelength(mpg123_handle *mh)
int64_t attribute_align_arg mpg123_framelength64(mpg123_handle *mh)
{
int b;
if(mh == NULL)
......@@ -1515,8 +1573,8 @@ off_t attribute_align_arg mpg123_framelength(mpg123_handle *mh)
{ /* A bad estimate. Ignoring tags 'n stuff. */
double bpf = mh->mean_framesize > 0.
? mh->mean_framesize
: compute_bpf(mh);
return (off_t)((double)(mh->rdat.filelen)/bpf+0.5);
: INT123_compute_bpf(mh);
return (int64_t)((double)(mh->rdat.filelen)/bpf+0.5);
}
/* Last resort: No view of the future, can at least count the frames that
were already parsed. */
......@@ -1526,10 +1584,10 @@ off_t attribute_align_arg mpg123_framelength(mpg123_handle *mh)
return MPG123_ERR;
}
off_t attribute_align_arg mpg123_length(mpg123_handle *mh)
int64_t attribute_align_arg mpg123_length64(mpg123_handle *mh)
{
int b;
off_t length;
int64_t length;
if(mh == NULL) return MPG123_ERR;
b = init_track(mh);
......@@ -1539,27 +1597,26 @@ off_t attribute_align_arg mpg123_length(mpg123_handle *mh)
else if(mh->rdat.filelen > 0) /* Let the case of 0 length just fall through. */
{
/* A bad estimate. Ignoring tags 'n stuff. */
double bpf = mh->mean_framesize ? mh->mean_framesize : compute_bpf(mh);
length = (off_t)((double)(mh->rdat.filelen)/bpf*mh->spf);
double bpf = mh->mean_framesize ? mh->mean_framesize : INT123_compute_bpf(mh);
length = (int64_t)((double)(mh->rdat.filelen)/bpf*mh->spf);
}
else if(mh->rdat.filelen == 0) return mpg123_tell(mh); /* we could be in feeder mode */
else if(mh->rdat.filelen == 0) return mpg123_tell64(mh); /* we could be in feeder mode */
else return MPG123_ERR; /* No length info there! */
debug1("mpg123_length: internal sample length: %"OFF_P, (off_p)length);
debug1("mpg123_length: internal sample length: %"PRIi64, length);
length = frame_ins2outs(mh, length);
debug1("mpg123_length: external sample length: %"OFF_P, (off_p)length);
length = INT123_frame_ins2outs(mh, length);
debug1("mpg123_length: external sample length: %"PRIi64, length);
length = SAMPLE_ADJUST(mh,length);
return length;
}
int attribute_align_arg mpg123_scan(mpg123_handle *mh)
{
int b;
off_t oldpos;
off_t track_frames = 0;
off_t track_samples = 0;
int64_t oldpos;
int64_t track_frames = 0;
int64_t track_samples = 0;
if(mh == NULL) return MPG123_BAD_HANDLE;
if(!(mh->rdat.flags & READER_SEEKABLE)){ mh->err = MPG123_NO_SEEK; return MPG123_ERR; }
......@@ -1572,7 +1629,7 @@ int attribute_align_arg mpg123_scan(mpg123_handle *mh)
if(b == MPG123_DONE) return MPG123_OK;
else return MPG123_ERR; /* Must be error here, NEED_MORE is not for seekable streams. */
}
oldpos = mpg123_tell(mh);
oldpos = mpg123_tell64(mh);
b = mh->rd->seek_frame(mh, 0);
if(b<0 || mh->num != 0) return MPG123_ERR;
/* One frame must be there now. */
......@@ -1581,19 +1638,20 @@ int attribute_align_arg mpg123_scan(mpg123_handle *mh)
debug("TODO: We should disable gapless code when encountering inconsistent mh->spf!");
debug(" ... at least unset MPG123_ACCURATE.");
/* Do not increment mh->track_frames in the loop as tha would confuse Frankenstein detection. */
while(read_frame(mh) == 1)
while(INT123_read_frame(mh) == 1)
{
++track_frames;
track_samples += mh->spf;
}
mh->track_frames = track_frames;
mh->track_samples = track_samples;
debug2("Scanning yielded %"OFF_P" track samples, %"OFF_P" frames.", (off_p)mh->track_samples, (off_p)mh->track_frames);
debug2("Scanning yielded %"PRIi64" track samples, %"PRIi64" frames."
, mh->track_samples, mh->track_frames);
#ifdef GAPLESS
/* Also, think about usefulness of that extra value track_samples ... it could be used for consistency checking. */
if(mh->p.flags & MPG123_GAPLESS) frame_gapless_update(mh, mh->track_samples);
if(mh->p.flags & MPG123_GAPLESS) INT123_frame_gapless_update(mh, mh->track_samples);
#endif
return mpg123_seek(mh, oldpos, SEEK_SET) >= 0 ? MPG123_OK : MPG123_ERR;
return mpg123_seek64(mh, oldpos, SEEK_SET) >= 0 ? MPG123_OK : MPG123_ERR;
}
int attribute_align_arg mpg123_meta_check(mpg123_handle *mh)
......@@ -1606,8 +1664,8 @@ void attribute_align_arg mpg123_meta_free(mpg123_handle *mh)
{
if(mh == NULL) return;
reset_id3(mh);
reset_icy(&mh->icy);
INT123_reset_id3(mh);
INT123_reset_icy(&mh->icy);
}
int attribute_align_arg mpg123_id3(mpg123_handle *mh, mpg123_id3v1 **v1, mpg123_id3v2 **v2)
......@@ -1618,7 +1676,7 @@ int attribute_align_arg mpg123_id3(mpg123_handle *mh, mpg123_id3v1 **v1, mpg123_
if(mh->metaflags & MPG123_ID3)
{
id3_link(mh);
INT123_id3_link(mh);
if(v1 != NULL && mh->rdat.flags & READER_ID3TAG) *v1 = (mpg123_id3v1*) mh->id3buf;
if(v2 != NULL)
#ifdef NO_ID3V2
......@@ -1677,7 +1735,7 @@ int attribute_align_arg mpg123_icy(mpg123_handle *mh, char **icy_meta)
char* attribute_align_arg mpg123_icy2utf8(const char* icy_text)
{
#ifndef NO_ICY
return icy2utf8(icy_text, 0);
return INT123_icy2utf8(icy_text, 0);
#else
return NULL;
#endif
......@@ -1709,18 +1767,18 @@ int attribute_align_arg mpg123_store_utf8(mpg123_string *sb, enum mpg123_text_en
#ifndef NO_ID3V2
/* The encodings we get from ID3v2 tags. */
case mpg123_text_utf8:
id3_to_utf8(sb, mpg123_id3_utf8, source, source_size, 0);
INT123_id3_to_utf8(sb, mpg123_id3_utf8, source, source_size, 0);
break;
case mpg123_text_latin1:
id3_to_utf8(sb, mpg123_id3_latin1, source, source_size, 0);
INT123_id3_to_utf8(sb, mpg123_id3_latin1, source, source_size, 0);
break;
case mpg123_text_utf16bom:
case mpg123_text_utf16:
id3_to_utf8(sb, mpg123_id3_utf16bom, source, source_size, 0);
INT123_id3_to_utf8(sb, mpg123_id3_utf16bom, source, source_size, 0);
break;
/* Special because one cannot skip zero bytes here. */
case mpg123_text_utf16be:
id3_to_utf8(sb, mpg123_id3_utf16be, source, source_size, 0);
INT123_id3_to_utf8(sb, mpg123_id3_utf16be, source, source_size, 0);
break;
#endif
#ifndef NO_ICY
......@@ -1733,7 +1791,7 @@ int attribute_align_arg mpg123_store_utf8(mpg123_string *sb, enum mpg123_text_en
if(source[source_size-1] == 0)
{
/* Convert from ICY encoding... with force applied or not. */
char *tmpstring = icy2utf8((const char*)source, enc == mpg123_text_cp1252 ? 1 : 0);
char *tmpstring = INT123_icy2utf8((const char*)source, enc == mpg123_text_cp1252 ? 1 : 0);
if(tmpstring != NULL)
{
mpg123_set_string(sb, tmpstring);
......@@ -1756,9 +1814,7 @@ int attribute_align_arg mpg123_store_utf8_2(mpg123_string *sb, int enc, const un
}
#endif
int attribute_align_arg mpg123_index(mpg123_handle *mh, off_t **offsets, off_t *step, size_t *fill)
int attribute_align_arg mpg123_index64(mpg123_handle *mh, int64_t **offsets, int64_t *step, size_t *fill)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
if(offsets == NULL || step == NULL || fill == NULL)
......@@ -1778,7 +1834,7 @@ int attribute_align_arg mpg123_index(mpg123_handle *mh, off_t **offsets, off_t *
return MPG123_OK;
}
int attribute_align_arg mpg123_set_index(mpg123_handle *mh, off_t *offsets, off_t step, size_t fill)
int attribute_align_arg mpg123_set_index64(mpg123_handle *mh, int64_t *offsets, int64_t step, size_t fill)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
#ifdef FRAME_INDEX
......@@ -1787,7 +1843,7 @@ int attribute_align_arg mpg123_set_index(mpg123_handle *mh, off_t *offsets, off_
mh->err = MPG123_BAD_INDEX_PAR;
return MPG123_ERR;
}
if(fi_set(&mh->index, offsets, step, fill) == -1)
if(INT123_fi_set(&mh->index, offsets, step, fill) == -1)
{
mh->err = MPG123_OUT_OF_MEM;
return MPG123_ERR;
......@@ -1799,6 +1855,7 @@ int attribute_align_arg mpg123_set_index(mpg123_handle *mh, off_t *offsets, off_
#endif
}
int attribute_align_arg mpg123_close(mpg123_handle *mh)
{
if(mh == NULL) return MPG123_BAD_HANDLE;
......@@ -1809,11 +1866,11 @@ int attribute_align_arg mpg123_close(mpg123_handle *mh)
if(mh->new_format)
{
debug("Hey, we are closing a track before the new format has been queried...");
invalidate_format(&mh->af);
INT123_invalidate_format(&mh->af);
mh->new_format = 0;
}
/* Always reset the frame buffers on close, so we cannot forget it in funky opening routines (wrappers, even). */
frame_reset(mh);
INT123_frame_reset(mh);
return MPG123_OK;
}
......@@ -1822,7 +1879,10 @@ void attribute_align_arg mpg123_delete(mpg123_handle *mh)
if(mh != NULL)
{
mpg123_close(mh);
frame_exit(mh); /* free buffers in frame */
#ifndef PORTABLE_API
INT123_wrap_destroy(mh->wrapperdata);
#endif
INT123_frame_exit(mh); /* free buffers in frame */
free(mh); /* free struct; cast? */
}
}
......@@ -1858,7 +1918,7 @@ static const char *mpg123_error[] =
"Build does not support stream timeouts. (code 21)",
"File access error. (code 22)",
"Seek not supported by stream. (code 23)",
"No stream opened. (code 24)",
"No stream opened or missing reader setup while opening. (code 24)",
"Bad parameter handle. (code 25)",
"Invalid parameter addresses for index retrieval. (code 26)",
"Lost track in the bytestream and did not attempt resync. (code 27)",
......@@ -1910,3 +1970,22 @@ const char* attribute_align_arg mpg123_strerror(mpg123_handle *mh)
{
return mpg123_plain_strerror(mpg123_errcode(mh));
}
#ifndef PORTABLE_API
// Isolation of lfs_wrap.c code, limited hook to get at its data and
// for storing error codes.
void ** INT123_wrap_handle(mpg123_handle *mh)
{
if(mh == NULL)
return NULL;
return &(mh->wrapperdata);
}
int INT123_set_err(mpg123_handle *mh, int err)
{
if(mh)
mh->err = err;
return MPG123_ERR;
}
#endif
/*
libmpg123: MPEG Audio Decoder library (version 1.31.1)
libmpg123: MPEG Audio Decoder library
copyright 1995-2015 by the mpg123 project
copyright 1995-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
*/
......@@ -9,17 +9,17 @@
#ifndef MPG123_LIB_H
#define MPG123_LIB_H
#include <fmt123.h>
#include "fmt123.h"
/** \file mpg123.h The header file for the libmpg123 MPEG Audio decoder */
/** A macro to check at compile time which set of API functions to expect.
* This should be incremented at least each time a new symbol is added
* This must be incremented at least each time a new symbol is added
* to the header.
*/
#ifndef MPG123_API_VERSION
#define MPG123_API_VERSION 47
#endif
#define MPG123_API_VERSION 48
/** library patch level at client build time */
#define MPG123_PATCHLEVEL 0
#ifndef MPG123_EXPORT
/** Defines needed for MS Visual Studio(tm) DLL builds.
......@@ -71,49 +71,37 @@
#endif
/* You can use this file directly, avoiding the autoconf replacements.
Might have to set MPG123_NO_LARGENAME, too, in case you have
_FILE_OFFSET_BITS defined where it does not make sense. */
#ifndef MPG123_NO_CONFIGURE
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#ifndef MPG123_PORTABLE_API
#include <sys/types.h>
/* A little hack to help MSVC not having ssize_t. */
#ifdef _MSC_VER
#include <stddef.h>
typedef ptrdiff_t mpg123_ssize_t;
#else
typedef ssize_t mpg123_ssize_t;
#endif
/* You can always enforce largefile hackery by setting MPG123_LARGESUFFIX. */
/* Otherwise, this header disables it if the build system decided so. */
#if !defined(MPG123_LARGESUFFIX) && 0
#ifndef MPG123_NO_LARGENAME
#define MPG123_NO_LARGENAME
#endif
#endif
#endif /* MPG123_NO_CONFIGURE */
/* Simplified large file handling.
I used to have a check here that prevents building for a library with conflicting large file setup
(application that uses 32 bit offsets with library that uses 64 bits).
While that was perfectly fine in an environment where there is one incarnation of the library,
it hurt GNU/Linux and Solaris systems with multilib where the distribution fails to provide the
correct header matching the 32 bit library (where large files need explicit support) or
the 64 bit library (where there is no distinction).
/* Handling of large file offsets.
When client code defines _FILE_OFFSET_BITS, it wants non-default large file support,
and thus functions with added suffix (mpg123_open_64). The default library build provides
wrapper and alias functions to accomodate client code variations (dual-mode library like glibc).
New approach: When the app defines _FILE_OFFSET_BITS, it wants non-default large file support,
and thus functions with added suffix (mpg123_open_64).
Any mismatch will be caught at link time because of the _FILE_OFFSET_BITS setting used when
building libmpg123. Plus, there's dual mode large file support in mpg123 since 1.12 now.
Link failure is not the expected outcome of any half-sane usage anymore.
Client code can definie MPG123_NO_LARGENAME and MPG123_LARGESUFFIX, respectively, for disabling
or enforcing the suffixes. If explicit usage of 64 bit offsets is desired, the int64_t API
(functions with 64 suffix without underscore, notablly mpg123_reader64()) can be used since
API version 48 (mpg123 1.32).
More complication: What about client code defining _LARGEFILE64_SOURCE? It might want direct access to the _64 functions, along with the ones without suffix. Well, that's possible now via defining MPG123_NO_LARGENAME and MPG123_LARGESUFFIX, respectively, for disabling or enforcing the suffix names.
When in doubt, use the explicit 64 bit functions and avoid off_t in the API. You can define
MPG123_PORTABLE_API to ensure that. That being said, if you and your compiler do not have
problems with the concept of off_t, just use the normal API and be happy. Both 32 and 64
bit versions will be present where appropriate.
*/
#ifndef MPG123_PORTABLE_API
/*
Now, the renaming of large file aware functions.
By default, it appends underscore _FILE_OFFSET_BITS (so, mpg123_seek_64 for mpg123_seek), if _FILE_OFFSET_BITS is defined. You can force a different suffix via MPG123_LARGESUFFIX (that must include the underscore), or you can just disable the whole mess by defining MPG123_NO_LARGENAME.
......@@ -152,6 +140,7 @@ typedef ssize_t mpg123_ssize_t;
#define mpg123_framepos MPG123_LARGENAME(mpg123_framepos)
#endif /* largefile hackery */
#endif
#ifdef __cplusplus
extern "C" {
......@@ -174,6 +163,21 @@ struct mpg123_handle_struct;
*/
typedef struct mpg123_handle_struct mpg123_handle;
/** Get version of the mpg123 distribution this library build came with.
* (optional means non-NULL)
* \param major optional address to store major version number
* \param minor optional address to store minor version number
* \param patch optional address to store patchlevel version number
* \return full version string (like "1.2.3-beta4 (experimental)")
*/
const char *mpg123_distversion(unsigned int *major, unsigned int *minor, unsigned int *patch);
/** Get API version of library build.
* \param patch optional address to store patchlevel
* \return API version of library
*/
unsigned int mpg123_libversion(unsigned int *patch);
/** Useless no-op that used to do initialization work.
*
* For API version before 46 (mpg123 1.27.0), you had to ensure to have
......@@ -488,7 +492,7 @@ enum mpg123_errors
MPG123_NO_TIMEOUT, /**< Build does not support stream timeouts. */
MPG123_BAD_FILE, /**< File access error. */
MPG123_NO_SEEK, /**< Seek not supported by stream. */
MPG123_NO_READER, /**< No stream opened. */
MPG123_NO_READER, /**< No stream opened or no reader callback setup. */
MPG123_BAD_PARS, /**< Bad parameter handle. */
MPG123_BAD_INDEX_PAR, /**< Bad parameters to mpg123_index() and mpg123_set_index() */
MPG123_OUT_OF_SYNC, /**< Lost track in bytestream and did not try to resync. */
......@@ -711,6 +715,7 @@ MPG123_EXPORT int mpg123_getformat2( mpg123_handle *mh
* @{
*/
#ifndef MPG123_PORTABLE_API
/** Open a simple MPEG file with fixed properties.
*
* This function shall simplify the common use case of a plain MPEG
......@@ -781,10 +786,12 @@ MPG123_EXPORT int mpg123_open(mpg123_handle *mh, const char *path);
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_open_fd(mpg123_handle *mh, int fd);
#endif
/** Use an opaque handle as bitstream input. This works only with the
* replaced I/O from mpg123_replace_reader_handle()!
* mpg123_close() will call the cleanup callback for your handle (if you gave one).
* replaced I/O from mpg123_replace_reader_handle() or mpg123_reader64()!
* mpg123_close() will call the cleanup callback for your non-NULL
* handle (if you gave one).
* \param mh handle
* \param iohandle your handle
* \return MPG123_OK on success
......@@ -853,6 +860,7 @@ MPG123_EXPORT int mpg123_decode( mpg123_handle *mh
, const unsigned char *inmemory, size_t inmemsize
, void *outmemory, size_t outmemsize, size_t *done );
#ifndef MPG123_PORTABLE_API
/** Decode next MPEG frame to internal buffer
* or read a frame and return after setting a new format.
* \param mh handle
......@@ -875,6 +883,30 @@ MPG123_EXPORT int mpg123_decode_frame( mpg123_handle *mh
*/
MPG123_EXPORT int mpg123_framebyframe_decode( mpg123_handle *mh
, off_t *num, unsigned char **audio, size_t *bytes );
#endif /* un-portable API */
/** Decode next MPEG frame to internal buffer
* or read a frame and return after setting a new format.
* \param mh handle
* \param num current frame offset gets stored there
* \param audio This pointer is set to the internal buffer to read the decoded audio from.
* \param bytes number of output bytes ready in the buffer
* \return MPG123_OK or error/message code
*/
MPG123_EXPORT int mpg123_decode_frame64( mpg123_handle *mh
, int64_t *num, unsigned char **audio, size_t *bytes );
/** Decode current MPEG frame to internal buffer.
* Warning: This is experimental API that might change in future releases!
* Please watch mpg123 development closely when using it.
* \param mh handle
* \param num last frame offset gets stored there
* \param audio this pointer is set to the internal buffer to read the decoded audio from.
* \param bytes number of output bytes ready in the buffer
* \return MPG123_OK or error/message code
*/
MPG123_EXPORT int mpg123_framebyframe_decode64( mpg123_handle *mh
, int64_t *num, unsigned char **audio, size_t *bytes );
/** Find, read and parse the next mp3 frame
* Warning: This is experimental API that might change in future releases!
......@@ -902,6 +934,7 @@ MPG123_EXPORT int mpg123_framebyframe_next(mpg123_handle *mh);
MPG123_EXPORT int mpg123_framedata( mpg123_handle *mh
, unsigned long *header, unsigned char **bodydata, size_t *bodybytes );
#ifndef MPG123_PORTABLE_API
/** Get the input position (byte offset in stream) of the last parsed frame.
* This can be used for external seek index building, for example.
* It just returns the internally stored offset, regardless of validity --
......@@ -910,6 +943,16 @@ MPG123_EXPORT int mpg123_framedata( mpg123_handle *mh
* \return byte offset in stream
*/
MPG123_EXPORT off_t mpg123_framepos(mpg123_handle *mh);
#endif
/** Get the 64 bit input position (byte offset in stream) of the last parsed frame.
* This can be used for external seek index building, for example.
* It just returns the internally stored offset, regardless of validity --
* you ensure that a valid frame has been parsed before!
* \param mh handle
* \return byte offset in stream
*/
MPG123_EXPORT int64_t mpg123_framepos64(mpg123_handle *mh);
/** @} */
......@@ -936,6 +979,12 @@ MPG123_EXPORT off_t mpg123_framepos(mpg123_handle *mh);
* - SEEK_CUR: change position by offset from now
* - SEEK_END: set position to offset from end
*
* Since API version 48 (mpg123 1.32), the offset given with SEEK_END is always
* taken to be negative in the terms of standard lseek(). You can only seek from
* the end towards the beginning. All earlier versions had the sign wrong, positive
* was towards the beginning, negative past the end (which results in error,
* anyway).
*
* Note that sample-accurate seek only works when gapless support has been
* enabled at compile time; seek is frame-accurate otherwise.
* Also, really sample-accurate seeking (meaning that you get the identical
......@@ -956,57 +1005,131 @@ MPG123_EXPORT off_t mpg123_framepos(mpg123_handle *mh);
* @{
*/
#ifndef MPG123_PORTABLE_API
/** Returns the current position in samples.
* On the next successful read, you'd get audio data with that offset.
* \param mh handle
* \return sample (PCM frame) offset or MPG123_ERR (null handle)
*/
MPG123_EXPORT off_t mpg123_tell(mpg123_handle *mh);
#endif
/** Returns the current 64 bit position in samples.
* On the next successful read, you'd get audio data with that offset.
* \param mh handle
* \return sample (PCM frame) offset or MPG123_ERR (null handle)
*/
MPG123_EXPORT int64_t mpg123_tell64(mpg123_handle *mh);
#ifndef MPG123_PORTABLE_API
/** Returns the frame number that the next read will give you data from.
* \param mh handle
* \return frame offset or MPG123_ERR (null handle)
*/
MPG123_EXPORT off_t mpg123_tellframe(mpg123_handle *mh);
#endif
/** Returns the 64 bit frame number that the next read will give you data from.
* \param mh handle
* \return frame offset or MPG123_ERR (null handle)
*/
MPG123_EXPORT int64_t mpg123_tellframe64(mpg123_handle *mh);
#ifndef MPG123_PORTABLE_API
/** Returns the current byte offset in the input stream.
* \param mh handle
* \return byte offset or MPG123_ERR (null handle)
*/
MPG123_EXPORT off_t mpg123_tell_stream(mpg123_handle *mh);
#endif
/** Returns the current 64 bit byte offset in the input stream.
* \param mh handle
* \return byte offset or MPG123_ERR (null handle)
*/
MPG123_EXPORT int64_t mpg123_tell_stream64(mpg123_handle *mh);
#ifndef MPG123_PORTABLE_API
/** Seek to a desired sample offset.
* Usage is modelled afer the standard lseek().
* \param mh handle
* \param sampleoff offset in samples (PCM frames)
* \param whence one of SEEK_SET, SEEK_CUR or SEEK_END
* (Offset for SEEK_END is always effectively negative since API
* version 48, was inverted from lseek() usage since ever before.)
* \return The resulting offset >= 0 or error/message code
*/
MPG123_EXPORT off_t mpg123_seek( mpg123_handle *mh
, off_t sampleoff, int whence );
#endif
/** Seek to a desired 64 bit sample offset.
* Usage is modelled afer the standard lseek().
* \param mh handle
* \param sampleoff offset in samples (PCM frames)
* \param whence one of SEEK_SET, SEEK_CUR or SEEK_END
* (Offset for SEEK_END is always effectively negative.)
* \return The resulting offset >= 0 or error/message code
*/
MPG123_EXPORT int64_t mpg123_seek64( mpg123_handle *mh
, int64_t sampleoff, int whence );
#ifndef MPG123_PORTABLE_API
/** Seek to a desired sample offset in data feeding mode.
* This just prepares things to be right only if you ensure that the next chunk
* of input data will be from input_offset byte position.
* \param mh handle
* \param sampleoff offset in samples (PCM frames)
* \param whence one of SEEK_SET, SEEK_CUR or SEEK_END
* (Offset for SEEK_END is always effectively negative since API
* version 48, was inverted from lseek() usage since ever before.)
* \param input_offset The position it expects to be at the
* next time data is fed to mpg123_decode().
* \return The resulting offset >= 0 or error/message code
*/
MPG123_EXPORT off_t mpg123_feedseek( mpg123_handle *mh
, off_t sampleoff, int whence, off_t *input_offset );
#endif
/** Seek to a desired 64 bit sample offset in data feeding mode.
* This just prepares things to be right only if you ensure that the next chunk
* of input data will be from input_offset byte position.
* \param mh handle
* \param sampleoff offset in samples (PCM frames)
* \param whence one of SEEK_SET, SEEK_CUR or SEEK_END
* (Offset for SEEK_END is always effectively negative.)
* \param input_offset The position it expects to be at the
* next time data is fed to mpg123_decode().
* \return The resulting offset >= 0 or error/message code
*/
MPG123_EXPORT int64_t mpg123_feedseek64( mpg123_handle *mh
, int64_t sampleoff, int whence, int64_t *input_offset );
#ifndef MPG123_PORTABLE_API
/** Seek to a desired MPEG frame offset.
* Usage is modelled afer the standard lseek().
* \param mh handle
* \param frameoff offset in MPEG frames
* \param whence one of SEEK_SET, SEEK_CUR or SEEK_END
* (Offset for SEEK_END is always effectively negative since API
* version 48, was inverted from lseek() usage since ever before.)
* \return The resulting offset >= 0 or error/message code */
MPG123_EXPORT off_t mpg123_seek_frame( mpg123_handle *mh
, off_t frameoff, int whence );
#endif
/** Seek to a desired 64 bit MPEG frame offset.
* Usage is modelled afer the standard lseek().
* \param mh handle
* \param frameoff offset in MPEG frames
* \param whence one of SEEK_SET, SEEK_CUR or SEEK_END
* (Offset for SEEK_END is always effectively negative.)
* \return The resulting offset >= 0 or error/message code */
MPG123_EXPORT int64_t mpg123_seek_frame64( mpg123_handle *mh
, int64_t frameoff, int whence );
#ifndef MPG123_PORTABLE_API
/** Return a MPEG frame offset corresponding to an offset in seconds.
* This assumes that the samples per frame do not change in the file/stream, which is a good assumption for any sane file/stream only.
* \return frame offset >= 0 or error/message code */
......@@ -1014,7 +1137,9 @@ MPG123_EXPORT off_t mpg123_timeframe(mpg123_handle *mh, double sec);
/** Give access to the frame index table that is managed for seeking.
* You are asked not to modify the values... Use mpg123_set_index to set the
* seek index
* seek index.
* Note: This can be just a copy of the data in case a conversion is done
* from the internal 64 bit values.
* \param mh handle
* \param offsets pointer to the index array
* \param step one index byte offset advances this many MPEG frames
......@@ -1023,10 +1148,31 @@ MPG123_EXPORT off_t mpg123_timeframe(mpg123_handle *mh, double sec);
*/
MPG123_EXPORT int mpg123_index( mpg123_handle *mh
, off_t **offsets, off_t *step, size_t *fill );
#endif
/** Return a 64 bit MPEG frame offset corresponding to an offset in seconds.
* This assumes that the samples per frame do not change in the file/stream, which is a good assumption for any sane file/stream only.
* \return frame offset >= 0 or error/message code */
MPG123_EXPORT int64_t mpg123_timeframe64(mpg123_handle *mh, double sec);
/** Give access to the 64 bit frame index table that is managed for seeking.
* You are asked not to modify the values... Use mpg123_set_index to set the
* seek index.
* \param mh handle
* \param offsets pointer to the index array
* \param step one index byte offset advances this many MPEG frames
* \param fill number of recorded index offsets; size of the array
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_index64( mpg123_handle *mh
, int64_t **offsets, int64_t *step, size_t *fill );
#ifndef MPG123_PORTABLE_API
/** Set the frame index table
* Setting offsets to NULL and fill > 0 will allocate fill entries. Setting offsets
* to NULL and fill to 0 will clear the index and free the allocated memory used by the index.
* Note that this function might involve conversion/copying of data because of
* the varying nature of off_t. Better use mpg123_set_index64().
* \param mh handle
* \param offsets pointer to the index array
* \param step one index byte offset advances this many MPEG frames
......@@ -1035,15 +1181,31 @@ MPG123_EXPORT int mpg123_index( mpg123_handle *mh
*/
MPG123_EXPORT int mpg123_set_index( mpg123_handle *mh
, off_t *offsets, off_t step, size_t fill );
#endif
/** Set the 64 bit frame index table
* Setting offsets to NULL and fill > 0 will allocate fill entries. Setting offsets
* to NULL and fill to 0 will clear the index and free the allocated memory used by the index.
* \param mh handle
* \param offsets pointer to the index array
* \param step one index byte offset advances this many MPEG frames
* \param fill number of recorded index offsets; size of the array
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_set_index64( mpg123_handle *mh
, int64_t *offsets, int64_t step, size_t fill );
#ifndef MPG123_PORTABLE_API
/** An old crutch to keep old mpg123 binaries happy.
* WARNING: This function is there only to avoid runtime linking errors with
* standalone mpg123 before version 1.23.0 (if you strangely update the
* standalone mpg123 before version 1.32.0 (if you strangely update the
* library but not the end-user program) and actually is broken
* for various cases (p.ex. 24 bit output). Do never use. It might eventually
* be purged from the library.
*/
MPG123_EXPORT int mpg123_position( mpg123_handle *mh, off_t frame_offset, off_t buffered_bytes, off_t *current_frame, off_t *frames_left, double *current_seconds, double *seconds_left);
MPG123_EXPORT int mpg123_position( mpg123_handle *mh, off_t INT123_frame_offset, off_t buffered_bytes, off_t *current_frame, off_t *frames_left, double *current_seconds, double *seconds_left);
#endif
/** @} */
......@@ -1333,6 +1495,7 @@ MPG123_EXPORT size_t mpg123_safe_buffer(void);
*/
MPG123_EXPORT int mpg123_scan(mpg123_handle *mh);
#ifndef MPG123_PORTABLE_API
/** Return, if possible, the full (expected) length of current track in
* MPEG frames.
* \param mh handle
......@@ -1361,6 +1524,36 @@ MPG123_EXPORT off_t mpg123_length(mpg123_handle *mh);
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_set_filesize(mpg123_handle *mh, off_t size);
#endif
/** Return, if possible, the full (expected) length of current track in
* MPEG frames as 64 bit number.
* \param mh handle
* \return length >= 0 or MPG123_ERR if there is no length guess possible.
*/
MPG123_EXPORT int64_t mpg123_framelength64(mpg123_handle *mh);
/** Return, if possible, the full (expected) length of current
* track in samples (PCM frames) as 64 bit value.
*
* This relies either on an Info frame at the beginning or a previous
* call to mpg123_scan() to get the real number of MPEG frames in a
* file. It will guess based on file size if neither Info frame nor
* scan data are present. In any case, there is no guarantee that the
* decoder will not give you more data, for example in case the open
* file gets appended to during decoding.
* \param mh handle
* \return length >= 0 or MPG123_ERR if there is no length guess possible.
*/
MPG123_EXPORT int64_t mpg123_length64(mpg123_handle *mh);
/** Override the 64 bit value for file size in bytes.
* Useful for getting sensible track length values in feed mode or for HTTP streams.
* \param mh handle
* \param size file size in bytes
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_set_filesize64(mpg123_handle *mh, int64_t size);
/** Get MPEG frame duration in seconds.
* \param mh handle
......@@ -1984,12 +2177,13 @@ MPG123_EXPORT int mpg123_replace_buffer(mpg123_handle *mh
*/
MPG123_EXPORT size_t mpg123_outblock(mpg123_handle *mh);
#ifndef MPG123_PORTABLE_API
/** Replace low-level stream access functions; read and lseek as known in POSIX.
* You can use this to make any fancy file opening/closing yourself,
* using mpg123_open_fd() to set the file descriptor for your read/lseek
* (doesn't need to be a "real" file descriptor...).
* Setting a function to NULL means that the default internal read is
* used (active from next mpg123_open call on).
* Setting a function to NULL means that just a call to POSIX read/lseek is
* done (without handling signals).
* Note: As it would be troublesome to mess with this while having a file open,
* this implies mpg123_close().
* \param mh handle
......@@ -2012,7 +2206,7 @@ MPG123_EXPORT int mpg123_replace_reader( mpg123_handle *mh
* \param mh handle
* \param r_read callback for reading (behaviour like POSIX read)
* \param r_lseek callback for seeking (like POSIX lseek)
* \param cleanup A callback to clean up an I/O handle on mpg123_close,
* \param cleanup A callback to clean up a non-NULL I/O handle on mpg123_close,
* can be NULL for none (you take care of cleaning your handles).
* \return MPG123_OK on success
*/
......@@ -2020,6 +2214,27 @@ MPG123_EXPORT int mpg123_replace_reader_handle( mpg123_handle *mh
, mpg123_ssize_t (*r_read) (void *, void *, size_t)
, off_t (*r_lseek)(void *, off_t, int)
, void (*cleanup)(void*) );
#endif
/** Set up portable read functions on an opaque handle.
* The handle is a void pointer, so you can pass any data you want...
* mpg123_open_handle() is the call you make to use the I/O defined here.
* There is no fallback to internal read/seek here.
* Note: As it would be troublesome to mess with this while having a file open,
* this mpg123_close() is implied here.
* \param mh handle
* \param r_read callback for reading
* The parameters are the handle, the buffer to read into, a byte count to read,
* address to store the returned byte count. Return value is zero for
* no issue, non-zero for some error. Recoverable signal handling has to happen
* inside the callback.
* \param r_lseek callback for seeking (like POSIX lseek), maybe NULL for
* non-seekable streams
* \param cleanup A callback to clean up a non-NULL I/O handle on mpg123_close,
* maybe NULL for none
* \return MPG123_OK on success
*/
MPG123_EXPORT int mpg123_reader64( mpg123_handle *mh, int (*r_read) (void *, void *, size_t, size_t *), int64_t (*r_lseek)(void *, int64_t, int), void (*cleanup)(void*) );
/** @} */
......
/*
mpg123lib_intern: Common non-public stuff for libmpg123
copyright 1995-2021 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1995-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
derived from the old mpg123.h
......@@ -14,15 +14,14 @@
#define MPG123_ENCODINGS 12
#include "config.h" /* Load this before _anything_ */
#include "intsym.h" /* Prefixing of internal symbols that still are public in a static lib. */
#include "abi_align.h"
/* export DLL symbols */
#if defined(WIN32) && defined(DYNAMIC_BUILD)
#define BUILD_MPG123_DLL
#endif
#include "compat.h"
// Only portable API plays a role in the library itself, outside of lfs_wrap.c.
// Also, we need to ensure no suffix renaming for the primary implementations.
#define MPG123_PORTABLE_API
#define MPG123_ENUM_API
#include "mpg123.h"
......@@ -321,17 +320,17 @@ static inline int32_t scale_rounded(int32_t x, int shift)
#define VERBOSE4 (NOQUIET && fr->p.verbose > 3)
#define PVERB(mp, level) (!((mp)->flags & MPG123_QUIET) && (mp)->verbose >= (level))
int decode_update(mpg123_handle *mh);
int INT123_decode_update(mpg123_handle *mh);
/* residing in format.c */
off_t decoder_synth_bytes(mpg123_handle *fr , off_t s);
off_t samples_to_bytes(mpg123_handle *fr , off_t s);
off_t bytes_to_samples(mpg123_handle *fr , off_t b);
off_t outblock_bytes(mpg123_handle *fr, off_t s);
int64_t INT123_decoder_synth_bytes(mpg123_handle *fr , int64_t s);
int64_t INT123_samples_to_bytes(mpg123_handle *fr , int64_t s);
int64_t INT123_bytes_to_samples(mpg123_handle *fr , int64_t b);
int64_t INT123_outblock_bytes(mpg123_handle *fr, int64_t s);
/* Postprocessing format conversion of freshly decoded buffer. */
void postprocess_buffer(mpg123_handle *fr);
void INT123_postprocess_buffer(mpg123_handle *fr);
int open_fixed_pre(mpg123_handle *mh, int channels, int encoding);
int open_fixed_post(mpg123_handle *mh, int channels, int encoding);
int INT123_open_fixed_pre(mpg123_handle *mh, int channels, int encoding);
int INT123_open_fixed_post(mpg123_handle *mh, int channels, int encoding);
/* If networking is enabled and we really mean internal networking, the timeout_read function is available. */
#if defined (NETWORK) && !defined (WANT_WIN32_SOCKETS)
......
/*
ntom.c: N->M down/up sampling; the setup code.
copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1995-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp
*/
#define SAFE_NTOM /* Do not depend on off_t*off_t with big values still being in the range... */
#define SAFE_NTOM /* Do not depend on int64_t*int64_t with big values still being in the range... */
#include "mpg123lib_intern.h"
#include "debug.h"
int synth_ntom_set_step(mpg123_handle *fr)
int INT123_synth_ntom_set_step(mpg123_handle *fr)
{
long m,n;
m = frame_freq(fr);
m = INT123_frame_freq(fr);
n = fr->af.rate;
if(VERBOSE2)
fprintf(stderr,"Init rate converter: %ld->%ld\n",m,n);
......@@ -33,21 +33,21 @@ int synth_ntom_set_step(mpg123_handle *fr)
return -1;
}
fr->ntom_val[0] = fr->ntom_val[1] = ntom_val(fr, fr->num);
fr->INT123_ntom_val[0] = fr->INT123_ntom_val[1] = INT123_ntom_val(fr, fr->num);
return 0;
}
/*
The SAFE_NTOM does iterative loops instead of straight multiplication.
The safety is not just about the algorithm closely mimicking the decoder instead of applying some formula,
it is more about avoiding multiplication of possibly big sample offsets (a 32bit off_t could overflow too easily).
it is more about avoiding multiplication of possibly big sample offsets (a 32bit int64_t could overflow too easily).
*/
unsigned long ntom_val(mpg123_handle *fr, off_t frame)
unsigned long INT123_ntom_val(mpg123_handle *fr, int64_t frame)
{
off_t ntm;
int64_t ntm;
#ifdef SAFE_NTOM /* Carry out the loop, without the threatening integer overflow. */
off_t f;
int64_t f;
ntm = NTOM_MUL>>1; /* for frame 0 */
for(f=0; f<frame; ++f) /* for frame > 0 */
{
......@@ -63,29 +63,29 @@ unsigned long ntom_val(mpg123_handle *fr, off_t frame)
/* Set the ntom value for next expected frame to be decoded.
This is for keeping output consistent across seeks. */
void ntom_set_ntom(mpg123_handle *fr, off_t num)
void INT123_ntom_set_ntom(mpg123_handle *fr, int64_t num)
{
fr->ntom_val[1] = fr->ntom_val[0] = ntom_val(fr, num);
fr->INT123_ntom_val[1] = fr->INT123_ntom_val[0] = INT123_ntom_val(fr, num);
}
/* Carry out the ntom sample count operation for this one frame.
No fear of integer overflow here. */
off_t ntom_frame_outsamples(mpg123_handle *fr)
int64_t INT123_ntom_frame_outsamples(mpg123_handle *fr)
{
/* The do this before decoding the separate channels, so there is only one common ntom value. */
int ntm = fr->ntom_val[0];
int ntm = fr->INT123_ntom_val[0];
ntm += fr->spf*fr->ntom_step;
return ntm/NTOM_MUL;
}
/* Convert frame offset to unadjusted output sample offset. */
off_t ntom_frmouts(mpg123_handle *fr, off_t frame)
int64_t INT123_ntom_frmouts(mpg123_handle *fr, int64_t frame)
{
#ifdef SAFE_NTOM
off_t f;
int64_t f;
#endif
off_t soff = 0;
off_t ntm = ntom_val(fr,0);
int64_t soff = 0;
int64_t ntm = INT123_ntom_val(fr,0);
#ifdef SAFE_NTOM
if(frame <= 0) return 0;
for(f=0; f<frame; ++f)
......@@ -95,23 +95,23 @@ off_t ntom_frmouts(mpg123_handle *fr, off_t frame)
ntm -= (ntm/NTOM_MUL)*NTOM_MUL;
}
#else
soff = (ntm + frame*(off_t)fr->spf*(off_t)fr->ntom_step)/(off_t)NTOM_MUL;
soff = (ntm + frame*(int64_t)fr->spf*(int64_t)fr->ntom_step)/(int64_t)NTOM_MUL;
#endif
return soff;
}
/* Convert input samples to unadjusted output samples. */
off_t ntom_ins2outs(mpg123_handle *fr, off_t ins)
int64_t INT123_ntom_ins2outs(mpg123_handle *fr, int64_t ins)
{
off_t soff = 0;
off_t ntm = ntom_val(fr,0);
int64_t soff = 0;
int64_t ntm = INT123_ntom_val(fr,0);
#ifdef SAFE_NTOM
{
off_t block = fr->spf;
int64_t block = fr->spf;
if(ins <= 0) return 0;
do
{
off_t nowblock = ins > block ? block : ins;
int64_t nowblock = ins > block ? block : ins;
ntm += nowblock*fr->ntom_step;
soff += ntm/NTOM_MUL;
ntm -= (ntm/NTOM_MUL)*NTOM_MUL;
......@@ -119,18 +119,18 @@ off_t ntom_ins2outs(mpg123_handle *fr, off_t ins)
} while(ins > 0);
}
#else
/* Beware of overflows: when off_t is 32bits, the multiplication blows too easily.
/* Beware of overflows: when int64_t is 32bits, the multiplication blows too easily.
Of course, it blows for 64bits, too, in theory, but that's for _really_ large files. */
soff = ((off_t)ntm + (off_t)ins*(off_t)fr->ntom_step)/(off_t)NTOM_MUL;
soff = ((int64_t)ntm + (int64_t)ins*(int64_t)fr->ntom_step)/(int64_t)NTOM_MUL;
#endif
return soff;
}
/* Determine frame offset from unadjusted output sample offset. */
off_t ntom_frameoff(mpg123_handle *fr, off_t soff)
int64_t INT123_ntom_frameoff(mpg123_handle *fr, int64_t soff)
{
off_t ioff = 0; /* frames or samples */
off_t ntm = ntom_val(fr,0);
int64_t ioff = 0; /* frames or samples */
int64_t ntm = INT123_ntom_val(fr,0);
#ifdef SAFE_NTOM
if(soff <= 0) return 0;
for(ioff=0; 1; ++ioff)
......@@ -142,7 +142,7 @@ off_t ntom_frameoff(mpg123_handle *fr, off_t soff)
}
return ioff;
#else
ioff = (soff*(off_t)NTOM_MUL-ntm)/(off_t)fr->ntom_step;
return ioff/(off_t)fr->spf;
ioff = (soff*(int64_t)NTOM_MUL-ntm)/(int64_t)fr->ntom_step;
return ioff/(int64_t)fr->spf;
#endif
}
......@@ -63,13 +63,13 @@ static int synth_stereo_wrap(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr
static const struct synth_s synth_base =
{
{ /* plain */
OUT_SYNTHS(synth_1to1, synth_1to1_8bit, synth_1to1_real, synth_1to1_s32)
OUT_SYNTHS(INT123_synth_1to1, INT123_synth_1to1_8bit, INT123_synth_1to1_real, INT123_synth_1to1_s32)
# ifndef NO_DOWNSAMPLE
,OUT_SYNTHS(synth_2to1, synth_2to1_8bit, synth_2to1_real, synth_2to1_s32)
,OUT_SYNTHS(synth_4to1, synth_4to1_8bit, synth_4to1_real, synth_4to1_s32)
,OUT_SYNTHS(INT123_synth_2to1, INT123_synth_2to1_8bit, INT123_synth_2to1_real, INT123_synth_2to1_s32)
,OUT_SYNTHS(INT123_synth_4to1, INT123_synth_4to1_8bit, INT123_synth_4to1_real, INT123_synth_4to1_s32)
# endif
# ifndef NO_NTOM
,OUT_SYNTHS(synth_ntom, synth_ntom_8bit, synth_ntom_real, synth_ntom_s32)
,OUT_SYNTHS(INT123_synth_ntom, INT123_synth_ntom_8bit, INT123_synth_ntom_real, INT123_synth_ntom_s32)
# endif
},
{ /* stereo, by default only wrappers over plain synth */
......@@ -83,23 +83,23 @@ static const struct synth_s synth_base =
# endif
},
{ /* mono2stereo */
OUT_SYNTHS(synth_1to1_m2s, synth_1to1_8bit_m2s, synth_1to1_real_m2s, synth_1to1_s32_m2s)
OUT_SYNTHS(INT123_synth_1to1_m2s, INT123_synth_1to1_8bit_m2s, INT123_synth_1to1_real_m2s, INT123_synth_1to1_s32_m2s)
# ifndef NO_DOWNSAMPLE
,OUT_SYNTHS(synth_2to1_m2s, synth_2to1_8bit_m2s, synth_2to1_real_m2s, synth_2to1_s32_m2s)
,OUT_SYNTHS(synth_4to1_m2s, synth_4to1_8bit_m2s, synth_4to1_real_m2s, synth_4to1_s32_m2s)
,OUT_SYNTHS(INT123_synth_2to1_m2s, INT123_synth_2to1_8bit_m2s, INT123_synth_2to1_real_m2s, INT123_synth_2to1_s32_m2s)
,OUT_SYNTHS(INT123_synth_4to1_m2s, INT123_synth_4to1_8bit_m2s, INT123_synth_4to1_real_m2s, INT123_synth_4to1_s32_m2s)
# endif
# ifndef NO_NTOM
,OUT_SYNTHS(synth_ntom_m2s, synth_ntom_8bit_m2s, synth_ntom_real_m2s, synth_ntom_s32_m2s)
,OUT_SYNTHS(INT123_synth_ntom_m2s, INT123_synth_ntom_8bit_m2s, INT123_synth_ntom_real_m2s, INT123_synth_ntom_s32_m2s)
# endif
},
{ /* mono*/
OUT_SYNTHS(synth_1to1_mono, synth_1to1_8bit_mono, synth_1to1_real_mono, synth_1to1_s32_mono)
OUT_SYNTHS(INT123_synth_1to1_mono, INT123_synth_1to1_8bit_mono, INT123_synth_1to1_real_mono, INT123_synth_1to1_s32_mono)
# ifndef NO_DOWNSAMPLE
,OUT_SYNTHS(synth_2to1_mono, synth_2to1_8bit_mono, synth_2to1_real_mono, synth_2to1_s32_mono)
,OUT_SYNTHS(synth_4to1_mono, synth_4to1_8bit_mono, synth_4to1_real_mono, synth_4to1_s32_mono)
,OUT_SYNTHS(INT123_synth_2to1_mono, INT123_synth_2to1_8bit_mono, INT123_synth_2to1_real_mono, INT123_synth_2to1_s32_mono)
,OUT_SYNTHS(INT123_synth_4to1_mono, INT123_synth_4to1_8bit_mono, INT123_synth_4to1_real_mono, INT123_synth_4to1_s32_mono)
# endif
# ifndef NO_NTOM
,OUT_SYNTHS(synth_ntom_mono, synth_ntom_8bit_mono, synth_ntom_real_mono, synth_ntom_s32_mono)
,OUT_SYNTHS(INT123_synth_ntom_mono, INT123_synth_ntom_8bit_mono, INT123_synth_ntom_real_mono, INT123_synth_ntom_s32_mono)
#endif
}
};
......@@ -108,21 +108,21 @@ static const struct synth_s synth_base =
/* More plain synths for i386 */
const func_synth plain_i386[r_limit][f_limit] =
{ /* plain */
OUT_SYNTHS(synth_1to1_i386, synth_1to1_8bit_i386, synth_1to1_real_i386, synth_1to1_s32_i386)
OUT_SYNTHS(INT123_synth_1to1_i386, INT123_synth_1to1_8bit_i386, INT123_synth_1to1_real_i386, INT123_synth_1to1_s32_i386)
# ifndef NO_DOWNSAMPLE
,OUT_SYNTHS(synth_2to1_i386, synth_2to1_8bit_i386, synth_2to1_real_i386, synth_2to1_s32_i386)
,OUT_SYNTHS(synth_4to1_i386, synth_4to1_8bit_i386, synth_4to1_real_i386, synth_4to1_s32_i386)
,OUT_SYNTHS(INT123_synth_2to1_i386, INT123_synth_2to1_8bit_i386, INT123_synth_2to1_real_i386, INT123_synth_2to1_s32_i386)
,OUT_SYNTHS(INT123_synth_4to1_i386, INT123_synth_4to1_8bit_i386, INT123_synth_4to1_real_i386, INT123_synth_4to1_s32_i386)
# endif
# ifndef NO_NTOM
,OUT_SYNTHS(synth_ntom, synth_ntom_8bit, synth_ntom_real, synth_ntom_s32)
,OUT_SYNTHS(INT123_synth_ntom, INT123_synth_ntom_8bit, INT123_synth_ntom_real, INT123_synth_ntom_s32)
# endif
};
#endif
enum optdec defdec(void){ return defopt; }
enum optdec INT123_defdec(void){ return defopt; }
enum optcla decclass(const enum optdec type)
enum optcla INT123_decclass(const enum optdec type)
{
return
(
......@@ -161,7 +161,7 @@ static enum optdec sse_or_vintage(mpg123_handle *fr)
type = sse_vintage;
# ifdef OPT_SSE
# ifdef OPT_MULTI
if(fr->cpu_opts.the_dct36 == dct36_sse)
if(fr->cpu_opts.the_dct36 == INT123_dct36_sse)
# endif
type = sse;
# endif
......@@ -179,7 +179,7 @@ static int find_dectype(mpg123_handle *fr)
func_synth basic_synth = fr->synth;
#ifndef NO_8BIT
#ifndef NO_16BIT
if(basic_synth == synth_1to1_8bit_wrap)
if(basic_synth == INT123_synth_1to1_8bit_wrap)
basic_synth = fr->synths.plain[r_1to1][f_16]; /* That is what's really below the surface. */
#endif
#endif
......@@ -187,71 +187,71 @@ static int find_dectype(mpg123_handle *fr)
if(FALSE) ; /* Just to initialize the else if ladder. */
#ifndef NO_16BIT
#if defined(OPT_3DNOWEXT) || defined(OPT_3DNOWEXT_VINTAGE)
else if(basic_synth == synth_1to1_3dnowext)
else if(basic_synth == INT123_synth_1to1_3dnowext)
{
type = dreidnowext;
# ifdef OPT_3DNOWEXT_VINTAGE
# ifdef OPT_MULTI
if(fr->cpu_opts.the_dct36 == dct36_3dnowext)
if(fr->cpu_opts.the_dct36 == INT123_dct36_3dnowext)
# endif
type = dreidnowext_vintage;
# endif
}
#endif
#if defined(OPT_SSE) || defined(OPT_SSE_VINTAGE)
else if(basic_synth == synth_1to1_sse)
else if(basic_synth == INT123_synth_1to1_sse)
{
type = sse_or_vintage(fr);
}
#endif
#if defined(OPT_3DNOW) || defined(OPT_3DNOW_VINTAGE)
else if(basic_synth == synth_1to1_3dnow)
else if(basic_synth == INT123_synth_1to1_3dnow)
{
type = dreidnow;
# ifdef OPT_3DNOW_VINTAGE
# ifdef OPT_MULTI
if(fr->cpu_opts.the_dct36 == dct36_3dnow)
if(fr->cpu_opts.the_dct36 == INT123_dct36_3dnow)
# endif
type = dreidnow_vintage;
# endif
}
#endif
#ifdef OPT_MMX
else if(basic_synth == synth_1to1_mmx) type = mmx;
else if(basic_synth == INT123_synth_1to1_mmx) type = mmx;
#endif
#ifdef OPT_I586_DITHER
else if(basic_synth == synth_1to1_i586_dither) type = ifuenf_dither;
else if(basic_synth == INT123_synth_1to1_i586_dither) type = ifuenf_dither;
#endif
#ifdef OPT_I586
else if(basic_synth == synth_1to1_i586) type = ifuenf;
else if(basic_synth == INT123_synth_1to1_i586) type = ifuenf;
#endif
#ifdef OPT_ALTIVEC
else if(basic_synth == synth_1to1_altivec) type = altivec;
else if(basic_synth == INT123_synth_1to1_altivec) type = altivec;
#endif
#ifdef OPT_X86_64
else if(basic_synth == synth_1to1_x86_64) type = x86_64;
else if(basic_synth == INT123_synth_1to1_x86_64) type = x86_64;
#endif
#ifdef OPT_AVX
else if(basic_synth == synth_1to1_avx) type = avx;
else if(basic_synth == INT123_synth_1to1_avx) type = avx;
#endif
#ifdef OPT_ARM
else if(basic_synth == synth_1to1_arm) type = arm;
else if(basic_synth == INT123_synth_1to1_arm) type = arm;
#endif
#ifdef OPT_NEON
else if(basic_synth == synth_1to1_neon) type = neon;
else if(basic_synth == INT123_synth_1to1_neon) type = neon;
#endif
#ifdef OPT_NEON64
else if(basic_synth == synth_1to1_neon64) type = neon64;
else if(basic_synth == INT123_synth_1to1_neon64) type = neon64;
#endif
#ifdef OPT_GENERIC_DITHER
else if(basic_synth == synth_1to1_dither) type = generic_dither;
else if(basic_synth == INT123_synth_1to1_dither) type = generic_dither;
#endif
#ifdef OPT_DITHER /* either i586 or generic! */
#ifndef NO_DOWNSAMPLE
else if
(
basic_synth == synth_2to1_dither
|| basic_synth == synth_4to1_dither
basic_synth == INT123_synth_2to1_dither
|| basic_synth == INT123_synth_4to1_dither
) type = generic_dither;
#endif
#endif
......@@ -261,50 +261,50 @@ static int find_dectype(mpg123_handle *fr)
#ifndef NO_REAL
#if defined(OPT_SSE) || defined(OPT_SSE_VINTAGE)
else if(basic_synth == synth_1to1_real_sse)
else if(basic_synth == INT123_synth_1to1_real_sse)
{
type = sse_or_vintage(fr);
}
#endif
#ifdef OPT_X86_64
else if(basic_synth == synth_1to1_real_x86_64) type = x86_64;
else if(basic_synth == INT123_synth_1to1_real_x86_64) type = x86_64;
#endif
#ifdef OPT_AVX
else if(basic_synth == synth_1to1_real_avx) type = avx;
else if(basic_synth == INT123_synth_1to1_real_avx) type = avx;
#endif
#ifdef OPT_ALTIVEC
else if(basic_synth == synth_1to1_real_altivec) type = altivec;
else if(basic_synth == INT123_synth_1to1_real_altivec) type = altivec;
#endif
#ifdef OPT_NEON
else if(basic_synth == synth_1to1_real_neon) type = neon;
else if(basic_synth == INT123_synth_1to1_real_neon) type = neon;
#endif
#ifdef OPT_NEON64
else if(basic_synth == synth_1to1_real_neon64) type = neon64;
else if(basic_synth == INT123_synth_1to1_real_neon64) type = neon64;
#endif
#endif /* real */
#ifndef NO_32BIT
#if defined(OPT_SSE) || defined(OPT_SSE_VINTAGE)
else if(basic_synth == synth_1to1_s32_sse)
else if(basic_synth == INT123_synth_1to1_s32_sse)
{
type = sse_or_vintage(fr);
}
#endif
#ifdef OPT_X86_64
else if(basic_synth == synth_1to1_s32_x86_64) type = x86_64;
else if(basic_synth == INT123_synth_1to1_s32_x86_64) type = x86_64;
#endif
#ifdef OPT_AVX
else if(basic_synth == synth_1to1_s32_avx) type = avx;
else if(basic_synth == INT123_synth_1to1_s32_avx) type = avx;
#endif
#ifdef OPT_ALTIVEC
else if(basic_synth == synth_1to1_s32_altivec) type = altivec;
else if(basic_synth == INT123_synth_1to1_s32_altivec) type = altivec;
#endif
#ifdef OPT_NEON
else if(basic_synth == synth_1to1_s32_neon) type = neon;
else if(basic_synth == INT123_synth_1to1_s32_neon) type = neon;
#endif
#ifdef OPT_NEON64
else if(basic_synth == synth_1to1_s32_neon64) type = neon64;
else if(basic_synth == INT123_synth_1to1_s32_neon64) type = neon64;
#endif
#endif /* 32bit */
......@@ -329,7 +329,7 @@ static int find_dectype(mpg123_handle *fr)
if(type != nodec)
{
fr->cpu_opts.type = type;
fr->cpu_opts.class = decclass(type);
fr->cpu_opts.class = INT123_decclass(type);
debug3("determined active decoder type %i (%s) of class %i", type, decname[type], fr->cpu_opts.class);
return MPG123_OK;
......@@ -344,7 +344,7 @@ static int find_dectype(mpg123_handle *fr)
}
/* set synth functions for current frame, optimizations handled by opt_* macros */
int set_synth_functions(mpg123_handle *fr)
int INT123_set_synth_functions(mpg123_handle *fr)
{
enum synth_resample resample = r_none;
enum synth_format basic_format = f_none; /* Default is always 16bit, or whatever. */
......@@ -372,7 +372,7 @@ int set_synth_functions(mpg123_handle *fr)
/* Make sure the chosen format is compiled into this lib. */
if(basic_format == f_none)
{
if(NOQUIET) error("set_synth_functions: This output format is disabled in this build!");
if(NOQUIET) error("INT123_set_synth_functions: This output format is disabled in this build!");
return -1;
}
......@@ -392,7 +392,7 @@ int set_synth_functions(mpg123_handle *fr)
if(resample == r_none)
{
if(NOQUIET) error("set_synth_functions: This resampling mode is not supported in this build!");
if(NOQUIET) error("INT123_set_synth_functions: This resampling mode is not supported in this build!");
return -1;
}
......@@ -411,7 +411,7 @@ int set_synth_functions(mpg123_handle *fr)
return MPG123_ERR;
}
if(frame_buffers(fr) != 0)
if(INT123_frame_buffers(fr) != 0)
{
fr->err = MPG123_NO_BUFFERS;
if(NOQUIET) error("Failed to set up decoder buffers!");
......@@ -422,7 +422,7 @@ int set_synth_functions(mpg123_handle *fr)
#ifndef NO_8BIT
if(basic_format == f_8)
{
if(make_conv16to8_table(fr) != 0)
if(INT123_make_conv16to8_table(fr) != 0)
{
if(NOQUIET) error("Failed to set up conv16to8 table!");
/* it's a bit more work to get proper error propagation up */
......@@ -452,32 +452,32 @@ int set_synth_functions(mpg123_handle *fr)
)
{
#ifndef NO_LAYER3
init_layer3_stuff(fr, init_layer3_gainpow2_mmx);
INT123_init_layer3_stuff(fr, INT123_init_layer3_gainpow2_mmx);
#endif
#ifndef NO_LAYER12
init_layer12_stuff(fr, init_layer12_table_mmx);
INT123_init_layer12_stuff(fr, INT123_init_layer12_table_mmx);
#endif
fr->make_decode_tables = make_decode_tables_mmx;
fr->INT123_make_decode_tables = INT123_make_decode_tables_mmx;
}
else
#endif
{
#ifndef NO_LAYER3
init_layer3_stuff(fr, init_layer3_gainpow2);
INT123_init_layer3_stuff(fr, INT123_init_layer3_gainpow2);
#endif
#ifndef NO_LAYER12
init_layer12_stuff(fr, init_layer12_table);
INT123_init_layer12_stuff(fr, INT123_init_layer12_table);
#endif
fr->make_decode_tables = make_decode_tables;
fr->INT123_make_decode_tables = INT123_make_decode_tables;
}
/* We allocated the table buffers just now, so (re)create the tables. */
fr->make_decode_tables(fr);
fr->INT123_make_decode_tables(fr);
return 0;
}
int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{
const char* chosen = ""; /* the chosen decoder opt as string */
enum optdec want_dec = nodec;
......@@ -487,7 +487,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
int dithered = FALSE; /* If some dithered decoder is chosen. */
#endif
want_dec = dectype(cpu);
want_dec = INT123_dectype(cpu);
auto_choose = want_dec == autodec;
/* Fill whole array of synth functions with generic code first. */
fr->synths = synth_base;
......@@ -506,11 +506,11 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
#ifdef OPT_MULTI
#ifndef NO_LAYER3
#if (defined OPT_3DNOW_VINTAGE || defined OPT_3DNOWEXT_VINTAGE || defined OPT_SSE || defined OPT_X86_64 || defined OPT_AVX || defined OPT_NEON || defined OPT_NEON64)
fr->cpu_opts.the_dct36 = dct36;
fr->cpu_opts.the_dct36 = INT123_dct36;
#endif
#endif
#endif
/* covers any i386+ cpu; they actually differ only in the synth_1to1 function, mostly... */
/* covers any i386+ cpu; they actually differ only in the INT123_synth_1to1 function, mostly... */
#ifdef OPT_X86
if(cpu_i586(fr->cpu_flags))
{
......@@ -525,22 +525,22 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = sse;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
/* if(cpu_fast_sse(fr->cpu_flags)) */ fr->cpu_opts.the_dct36 = dct36_sse;
/* if(cpu_fast_sse(fr->cpu_flags)) */ fr->cpu_opts.the_dct36 = INT123_dct36_sse;
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_sse;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_sse;
# ifdef ACCURATE_ROUNDING
fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_sse;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_sse;
# endif
# endif
# ifndef NO_REAL
fr->synths.plain[r_1to1][f_real] = synth_1to1_real_sse;
fr->synths.stereo[r_1to1][f_real] = synth_1to1_real_stereo_sse;
fr->synths.plain[r_1to1][f_real] = INT123_synth_1to1_real_sse;
fr->synths.stereo[r_1to1][f_real] = INT123_synth_1to1_real_stereo_sse;
# endif
# ifndef NO_32BIT
fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_sse;
fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32_stereo_sse;
fr->synths.plain[r_1to1][f_32] = INT123_synth_1to1_s32_sse;
fr->synths.stereo[r_1to1][f_32] = INT123_synth_1to1_s32_stereo_sse;
# endif
done = 1;
}
......@@ -552,18 +552,18 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
chosen = dn_sse_vintage;
fr->cpu_opts.type = sse_vintage;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_sse;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_sse;
# ifdef ACCURATE_ROUNDING
fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_sse;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_sse;
# endif
# endif
# ifndef NO_REAL
fr->synths.plain[r_1to1][f_real] = synth_1to1_real_sse;
fr->synths.stereo[r_1to1][f_real] = synth_1to1_real_stereo_sse;
fr->synths.plain[r_1to1][f_real] = INT123_synth_1to1_real_sse;
fr->synths.stereo[r_1to1][f_real] = INT123_synth_1to1_real_stereo_sse;
# endif
# ifndef NO_32BIT
fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_sse;
fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32_stereo_sse;
fr->synths.plain[r_1to1][f_32] = INT123_synth_1to1_s32_sse;
fr->synths.stereo[r_1to1][f_32] = INT123_synth_1to1_s32_stereo_sse;
# endif
done = 1;
}
......@@ -577,7 +577,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
chosen = dn_dreidnowext;
fr->cpu_opts.type = dreidnowext;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnowext;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_3dnowext;
# endif
done = 1;
}
......@@ -592,11 +592,11 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = dreidnowext_vintage;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = dct36_3dnowext;
fr->cpu_opts.the_dct36 = INT123_dct36_3dnowext;
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnowext;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_3dnowext;
# endif
done = 1;
}
......@@ -608,7 +608,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
chosen = dn_dreidnow;
fr->cpu_opts.type = dreidnow;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnow;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_3dnow;
# endif
done = 1;
}
......@@ -621,11 +621,11 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = dreidnow_vintage;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = dct36_3dnow;
fr->cpu_opts.the_dct36 = INT123_dct36_3dnow;
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_3dnow;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_3dnow;
# endif
done = 1;
}
......@@ -637,7 +637,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
chosen = dn_mmx;
fr->cpu_opts.type = mmx;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_mmx;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_mmx;
# endif
done = 1;
}
......@@ -648,7 +648,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
chosen = "i586/pentium";
fr->cpu_opts.type = ifuenf;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_i586;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_i586;
# endif
done = 1;
}
......@@ -660,10 +660,10 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = ifuenf_dither;
dithered = TRUE;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_i586_dither;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_i586_dither;
# ifndef NO_DOWNSAMPLE
fr->synths.plain[r_2to1][f_16] = synth_2to1_dither;
fr->synths.plain[r_4to1][f_16] = synth_4to1_dither;
fr->synths.plain[r_2to1][f_16] = INT123_synth_2to1_dither;
fr->synths.plain[r_4to1][f_16] = INT123_synth_4to1_dither;
# endif
# endif
done = 1;
......@@ -693,7 +693,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
{
/*
We have chosen some x86 decoder... fillup some i386 stuff.
There is an open question about using dithered synth_1to1 for 8bit wrappers.
There is an open question about using dithered INT123_synth_1to1 for 8bit wrappers.
For quality it won't make sense, but wrapped i586_dither wrapped may still be faster...
*/
enum synth_resample ri;
......@@ -702,9 +702,9 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
# ifndef NO_16BIT /* possibility to use a 16->8 wrapper... */
if(fr->synths.plain[r_1to1][f_16] != synth_base.plain[r_1to1][f_16])
{
fr->synths.plain[r_1to1][f_8] = synth_1to1_8bit_wrap;
fr->synths.mono[r_1to1][f_8] = synth_1to1_8bit_wrap_mono;
fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_m2s;
fr->synths.plain[r_1to1][f_8] = INT123_synth_1to1_8bit_wrap;
fr->synths.mono[r_1to1][f_8] = INT123_synth_1to1_8bit_wrap_mono;
fr->synths.mono2stereo[r_1to1][f_8] = INT123_synth_1to1_8bit_wrap_m2s;
}
# endif
# endif
......@@ -725,20 +725,20 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = avx;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = dct36_avx;
fr->cpu_opts.the_dct36 = INT123_dct36_avx;
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_avx;
fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_avx;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_avx;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_avx;
# endif
# ifndef NO_REAL
fr->synths.plain[r_1to1][f_real] = synth_1to1_real_avx;
fr->synths.stereo[r_1to1][f_real] = synth_1to1_fltst_avx;
fr->synths.plain[r_1to1][f_real] = INT123_synth_1to1_real_avx;
fr->synths.stereo[r_1to1][f_real] = INT123_synth_1to1_fltst_avx;
# endif
# ifndef NO_32BIT
fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_avx;
fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32_stereo_avx;
fr->synths.plain[r_1to1][f_32] = INT123_synth_1to1_s32_avx;
fr->synths.stereo[r_1to1][f_32] = INT123_synth_1to1_s32_stereo_avx;
# endif
done = 1;
}
......@@ -751,20 +751,20 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = x86_64;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = dct36_x86_64;
fr->cpu_opts.the_dct36 = INT123_dct36_x86_64;
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_x86_64;
fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_x86_64;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_x86_64;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_x86_64;
# endif
# ifndef NO_REAL
fr->synths.plain[r_1to1][f_real] = synth_1to1_real_x86_64;
fr->synths.stereo[r_1to1][f_real] = synth_1to1_real_stereo_x86_64;
fr->synths.plain[r_1to1][f_real] = INT123_synth_1to1_real_x86_64;
fr->synths.stereo[r_1to1][f_real] = INT123_synth_1to1_real_stereo_x86_64;
# endif
# ifndef NO_32BIT
fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_x86_64;
fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32_stereo_x86_64;
fr->synths.plain[r_1to1][f_32] = INT123_synth_1to1_s32_x86_64;
fr->synths.stereo[r_1to1][f_32] = INT123_synth_1to1_s32_stereo_x86_64;
# endif
done = 1;
}
......@@ -776,16 +776,16 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
chosen = dn_altivec;
fr->cpu_opts.type = altivec;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_altivec;
fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_altivec;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_altivec;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_altivec;
# endif
# ifndef NO_REAL
fr->synths.plain[r_1to1][f_real] = synth_1to1_real_altivec;
fr->synths.stereo[r_1to1][f_real] = synth_1to1_fltst_altivec;
fr->synths.plain[r_1to1][f_real] = INT123_synth_1to1_real_altivec;
fr->synths.stereo[r_1to1][f_real] = INT123_synth_1to1_fltst_altivec;
# endif
# ifndef NO_32BIT
fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_altivec;
fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32_stereo_altivec;
fr->synths.plain[r_1to1][f_32] = INT123_synth_1to1_s32_altivec;
fr->synths.stereo[r_1to1][f_32] = INT123_synth_1to1_s32_stereo_altivec;
# endif
done = 1;
}
......@@ -798,20 +798,20 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = neon;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = dct36_neon;
fr->cpu_opts.the_dct36 = INT123_dct36_neon;
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_neon;
fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_neon;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_neon;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_neon;
# endif
# ifndef NO_REAL
fr->synths.plain[r_1to1][f_real] = synth_1to1_real_neon;
fr->synths.stereo[r_1to1][f_real] = synth_1to1_real_stereo_neon;
fr->synths.plain[r_1to1][f_real] = INT123_synth_1to1_real_neon;
fr->synths.stereo[r_1to1][f_real] = INT123_synth_1to1_real_stereo_neon;
# endif
# ifndef NO_32BIT
fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_neon;
fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32_stereo_neon;
fr->synths.plain[r_1to1][f_32] = INT123_synth_1to1_s32_neon;
fr->synths.stereo[r_1to1][f_32] = INT123_synth_1to1_s32_stereo_neon;
# endif
done = 1;
}
......@@ -823,7 +823,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
chosen = dn_arm;
fr->cpu_opts.type = arm;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_arm;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_arm;
# endif
done = 1;
}
......@@ -836,20 +836,20 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = neon64;
#ifdef OPT_MULTI
# ifndef NO_LAYER3
fr->cpu_opts.the_dct36 = dct36_neon64;
fr->cpu_opts.the_dct36 = INT123_dct36_neon64;
# endif
#endif
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_neon64;
fr->synths.stereo[r_1to1][f_16] = synth_1to1_stereo_neon64;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_neon64;
fr->synths.stereo[r_1to1][f_16] = INT123_synth_1to1_stereo_neon64;
# endif
# ifndef NO_REAL
fr->synths.plain[r_1to1][f_real] = synth_1to1_real_neon64;
fr->synths.stereo[r_1to1][f_real] = synth_1to1_fltst_neon64;
fr->synths.plain[r_1to1][f_real] = INT123_synth_1to1_real_neon64;
fr->synths.stereo[r_1to1][f_real] = INT123_synth_1to1_fltst_neon64;
# endif
# ifndef NO_32BIT
fr->synths.plain[r_1to1][f_32] = synth_1to1_s32_neon64;
fr->synths.stereo[r_1to1][f_32] = synth_1to1_s32st_neon64;
fr->synths.plain[r_1to1][f_32] = INT123_synth_1to1_s32_neon64;
fr->synths.stereo[r_1to1][f_32] = INT123_synth_1to1_s32st_neon64;
# endif
done = 1;
}
......@@ -871,17 +871,17 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
fr->cpu_opts.type = generic_dither;
dithered = TRUE;
# ifndef NO_16BIT
fr->synths.plain[r_1to1][f_16] = synth_1to1_dither;
fr->synths.plain[r_1to1][f_16] = INT123_synth_1to1_dither;
# ifndef NO_DOWNSAMPLE
fr->synths.plain[r_2to1][f_16] = synth_2to1_dither;
fr->synths.plain[r_4to1][f_16] = synth_4to1_dither;
fr->synths.plain[r_2to1][f_16] = INT123_synth_2to1_dither;
fr->synths.plain[r_4to1][f_16] = INT123_synth_4to1_dither;
# endif
# endif
done = 1;
}
#endif
fr->cpu_opts.class = decclass(fr->cpu_opts.type);
fr->cpu_opts.class = INT123_decclass(fr->cpu_opts.type);
# ifndef NO_8BIT
# ifndef NO_16BIT /* possibility to use a 16->8 wrapper... */
......@@ -890,9 +890,9 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
&& fr->cpu_opts.type != generic_dither
&& fr->synths.plain[r_1to1][f_16] != synth_base.plain[r_1to1][f_16] )
{
fr->synths.plain[r_1to1][f_8] = synth_1to1_8bit_wrap;
fr->synths.mono[r_1to1][f_8] = synth_1to1_8bit_wrap_mono;
fr->synths.mono2stereo[r_1to1][f_8] = synth_1to1_8bit_wrap_m2s;
fr->synths.plain[r_1to1][f_8] = INT123_synth_1to1_8bit_wrap;
fr->synths.mono[r_1to1][f_8] = INT123_synth_1to1_8bit_wrap_mono;
fr->synths.mono2stereo[r_1to1][f_8] = INT123_synth_1to1_8bit_wrap_m2s;
}
# endif
# endif
......@@ -901,7 +901,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
if(done && dithered)
{
/* run-time dither noise table generation */
if(!frame_dither_init(fr))
if(!INT123_frame_dither_init(fr))
{
if(NOQUIET) error("Dither noise setup failed!");
return 0;
......@@ -921,7 +921,7 @@ int frame_cpu_opt(mpg123_handle *fr, const char* cpu)
}
}
enum optdec dectype(const char* decoder)
enum optdec INT123_dectype(const char* decoder)
{
enum optdec dt;
if( (decoder == NULL)
......@@ -1072,7 +1072,7 @@ void check_decoders(void)
return;
#else
const char **d = mpg123_supported_decoder_list;
#if (defined OPT_X86) || (defined OPT_X86_64) || (defined OPT_NEON) || (defined OPT_NEON64)
#ifdef OPT_CPU_FLAGS
struct cpuflags cpu_flags;
wrap_getcpuflags(&cpu_flags);
#endif
......
......@@ -32,7 +32,7 @@
Also, one should minimize code size by really ensuring that only functions that are really needed are included.
Currently, all generic functions will be always there (to be safe for fallbacks for advanced decoders).
Strictly, at least the synth_1to1 should not be necessary for single-decoder mode.
Strictly, at least the INT123_synth_1to1 should not be necessary for single-decoder mode.
*/
......@@ -166,15 +166,15 @@ static const char* decname[] =
enum optcla { nocla=0, normal, mmxsse };
/* - Set up the table of synth functions for current decoder choice. */
int frame_cpu_opt(mpg123_handle *fr, const char* cpu);
int INT123_frame_cpu_opt(mpg123_handle *fr, const char* cpu);
/* - Choose, from the synth table, the synth functions to use for current output format/rate. */
int set_synth_functions(mpg123_handle *fr);
int INT123_set_synth_functions(mpg123_handle *fr);
/* - Parse decoder name and return numerical code. */
enum optdec dectype(const char* decoder);
enum optdec INT123_dectype(const char* decoder);
/* - Return the default decoder type. */
enum optdec defdec(void);
enum optdec INT123_defdec(void);
/* - Return the class of a decoder type (mmxsse or normal). */
enum optcla decclass(const enum optdec);
enum optcla INT123_decclass(const enum optdec);
/* Now comes a whole lot of definitions, for multi decoder mode and single decoder mode.
Because of the latter, it may look redundant at times. */
......@@ -265,7 +265,7 @@ enum optcla decclass(const enum optdec);
#define OPT_X86
#ifndef OPT_MULTI
# define defopt sse
# define opt_dct36(fr) dct36_sse
# define opt_dct36(fr) INT123_dct36_sse
#endif
#endif
......@@ -287,22 +287,22 @@ enum optcla decclass(const enum optdec);
#endif
#endif
/* same as above but also using 3DNowExt dct36 */
/* same as above but also using 3DNowExt INT123_dct36 */
#ifdef OPT_3DNOWEXT_VINTAGE
#define OPT_MMXORSSE
#define OPT_MPLAYER
#define OPT_X86
#ifndef OPT_MULTI
# define defopt dreidnowext_vintage
# define opt_dct36(fr) dct36_3dnowext
# define opt_dct36(fr) INT123_dct36_3dnowext
#endif
#endif
#ifdef OPT_MPLAYER
extern const int costab_mmxsse[];
extern const int INT123_costab_mmxsse[];
#endif
/* 3dnow used to use synth_1to1_i586 for mono / 8bit conversion - was that intentional? */
/* 3dnow used to use INT123_synth_1to1_i586 for mono / 8bit conversion - was that intentional? */
/* I'm trying to skip the pentium code here ... until I see that that is indeed a bad idea */
#ifdef OPT_3DNOW
#define OPT_X86
......@@ -311,12 +311,12 @@ extern const int costab_mmxsse[];
#endif
#endif
/* same as above but also using 3DNow dct36 */
/* same as above but also using 3DNow INT123_dct36 */
#ifdef OPT_3DNOW_VINTAGE
#define OPT_X86
#ifndef OPT_MULTI
# define defopt dreidnow_vintage
# define opt_dct36(fr) dct36_3dnow
# define opt_dct36(fr) INT123_dct36_3dnow
#endif
#endif
......@@ -330,7 +330,7 @@ extern const int costab_mmxsse[];
#define OPT_MMXORSSE
#ifndef OPT_MULTI
# define defopt x86_64
# define opt_dct36(fr) dct36_x86_64
# define opt_dct36(fr) INT123_dct36_x86_64
#endif
#endif
......@@ -338,7 +338,7 @@ extern const int costab_mmxsse[];
#define OPT_MMXORSSE
#ifndef OPT_MULTI
# define defopt avx
# define opt_dct36(fr) dct36_avx
# define opt_dct36(fr) INT123_dct36_avx
#endif
#endif
......@@ -352,7 +352,7 @@ extern const int costab_mmxsse[];
#define OPT_MMXORSSE
#ifndef OPT_MULTI
# define defopt neon
# define opt_dct36(fr) dct36_neon
# define opt_dct36(fr) INT123_dct36_neon
#endif
#endif
......@@ -360,7 +360,7 @@ extern const int costab_mmxsse[];
#define OPT_MMXORSSE
#ifndef OPT_MULTI
# define defopt neon64
# define opt_dct36(fr) dct36_neon64
# define opt_dct36(fr) INT123_dct36_neon64
#endif
#endif
......@@ -381,8 +381,7 @@ extern const int costab_mmxsse[];
#endif /* OPT_MULTI else */
# ifndef opt_dct36
# define opt_dct36(fr) dct36
# define opt_dct36(fr) INT123_dct36
# endif
#endif /* MPG123_H_OPTIMIZE */
/*
parse: spawned from common; clustering around stream/frame parsing
copyright ?-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp & Thomas Orgis
*/
......@@ -71,12 +71,12 @@ static int wetwork(mpg123_handle *fr, unsigned long *newheadp);
/* These two are to be replaced by one function that gives all the frame parameters (for outsiders).*/
/* Those functions are unsafe regarding bad arguments (inside the mpg123_handle), but just returning anything would also be unsafe, the caller code has to be trusted. */
int frame_bitrate(mpg123_handle *fr)
int INT123_frame_bitrate(mpg123_handle *fr)
{
return tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index];
}
long frame_freq(mpg123_handle *fr)
long INT123_frame_freq(mpg123_handle *fr)
{
return freqs[fr->sampling_frequency];
}
......@@ -203,12 +203,12 @@ static int check_lame_tag(mpg123_handle *fr)
else
{
/* Check for endless stream, but: TRACK_MAX_FRAMES sensible at all? */
fr->track_frames = long_tmp > TRACK_MAX_FRAMES ? 0 : (off_t) long_tmp;
fr->track_frames = long_tmp > TRACK_MAX_FRAMES ? 0 : (int64_t) long_tmp;
#ifdef GAPLESS
/* All or nothing: Only if encoder delay/padding is known, we'll cut
samples for gapless. */
if(fr->p.flags & MPG123_GAPLESS)
frame_gapless_init(fr, fr->track_frames, 0, 0);
INT123_frame_gapless_init(fr, fr->track_frames, 0, 0);
#endif
if(VERBOSE3) fprintf(stderr, "Note: Xing: %lu frames\n", long_tmp);
}
......@@ -228,14 +228,14 @@ static int check_lame_tag(mpg123_handle *fr)
ignoring leading ID3v2 data. Trailing tags (ID3v1) seem to be
included, though. */
if(fr->rdat.filelen < 1)
fr->rdat.filelen = (off_t) long_tmp + fr->audio_start; /* Overflow? */
fr->rdat.filelen = (int64_t) long_tmp + fr->audio_start; /* Overflow? */
else
{
if((off_t)long_tmp != fr->rdat.filelen - fr->audio_start && NOQUIET)
if((int64_t)long_tmp != fr->rdat.filelen - fr->audio_start && NOQUIET)
{ /* 1/filelen instead of 1/(filelen-start), my decision */
double diff = 100.0/fr->rdat.filelen
* ( fr->rdat.filelen - fr->audio_start
- (off_t)long_tmp );
- (int64_t)long_tmp );
if(diff < 0.) diff = -diff;
if(VERBOSE3) fprintf(stderr
......@@ -253,7 +253,7 @@ static int check_lame_tag(mpg123_handle *fr)
if(xing_flags & 0x4) /* TOC */
{
check_bytes_left(100);
frame_fill_toc(fr, fr->bsbuf+lame_offset);
INT123_frame_fill_toc(fr, fr->bsbuf+lame_offset);
lame_offset += 100;
}
if(xing_flags & 0x8) /* VBR quality */
......@@ -279,8 +279,8 @@ static int check_lame_tag(mpg123_handle *fr)
float peak = 0;
float gain_offset = 0; /* going to be +6 for old lame that used 83dB */
char nb[10];
off_t pad_in;
off_t pad_out;
int64_t pad_in;
int64_t pad_out;
memcpy(nb, fr->bsbuf+lame_offset, 9);
nb[9] = 0;
if(VERBOSE3) fprintf(stderr, "Note: Info: Encoder: %s\n", nb);
......@@ -413,7 +413,7 @@ static int check_lame_tag(mpg123_handle *fr)
fr->enc_padding = (int)pad_out;
#ifdef GAPLESS
if(fr->p.flags & MPG123_GAPLESS)
frame_gapless_init(fr, fr->track_frames, pad_in, pad_out);
INT123_frame_gapless_init(fr, fr->track_frames, pad_in, pad_out);
#endif
/* final: 24 B LAME data */
}
......@@ -461,7 +461,7 @@ static int halfspeed_do(mpg123_handle *fr)
debug("repeat!");
fr->to_decode = fr->to_ignore = TRUE;
--fr->halfphase;
set_pointer(fr, 0, 0);
INT123_set_pointer(fr, 0, 0);
if(fr->lay == 3) memcpy (fr->bsbuf, fr->ssave, fr->ssize);
if(fr->error_protection) fr->crc = getbits(fr, 16); /* skip crc */
return 1;
......@@ -491,12 +491,12 @@ else if(ret == PARSE_END){ ret=0; goto read_frame_bad; } \
That's a big one: read the next frame. 1 is success, <= 0 is some error
Special error READER_MORE means: Please feed more data and try again.
*/
int read_frame(mpg123_handle *fr)
int INT123_read_frame(mpg123_handle *fr)
{
/* TODO: rework this thing */
int freeformat_count = 0;
unsigned long newhead;
off_t framepos;
int64_t framepos;
int ret;
/* stuff that needs resetting if complete frame reading fails */
int oldsize = fr->framesize;
......@@ -521,9 +521,9 @@ int read_frame(mpg123_handle *fr)
#endif
) )
{
mdebug( "stopping parsing at %"OFF_P
mdebug( "stopping parsing at %"PRIi64
" frames as indicated fixed track length"
, (off_p)fr->num+1 );
, fr->num+1 );
return 0;
}
......@@ -532,7 +532,7 @@ read_again:
This is essential to prevent endless looping, always going back to the beginning when feeder buffer is exhausted. */
if(fr->rd->forget != NULL) fr->rd->forget(fr);
debug2("trying to get frame %"OFF_P" at %"OFF_P, (off_p)fr->num+1, (off_p)fr->rd->tell(fr));
debug2("trying to get frame %"PRIi64" at %"PRIi64, fr->num+1, fr->rd->tell(fr));
if((ret = fr->rd->head_read(fr,&newhead)) <= 0){ debug1("need more? (%i)", ret); goto read_frame_bad;}
init_resync:
......@@ -573,8 +573,8 @@ init_resync:
{
if(fr->firsthead && !head_compatible(fr->firsthead, newhead))
{
mdebug( "stopping before reading frame %"OFF_P
" as its header indicates Frankenstein coming for you", (off_p)fr->num );
mdebug( "stopping before reading frame %"PRIi64
" as its header indicates Frankenstein coming for you", fr->num );
return 0;
}
}
......@@ -585,7 +585,7 @@ init_resync:
{
unsigned char *newbuf = fr->bsspace[fr->bsnum]+512;
/* read main data into memory */
debug2("read frame body of %i at %"OFF_P, fr->framesize, framepos+4);
debug2("read frame body of %i at %"PRIi64, fr->framesize, framepos+4);
if((ret=fr->rd->read_frame_body(fr,newbuf,fr->framesize))<0)
{
/* if failed: flip back */
......@@ -616,23 +616,22 @@ init_resync:
goto read_again;
}
/* now adjust volume */
do_rva(fr);
INT123_do_rva(fr);
}
debug2("fr->firsthead: %08lx, audio_start: %li", fr->firsthead, (long int)fr->audio_start);
}
set_pointer(fr, 0, 0);
INT123_set_pointer(fr, 0, 0);
/* Question: How bad does the floating point value get with repeated recomputation?
Also, considering that we can play the file or parts of many times. */
if(++fr->mean_frames != 0)
{
fr->mean_framesize = ((fr->mean_frames-1)*fr->mean_framesize+compute_bpf(fr)) / fr->mean_frames ;
fr->mean_framesize = ((fr->mean_frames-1)*fr->mean_framesize+INT123_compute_bpf(fr)) / fr->mean_frames ;
}
++fr->num; /* 0 for first frame! */
debug4("Frame %"OFF_P" %08lx %i, next filepos=%"OFF_P,
(off_p)fr->num, newhead, fr->framesize, (off_p)fr->rd->tell(fr));
debug4("Frame %"PRIi64" %08lx %i, next filepos=%"PRIi64, fr->num, newhead, fr->framesize, fr->rd->tell(fr));
if(!(fr->state_flags & FRAME_FRANKENSTEIN) && (
(fr->track_frames > 0 && fr->num >= fr->track_frames)
#ifdef GAPLESS
......@@ -641,11 +640,13 @@ init_resync:
))
{
fr->state_flags |= FRAME_FRANKENSTEIN;
if(NOQUIET) fprintf(stderr, "\nWarning: Encountered more data after announced end of track (frame %"OFF_P"/%"OFF_P"). Frankenstein!\n", (off_p)fr->num,
if(NOQUIET)
fprintf(stderr, "\nWarning: Encountered more data after announced"
" end of track (frame %"PRIi64"/%"PRIi64"). Frankenstein!\n", fr->num,
#ifdef GAPLESS
fr->gapless_frames > 0 ? (off_p)fr->gapless_frames :
fr->gapless_frames > 0 ? fr->gapless_frames :
#endif
(off_p)fr->track_frames);
fr->track_frames);
}
halfspeed_prepare(fr);
......@@ -656,7 +657,7 @@ init_resync:
/* Keep track of true frame positions in our frame index.
but only do so when we are sure that the frame number is accurate... */
if((fr->state_flags & FRAME_ACCURATE) && FI_NEXT(fr->index, fr->num))
fi_add(&fr->index, framepos);
INT123_fi_add(&fr->index, framepos);
#endif
if(fr->silent_resync > 0) --fr->silent_resync;
......@@ -760,7 +761,7 @@ static int guess_freeformat_framesize(mpg123_handle *fr, unsigned long oldhead)
/*
* decode a header and write the information
* into the frame structure
* Return values are compatible with those of read_frame, namely:
* Return values are compatible with those of INT123_read_frame, namely:
* 1: success
* 0: no valid header
* <0: some error
......@@ -857,7 +858,7 @@ static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeforma
#ifndef NO_LAYER1
case 1:
fr->spf = 384;
fr->do_layer = do_layer1;
fr->do_layer = INT123_do_layer1;
if(!fr->freeformat)
{
long fs = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000;
......@@ -870,7 +871,7 @@ static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeforma
#ifndef NO_LAYER2
case 2:
fr->spf = 1152;
fr->do_layer = do_layer2;
fr->do_layer = INT123_do_layer2;
if(!fr->freeformat)
{
debug2("bitrate index: %i (%i)", fr->bitrate_index, tabsel_123[fr->lsf][1][fr->bitrate_index] );
......@@ -884,7 +885,7 @@ static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeforma
#ifndef NO_LAYER3
case 3:
fr->spf = fr->lsf ? 576 : 1152; /* MPEG 2.5 implies LSF.*/
fr->do_layer = do_layer3;
fr->do_layer = INT123_do_layer3;
if(fr->lsf)
fr->ssize = (fr->stereo == 1) ? 9 : 17;
else
......@@ -929,9 +930,9 @@ static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeforma
This overwrites side info needed for stage 0.
Continuing to read bits after layer 3 side info shall fail unless
set_pointer() is called to refresh things.
INT123_set_pointer() is called to refresh things.
*/
void set_pointer(mpg123_handle *fr, int part2, long backstep)
void INT123_set_pointer(mpg123_handle *fr, int part2, long backstep)
{
fr->bitindex = 0;
if(fr->lay == 3)
......@@ -959,7 +960,7 @@ void set_pointer(mpg123_handle *fr, int part2, long backstep)
/********************************/
double compute_bpf(mpg123_handle *fr)
double INT123_compute_bpf(mpg123_handle *fr)
{
return (fr->framesize > 0) ? fr->framesize + 4.0 : 1.0;
}
......@@ -982,13 +983,13 @@ double attribute_align_arg mpg123_tpf(mpg123_handle *fr)
return tpf;
}
int attribute_align_arg mpg123_position(mpg123_handle *fr, off_t no, off_t buffsize,
off_t *current_frame, off_t *frames_left,
int attribute_align_arg mpg123_position64(mpg123_handle *fr, int64_t no, int64_t buffsize,
int64_t *current_frame, int64_t *frames_left,
double *current_seconds, double *seconds_left)
{
double tpf;
double dt = 0.0;
off_t cur, left;
int64_t cur, left;
double curs, lefts;
if(!fr || !fr->rd) return MPG123_ERR;
......@@ -1009,9 +1010,9 @@ int attribute_align_arg mpg123_position(mpg123_handle *fr, off_t no, off_t buffs
if(fr->rdat.filelen >= 0)
{
double bpf;
off_t t = fr->rd->tell(fr);
bpf = fr->mean_framesize ? fr->mean_framesize : compute_bpf(fr);
left = (off_t)((double)(fr->rdat.filelen-t)/bpf);
int64_t t = fr->rd->tell(fr);
bpf = fr->mean_framesize ? fr->mean_framesize : INT123_compute_bpf(fr);
left = (int64_t)((double)(fr->rdat.filelen-t)/bpf);
/* no can be different for prophetic purposes, file pointer is always associated with fr->num! */
if(fr->num != no)
{
......@@ -1044,29 +1045,12 @@ int attribute_align_arg mpg123_position(mpg123_handle *fr, off_t no, off_t buffs
return MPG123_OK;
}
int get_songlen(mpg123_handle *fr,int no)
{
double tpf;
if(!fr)
return 0;
if(no < 0) {
if(!fr->rd || fr->rdat.filelen < 0)
return 0;
no = (int) ((double) fr->rdat.filelen / compute_bpf(fr));
}
tpf = mpg123_tpf(fr);
return (int) (no*tpf);
}
/* first attempt of read ahead check to find the real first header; cannot believe what junk is out there! */
static int do_readahead(mpg123_handle *fr, unsigned long newhead)
{
unsigned long nexthead = 0;
int hd = 0;
off_t start, oret;
int64_t start, oret;
int ret;
if( ! (!fr->firsthead && fr->rdat.flags & (READER_SEEKABLE|READER_BUFFERED)) )
......@@ -1074,7 +1058,7 @@ static int do_readahead(mpg123_handle *fr, unsigned long newhead)
start = fr->rd->tell(fr);
debug2("doing ahead check with BPF %d at %"OFF_P, fr->framesize+4, (off_p)start);
debug2("doing ahead check with BPF %d at %"PRIi64, fr->framesize+4, start);
/* step framesize bytes forward and read next possible header*/
if((oret=fr->rd->skip_bytes(fr, fr->framesize))<0)
{
......@@ -1093,7 +1077,7 @@ static int do_readahead(mpg123_handle *fr, unsigned long newhead)
}
if(hd == MPG123_NEED_MORE) return PARSE_MORE;
debug1("After fetching next header, at %"OFF_P, (off_p)fr->rd->tell(fr));
debug1("After fetching next header, at %"PRIi64, fr->rd->tell(fr));
if(!hd)
{
if(NOQUIET) warning("Cannot read next header, a one-frame stream? Duh...");
......@@ -1121,7 +1105,7 @@ static int handle_id3v2(mpg123_handle *fr, unsigned long newhead)
{
int ret;
fr->oldhead = 0; /* Think about that. Used to be present only for skipping of junk, not resync-style wetwork. */
ret = parse_new_id3(fr, newhead);
ret = INT123_parse_new_id3(fr, newhead);
if (ret < 0) return ret;
#ifndef NO_ID3V2
else if(ret > 0){ debug("got ID3v2"); fr->metaflags |= MPG123_NEW_ID3|MPG123_ID3; }
......@@ -1140,7 +1124,7 @@ static int handle_apetag(mpg123_handle *fr, unsigned long newhead)
int back_bytes = 3;
fr->oldhead = 0;
debug1("trying to read remaining APE header at %"OFF_P, (off_p)fr->rd->tell(fr));
debug1("trying to read remaining APE header at %"PRIi64, fr->rd->tell(fr));
/* Apetag headers are 32 bytes, newhead contains 4, read the rest */
if((ret=fr->rd->fullread(fr,apebuf,28)) < 0)
return ret;
......@@ -1148,7 +1132,7 @@ static int handle_apetag(mpg123_handle *fr, unsigned long newhead)
if(ret < 28)
goto apetag_bad;
debug1("trying to parse APE header at %"OFF_P, (off_p)fr->rd->tell(fr));
debug1("trying to parse APE header at %"PRIi64, fr->rd->tell(fr));
/* Apetags start with "APETAGEX", "APET" is already tested. */
if(strncmp((char *)apebuf,"AGEX",4) != 0)
goto apetag_bad;
......@@ -1171,8 +1155,8 @@ static int handle_apetag(mpg123_handle *fr, unsigned long newhead)
| ((unsigned long)apebuf[10]<<16)
| ((unsigned long)apebuf[9]<<8)
| apebuf[8];
debug2( "skipping %lu bytes of APE data at %"OFF_P
, val, (off_p)fr->rd->tell(fr) );
debug2( "skipping %lu bytes of APE data at %"PRIi64
, val, fr->rd->tell(fr) );
/* If encountering EOF here, things are just at an end. */
if((ret=fr->rd->skip_bytes(fr,val)) < 0)
return ret;
......@@ -1277,7 +1261,7 @@ static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount
fr->err = MPG123_RESYNC_FAIL;
return PARSE_ERR;
}
else debug1("hopefully found one at %"OFF_P, (off_p)fr->rd->tell(fr));
else debug1("hopefully found one at %"PRIi64, fr->rd->tell(fr));
/* If the new header ist good, it is already decoded. */
*newheadp = newhead;
......@@ -1320,8 +1304,8 @@ static int wetwork(mpg123_handle *fr, unsigned long *newheadp)
}
else if(NOQUIET && fr->silent_resync == 0)
{
fprintf(stderr,"Note: Illegal Audio-MPEG-Header 0x%08lx at offset %"OFF_P".\n",
newhead, (off_p)fr->rd->tell(fr)-4);
fprintf(stderr,"Note: Illegal Audio-MPEG-Header 0x%08lx at offset %"PRIi64".\n",
newhead, fr->rd->tell(fr)-4);
}
/* Now we got something bad at hand, try to recover. */
......@@ -1352,7 +1336,7 @@ static int wetwork(mpg123_handle *fr, unsigned long *newheadp)
return ret ? ret : PARSE_END;
}
if(VERBOSE3) debug3("resync try %li at %"OFF_P", got newhead 0x%08lx", try, (off_p)fr->rd->tell(fr), newhead);
if(VERBOSE3) debug3("resync try %li at %"PRIi64", got newhead 0x%08lx", try, fr->rd->tell(fr), newhead);
} while(!head_check(newhead));
*newheadp = newhead;
......
/*
parse: spawned from common; clustering around stream/frame parsing
copyright ?-2007 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp & Thomas Orgis
*/
......@@ -11,15 +11,12 @@
#include "frame.h"
int read_frame_init(mpg123_handle* fr);
int frame_bitrate(mpg123_handle *fr);
long frame_freq(mpg123_handle *fr);
int read_frame_recover(mpg123_handle* fr); /* dead? */
int read_frame(mpg123_handle *fr);
void set_pointer(mpg123_handle *fr, int part2, long backstep);
int position_info(mpg123_handle* fr, unsigned long no, long buffsize, unsigned long* frames_left, double* current_seconds, double* seconds_left);
double compute_bpf(mpg123_handle *fr);
long time_to_frame(mpg123_handle *fr, double seconds);
int get_songlen(mpg123_handle *fr,int no);
int INT123_read_frame_init(mpg123_handle* fr);
int INT123_frame_bitrate(mpg123_handle *fr);
long INT123_frame_freq(mpg123_handle *fr);
int INT123_read_frame_recover(mpg123_handle* fr); /* dead? */
int INT123_read_frame(mpg123_handle *fr);
void INT123_set_pointer(mpg123_handle *fr, int part2, long backstep);
double INT123_compute_bpf(mpg123_handle *fr);
#endif
/*
reader: reading input data
copyright ?-2007 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis (after code from Michael Hipp)
*/
......@@ -9,15 +9,16 @@
#ifndef MPG123_READER_H
#define MPG123_READER_H
#include "config.h"
#include "mpg123.h"
#ifndef MPG123_H_INTERN
#error "include internal mpg123 header first"
#endif
#ifndef NO_FEEDER
struct buffy
{
unsigned char *data;
ssize_t size;
ssize_t realsize;
ptrdiff_t size;
ptrdiff_t realsize;
struct buffy *next;
};
......@@ -26,12 +27,14 @@ struct bufferchain
{
struct buffy* first; /* The beginning of the chain. */
struct buffy* last; /* The end... of the chain. */
ssize_t size; /* Aggregated size of all buffies. */
ptrdiff_t size; /* Aggregated size of all buffies. */
/* These positions are relative to buffer chain beginning. */
ssize_t pos; /* Position in whole chain. */
ssize_t firstpos; /* The point of return on non-forget() */
ptrdiff_t pos; /* Position in whole chain. */
ptrdiff_t firstpos; /* The point of return on non-forget() */
/* The "real" filepos is fileoff + pos. */
off_t fileoff; /* Beginning of chain is at this file offset. */
int64_t fileoff; /* Beginning of chain is at this file offset. */
// Unsigned since no direct arithmetic with offsets. Overflow of overall
// size needs to be checked anyway.
size_t bufblock; /* Default (minimal) size of buffers. */
size_t pool_size; /* Keep that many buffers in storage. */
size_t pool_fill; /* That many buffers are there. */
......@@ -40,40 +43,28 @@ struct bufferchain
};
/* Call this before any buffer chain use (even bc_init()). */
void bc_prepare(struct bufferchain *, size_t pool_size, size_t bufblock);
void INT123_bc_prepare(struct bufferchain *, size_t pool_size, size_t bufblock);
/* Free persistent data in the buffer chain, after bc_reset(). */
void bc_cleanup(struct bufferchain *);
void INT123_bc_cleanup(struct bufferchain *);
/* Change pool size. This does not actually allocate/free anything on itself, just instructs later operations to free less / allocate more buffers. */
void bc_poolsize(struct bufferchain *, size_t pool_size, size_t bufblock);
void INT123_bc_poolsize(struct bufferchain *, size_t pool_size, size_t bufblock);
/* Return available byte count in the buffer. */
size_t bc_fill(struct bufferchain *bc);
size_t INT123_bc_fill(struct bufferchain *bc);
#endif
struct reader_data
{
off_t filelen; /* total file length or total buffer size */
off_t filepos; /* position in file or position in buffer chain */
int filept;
int64_t filelen; /* total file length or total buffer size */
int64_t filepos; /* position in file or position in buffer chain */
/* Custom opaque I/O handle from the client. */
void *iohandle;
int flags;
long timeout_sec;
ssize_t (*fdread) (mpg123_handle *, void *, size_t);
/* User can replace the read and lseek functions. The r_* are the stored replacement functions or NULL. */
ssize_t (*r_read) (int fd, void *buf, size_t count);
off_t (*r_lseek)(int fd, off_t offset, int whence);
/* These are custom I/O routines for opaque user handles.
They get picked if there's some iohandle set. */
ssize_t (*r_read_handle) (void *handle, void *buf, size_t count);
off_t (*r_lseek_handle)(void *handle, off_t offset, int whence);
/* An optional cleaner for the handle on closing the stream. */
// The one and only lowlevel reader wrapper, wrapping over all others.
// This is either libmpg123's wrapper or directly the user-supplied functions.
int (*r_read64) (void *, void *, size_t, size_t *);
int64_t (*r_lseek64)(void *, int64_t, int);
void (*cleanup_handle)(void *handle);
/* These two pointers are the actual workers (default map to POSIX read/lseek). */
ssize_t (*read) (int fd, void *buf, size_t count);
off_t (*lseek)(int fd, off_t offset, int whence);
/* Buffered readers want that abstracted, set internally. */
ssize_t (*fullread)(mpg123_handle *, unsigned char *, ssize_t);
#ifndef NO_FEEDER
struct bufferchain buffer; /* Not dynamically allocated, these few struct bytes aren't worth the trouble. */
#endif
......@@ -87,39 +78,35 @@ struct reader
{
int (*init) (mpg123_handle *);
void (*close) (mpg123_handle *);
ssize_t (*fullread) (mpg123_handle *, unsigned char *, ssize_t);
ptrdiff_t (*fullread) (mpg123_handle *, unsigned char *, ptrdiff_t);
int (*head_read) (mpg123_handle *, unsigned long *newhead); /* succ: TRUE, else <= 0 (FALSE or READER_MORE) */
int (*head_shift) (mpg123_handle *, unsigned long *head); /* succ: TRUE, else <= 0 (FALSE or READER_MORE) */
off_t (*skip_bytes) (mpg123_handle *, off_t len); /* succ: >=0, else error or READER_MORE */
int64_t (*skip_bytes) (mpg123_handle *, int64_t len); /* succ: >=0, else error or READER_MORE */
int (*read_frame_body)(mpg123_handle *, unsigned char *, int size);
int (*back_bytes) (mpg123_handle *, off_t bytes);
int (*seek_frame) (mpg123_handle *, off_t num);
off_t (*tell) (mpg123_handle *);
int (*back_bytes) (mpg123_handle *, int64_t bytes);
int (*seek_frame) (mpg123_handle *, int64_t num);
int64_t (*tell) (mpg123_handle *);
void (*rewind) (mpg123_handle *);
void (*forget) (mpg123_handle *);
};
/* Open a file by path or use an opened file descriptor. */
int open_stream(mpg123_handle *, const char *path, int fd);
/* Open an external handle. */
int open_stream_handle(mpg123_handle *, void *iohandle);
int INT123_open_stream_handle(mpg123_handle *, void *iohandle);
/* feed based operation has some specials */
int open_feed(mpg123_handle *);
int INT123_open_feed(mpg123_handle *);
/* externally called function, returns 0 on success, -1 on error */
int feed_more(mpg123_handle *fr, const unsigned char *in, long count);
void feed_forget(mpg123_handle *fr); /* forget the data that has been read (free some buffers) */
off_t feed_set_pos(mpg123_handle *fr, off_t pos); /* Set position (inside available data if possible), return wanted byte offset of next feed. */
int INT123_feed_more(mpg123_handle *fr, const unsigned char *in, size_t count);
void INT123_feed_forget(mpg123_handle *fr); /* forget the data that has been read (free some buffers) */
int64_t INT123_feed_set_pos(mpg123_handle *fr, int64_t pos); /* Set position (inside available data if possible), return wanted byte offset of next feed. */
void open_bad(mpg123_handle *);
void INT123_open_bad(mpg123_handle *);
#define READER_FD_OPENED 0x1
#define READER_ID3TAG 0x2
#define READER_SEEKABLE 0x4
#define READER_BUFFERED 0x8
#define READER_NONBLOCK 0x20
#define READER_NOSEEK 0x10
#define READER_HANDLEIO 0x40
#define READER_STREAM 0
#define READER_ICY_STREAM 1
#define READER_FEED 2
......@@ -127,13 +114,6 @@ void open_bad(mpg123_handle *);
#define READER_BUF_STREAM 3
#define READER_BUF_ICY_STREAM 4
#ifdef READ_SYSTEM
#define READER_SYSTEM 5
#define READERS 6
#else
#define READERS 5
#endif
#define READER_ERROR MPG123_ERR
#define READER_MORE MPG123_NEED_MORE
......
......@@ -4,94 +4,70 @@
/*
readers.c: reading input data
copyright ?-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp
*/
#include "mpg123lib_intern.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
/* For select(), I need select.h according to POSIX 2001, else: sys/time.h sys/types.h unistd.h (the latter two included in compat.h already). */
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef _MSC_VER
#include <io.h>
#endif
#include "compat.h"
#include "debug.h"
static int default_init(mpg123_handle *fr);
static off_t get_fileinfo(mpg123_handle *);
static ssize_t posix_read(int fd, void *buf, size_t count){ return read(fd, buf, count); }
static off_t posix_lseek(int fd, off_t offset, int whence){ return lseek(fd, offset, whence); }
static off_t nix_lseek(int fd, off_t offset, int whence){ return -1; }
static int stream_init(mpg123_handle *fr);
static int64_t get_fileinfo(mpg123_handle *);
static ssize_t plain_fullread(mpg123_handle *fr,unsigned char *buf, ssize_t count);
/* Wrapper to decide between descriptor-based and external handle-based I/O. */
static off_t io_seek(struct reader_data *rdat, off_t offset, int whence);
static ssize_t io_read(struct reader_data *rdat, void *buf, size_t count);
static ptrdiff_t plain_fullread(mpg123_handle *fr,unsigned char *buf, ptrdiff_t count);
#ifndef NO_FEEDER
/* Bufferchain methods. */
static void bc_init(struct bufferchain *bc);
static void bc_reset(struct bufferchain *bc);
static int bc_append(struct bufferchain *bc, ssize_t size);
static int bc_append(struct bufferchain *bc, ptrdiff_t size);
#if 0
static void bc_drop(struct bufferchain *bc);
#endif
static int bc_add(struct bufferchain *bc, const unsigned char *data, ssize_t size);
static ssize_t bc_give(struct bufferchain *bc, unsigned char *out, ssize_t size);
static ssize_t bc_skip(struct bufferchain *bc, ssize_t count);
static ssize_t bc_seekback(struct bufferchain *bc, ssize_t count);
static int bc_add(struct bufferchain *bc, const unsigned char *data, ptrdiff_t size);
static ptrdiff_t bc_give(struct bufferchain *bc, unsigned char *out, ptrdiff_t size);
static ptrdiff_t bc_skip(struct bufferchain *bc, ptrdiff_t count);
static ptrdiff_t bc_seekback(struct bufferchain *bc, ptrdiff_t count);
static void bc_forget(struct bufferchain *bc);
#endif
/* A normal read and a read with timeout. */
static ssize_t plain_read(mpg123_handle *fr, void *buf, size_t count)
// This is only for streams, so READER_HANDLEIO must be set.
static ptrdiff_t fdread(mpg123_handle *fr, void *buf, size_t count)
{
ssize_t ret = io_read(&fr->rdat, buf, count);
if(VERBOSE3) debug2("read %li bytes of %li", (long)ret, (long)count);
return ret;
if((fr->rdat.flags & READER_HANDLEIO) && fr->rdat.r_read64)
{
size_t got = 0;
int ret = fr->rdat.r_read64(fr->rdat.iohandle, buf, count, &got);
if(ret<0)
{
if(NOQUIET) merror("error reading %zu bytes", count);
return -1;
}
if(VERBOSE3) mdebug("read %zu bytes of %zu", got, count);
// Stupid handling, but at least some handling of never-occuring case.
return (ptrdiff_t)(got > PTRDIFF_MAX ? PTRDIFF_MAX : got);
}
if(NOQUIET) error("no reader setup");
return -1;
}
#ifdef TIMEOUT_READ
/* Wait for data becoming available, allowing soft-broken network connection to die
This is needed for Shoutcast servers that have forgotten about us while connection was temporarily down. */
static ssize_t timeout_read(mpg123_handle *fr, void *buf, size_t count)
static int64_t fdseek(mpg123_handle *fr, int64_t offset, int whence)
{
struct timeval tv;
ssize_t ret = 0;
fd_set fds;
tv.tv_sec = fr->rdat.timeout_sec;
tv.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(fr->rdat.filept, &fds);
ret = select(fr->rdat.filept+1, &fds, NULL, NULL, &tv);
/* This works only with "my" read function. Not user-replaced. */
if(ret > 0) ret = read(fr->rdat.filept, buf, count);
else
{
ret=-1; /* no activity is the error */
if(NOQUIET) error("stream timed out");
}
return ret;
if((fr->rdat.flags & READER_HANDLEIO) && fr->rdat.r_lseek64)
return (fr->rdat.flags & READER_NOSEEK)
? -1
: fr->rdat.r_lseek64(fr->rdat.iohandle, offset, whence);
if(NOQUIET) error("no reader setup");
return -1;
}
#endif
#ifndef NO_ICY
/* stream based operation with icy meta data*/
static ssize_t icy_fullread(mpg123_handle *fr, unsigned char *buf, ssize_t count)
static ptrdiff_t icy_fullread(mpg123_handle *fr, unsigned char *buf, ptrdiff_t count)
{
ssize_t ret,cnt;
ptrdiff_t ret,cnt;
cnt = 0;
if(fr->rdat.flags & READER_SEEKABLE)
{
......@@ -114,13 +90,13 @@ static ssize_t icy_fullread(mpg123_handle *fr, unsigned char *buf, ssize_t count
{
unsigned char temp_buff;
size_t meta_size;
ssize_t cut_pos;
ptrdiff_t cut_pos;
/* we are near icy-metaint boundary, read up to the boundary */
if(fr->icy.next > 0)
{
cut_pos = fr->icy.next;
ret = fr->rdat.fdread(fr,buf+cnt,cut_pos);
ret = fdread(fr,buf+cnt,cut_pos);
if(ret < 1)
{
if(ret == 0) break; /* Just EOF. */
......@@ -130,7 +106,7 @@ static ssize_t icy_fullread(mpg123_handle *fr, unsigned char *buf, ssize_t count
}
if(!(fr->rdat.flags & READER_BUFFERED))
SATURATE_ADD(fr->rdat.filepos, ret, OFF_MAX);
SATURATE_ADD(fr->rdat.filepos, ret, INT64_MAX);
cnt += ret;
fr->icy.next -= ret;
if(fr->icy.next > 0)
......@@ -143,13 +119,13 @@ static ssize_t icy_fullread(mpg123_handle *fr, unsigned char *buf, ssize_t count
/* one byte icy-meta size (must be multiplied by 16 to get icy-meta length) */
ret = fr->rdat.fdread(fr,&temp_buff,1); /* Getting one single byte hast to suceed. */
ret = fdread(fr,&temp_buff,1); /* Getting one single byte hast to suceed. */
if(ret < 0){ if(NOQUIET) error("reading icy size"); return READER_ERROR; }
if(ret == 0) break;
debug2("got meta-size byte: %u, at filepos %li", temp_buff, (long)fr->rdat.filepos );
if(!(fr->rdat.flags & READER_BUFFERED))
SATURATE_ADD(fr->rdat.filepos, ret, OFF_MAX); /* 1... */
SATURATE_ADD(fr->rdat.filepos, ret, INT64_MAX); /* 1... */
if((meta_size = ((size_t) temp_buff) * 16))
{
......@@ -159,17 +135,17 @@ static ssize_t icy_fullread(mpg123_handle *fr, unsigned char *buf, ssize_t count
meta_buff = malloc(meta_size+1);
if(meta_buff != NULL)
{
ssize_t left = meta_size;
ptrdiff_t left = meta_size;
while(left > 0)
{
ret = fr->rdat.fdread(fr,meta_buff+meta_size-left,left);
ret = fdread(fr,meta_buff+meta_size-left,left);
/* 0 is error here, too... there _must_ be the ICY data, the server promised! */
if(ret < 1){ if(NOQUIET) error("reading icy-meta"); return READER_ERROR; }
left -= ret;
}
meta_buff[meta_size] = 0; /* string paranoia */
if(!(fr->rdat.flags & READER_BUFFERED))
SATURATE_ADD(fr->rdat.filepos, ret, OFF_MAX);
SATURATE_ADD(fr->rdat.filepos, ret, INT64_MAX);
if(fr->icy.data) free(fr->icy.data);
fr->icy.data = meta_buff;
......@@ -202,12 +178,12 @@ static ssize_t icy_fullread(mpg123_handle *fr, unsigned char *buf, ssize_t count
#endif /* NO_ICY */
/* stream based operation */
static ssize_t plain_fullread(mpg123_handle *fr,unsigned char *buf, ssize_t count)
static ptrdiff_t plain_fullread(mpg123_handle *fr,unsigned char *buf, ptrdiff_t count)
{
ssize_t ret,cnt=0;
ptrdiff_t ret,cnt=0;
#ifdef EXTRA_DEBUG
debug1("plain fullread of %"SSIZE_P, (size_p)count);
mdebug("plain fullread of %td", count);
#endif
/*
There used to be a check for expected file end here (length value or ID3 flag).
......@@ -218,21 +194,21 @@ static ssize_t plain_fullread(mpg123_handle *fr,unsigned char *buf, ssize_t coun
*/
while(cnt < count)
{
ret = fr->rdat.fdread(fr,buf+cnt,count-cnt);
ret = fdread(fr,buf+cnt,count-cnt);
if(ret < 0) return READER_ERROR;
if(ret == 0) break;
if(!(fr->rdat.flags & READER_BUFFERED))
SATURATE_ADD(fr->rdat.filepos, ret, OFF_MAX);
SATURATE_ADD(fr->rdat.filepos, ret, INT64_MAX);
cnt += ret;
}
return cnt;
}
static off_t stream_lseek(mpg123_handle *fr, off_t pos, int whence)
static int64_t stream_lseek(mpg123_handle *fr, int64_t pos, int whence)
{
off_t ret;
ret = io_seek(&fr->rdat, pos, whence);
if (ret >= 0) fr->rdat.filepos = ret;
int64_t ret = fdseek(fr, pos, whence);
if (ret >= 0)
fr->rdat.filepos = ret;
else
{
fr->err = MPG123_LSEEK_FAILED;
......@@ -243,37 +219,34 @@ static off_t stream_lseek(mpg123_handle *fr, off_t pos, int whence)
static void stream_close(mpg123_handle *fr)
{
if(fr->rdat.flags & READER_FD_OPENED) compat_close(fr->rdat.filept);
fr->rdat.filept = 0;
#ifndef NO_FEEDER
if(fr->rdat.flags & READER_BUFFERED) bc_reset(&fr->rdat.buffer);
#endif
if(fr->rdat.flags & READER_HANDLEIO)
{
if(fr->rdat.cleanup_handle != NULL) fr->rdat.cleanup_handle(fr->rdat.iohandle);
if(fr->rdat.cleanup_handle != NULL)
fr->rdat.cleanup_handle(fr->rdat.iohandle);
fr->rdat.iohandle = NULL;
}
}
static int stream_seek_frame(mpg123_handle *fr, off_t newframe)
static int stream_seek_frame(mpg123_handle *fr, int64_t newframe)
{
debug2("seek_frame to %"OFF_P" (from %"OFF_P")", (off_p)newframe, (off_p)fr->num);
debug2("seek_frame to %"PRIi64" (from %"PRIi64")", newframe, fr->num);
/* Seekable streams can go backwards and jump forwards.
Non-seekable streams still can go forward, just not jump. */
if((fr->rdat.flags & READER_SEEKABLE) || (newframe >= fr->num))
{
off_t preframe; /* a leading frame we jump to */
off_t seek_to; /* the byte offset we want to reach */
off_t to_skip; /* bytes to skip to get there (can be negative) */
int64_t preframe; /* a leading frame we jump to */
int64_t seek_to; /* the byte offset we want to reach */
int64_t to_skip; /* bytes to skip to get there (can be negative) */
/*
now seek to nearest leading index position and read from there until newframe is reached.
We use skip_bytes, which handles seekable and non-seekable streams
(the latter only for positive offset, which we ensured before entering here).
*/
seek_to = frame_index_find(fr, newframe, &preframe);
seek_to = INT123_frame_index_find(fr, newframe, &preframe);
/* No need to seek to index position if we are closer already.
But I am picky about fr->num == newframe, play safe by reading the frame again.
If you think that's stupid, don't call a seek to the current frame. */
......@@ -289,10 +262,10 @@ static int stream_seek_frame(mpg123_handle *fr, off_t newframe)
while(fr->num < newframe)
{
/* try to be non-fatal now... frameNum only gets advanced on success anyway */
if(!read_frame(fr)) break;
if(!INT123_read_frame(fr)) break;
}
/* Now the wanted frame should be ready for decoding. */
debug1("arrived at %lu", (long unsigned)fr->num);
debug1("arrived at %"PRIi64, fr->num);
return MPG123_OK;
}
......@@ -334,20 +307,20 @@ static int generic_head_shift(mpg123_handle *fr,unsigned long *head)
}
/* returns reached position... negative ones are bad... */
static off_t stream_skip_bytes(mpg123_handle *fr,off_t len)
static int64_t stream_skip_bytes(mpg123_handle *fr, int64_t len)
{
if(fr->rdat.flags & READER_SEEKABLE)
{
off_t ret = stream_lseek(fr, len, SEEK_CUR);
int64_t ret = stream_lseek(fr, len, SEEK_CUR);
return (ret < 0) ? READER_ERROR : ret;
}
else if(len >= 0)
{
unsigned char buf[1024]; /* ThOr: Compaq cxx complained and it makes sense to me... or should one do a cast? What for? */
ssize_t ret;
ptrdiff_t ret;
while (len > 0)
{
ssize_t num = len < (off_t)sizeof(buf) ? (ssize_t)len : (ssize_t)sizeof(buf);
ptrdiff_t num = len < (ptrdiff_t)sizeof(buf) ? (ptrdiff_t)len : (ptrdiff_t)sizeof(buf);
ret = fr->rd->fullread(fr, buf, num);
if (ret < 0) return ret;
else if(ret == 0) break; /* EOF... an error? interface defined to tell the actual position... */
......@@ -378,9 +351,9 @@ static off_t stream_skip_bytes(mpg123_handle *fr,off_t len)
}
/* Return 0 on success... */
static int stream_back_bytes(mpg123_handle *fr, off_t bytes)
static int stream_back_bytes(mpg123_handle *fr, int64_t bytes)
{
off_t want = fr->rd->tell(fr)-bytes;
int64_t want = fr->rd->tell(fr)-bytes;
if(want < 0) return READER_ERROR;
if(stream_skip_bytes(fr,-bytes) != want) return READER_ERROR;
......@@ -391,18 +364,18 @@ static int stream_back_bytes(mpg123_handle *fr, off_t bytes)
/* returns size on success... otherwise an error code < 0 */
static int generic_read_frame_body(mpg123_handle *fr,unsigned char *buf, int size)
{
long l;
ptrdiff_t l;
l=fr->rd->fullread(fr,buf,size);
return (l >= 0 && l<size) ? READER_ERROR : l;
return (l >= 0 && l<size) ? READER_ERROR : (int)l;
}
static off_t generic_tell(mpg123_handle *fr)
static int64_t generic_tell(mpg123_handle *fr)
{
#ifndef NO_FEEDER
if(fr->rdat.flags & READER_BUFFERED)
{
fr->rdat.filepos = fr->rdat.buffer.fileoff;
SATURATE_ADD(fr->rdat.filepos, fr->rdat.buffer.pos, OFF_MAX);
SATURATE_ADD(fr->rdat.filepos, fr->rdat.buffer.pos, INT64_MAX);
}
#endif
......@@ -434,17 +407,17 @@ static void stream_rewind(mpg123_handle *fr)
* reads the last 128 bytes information into buffer
* ... that is not totally safe...
*/
static off_t get_fileinfo(mpg123_handle *fr)
static int64_t get_fileinfo(mpg123_handle *fr)
{
off_t len;
int64_t len;
if((len=io_seek(&fr->rdat,0,SEEK_END)) < 0)
if((len=fdseek(fr,0,SEEK_END)) < 0)
{
debug("cannot seek to end");
return -1;
} else if(len >= 128)
{
if(io_seek(&fr->rdat,-128,SEEK_END) < 0)
if(fdseek(fr,-128,SEEK_END) < 0)
{
debug("cannot seek to END-128");
return -1;
......@@ -460,14 +433,14 @@ static off_t get_fileinfo(mpg123_handle *fr)
debug("stream too short for ID3");
}
if(io_seek(&fr->rdat,0,SEEK_SET) < 0)
if(fdseek(fr,0,SEEK_SET) < 0)
{
debug("cannot seek back");
return -1;
}
fr->rdat.filepos = 0; // un-do our seeking here
debug1("returning length: %"OFF_P, (off_p)len);
debug1("returning length: %"PRIi64, len);
return len;
}
......@@ -475,14 +448,16 @@ static off_t get_fileinfo(mpg123_handle *fr)
/* Methods for the buffer chain, mainly used for feed reader, but not just that. */
static struct buffy* buffy_new(size_t size, size_t minsize)
static struct buffy* buffy_new(ptrdiff_t size, ptrdiff_t minsize)
{
struct buffy *newbuf;
if(size > PTRDIFF_MAX)
return NULL;
newbuf = malloc(sizeof(struct buffy));
if(newbuf == NULL) return NULL;
newbuf->realsize = size > minsize ? size : minsize;
newbuf->data = malloc(newbuf->realsize);
newbuf->data = malloc((size_t)newbuf->realsize);
if(newbuf->data == NULL)
{
free(newbuf);
......@@ -513,26 +488,26 @@ static void buffy_del_chain(struct buffy* buf)
}
}
void bc_prepare(struct bufferchain *bc, size_t pool_size, size_t bufblock)
void INT123_bc_prepare(struct bufferchain *bc, size_t pool_size, size_t bufblock)
{
bc_poolsize(bc, pool_size, bufblock);
INT123_bc_poolsize(bc, pool_size, bufblock);
bc->pool = NULL;
bc->pool_fill = 0;
bc_init(bc); /* Ensure that members are zeroed for read-only use. */
}
size_t bc_fill(struct bufferchain *bc)
size_t INT123_bc_fill(struct bufferchain *bc)
{
return (size_t)(bc->size - bc->pos);
}
void bc_poolsize(struct bufferchain *bc, size_t pool_size, size_t bufblock)
void INT123_bc_poolsize(struct bufferchain *bc, size_t pool_size, size_t bufblock)
{
bc->pool_size = pool_size;
bc->bufblock = bufblock;
}
void bc_cleanup(struct bufferchain *bc)
void INT123_bc_cleanup(struct bufferchain *bc)
{
buffy_del_chain(bc->pool);
bc->pool = NULL;
......@@ -625,7 +600,7 @@ static void bc_reset(struct bufferchain *bc)
}
/* Create a new buffy at the end to be filled. */
static int bc_append(struct bufferchain *bc, ssize_t size)
static int bc_append(struct bufferchain *bc, ptrdiff_t size)
{
struct buffy *newbuf;
if(size < 1) return -1;
......@@ -637,16 +612,18 @@ static int bc_append(struct bufferchain *bc, ssize_t size)
else if(bc->first == NULL) bc->first = newbuf;
bc->last = newbuf;
debug3("bc_append: new last buffer %p with %"SSIZE_P" B (really %"SSIZE_P")", (void*)bc->last, (ssize_p)bc->last->size, (ssize_p)bc->last->realsize);
debug3("bc_append: new last buffer %p with %td B (really %td)", (void*)bc->last, bc->last->size, bc->last->realsize);
return 0;
}
/* Append a new buffer and copy content to it. */
static int bc_add(struct bufferchain *bc, const unsigned char *data, ssize_t size)
static int bc_add(struct bufferchain *bc, const unsigned char *data, ptrdiff_t size)
{
int ret = 0;
ssize_t part = 0;
debug2("bc_add: adding %"SSIZE_P" bytes at %"OFF_P, (ssize_p)size, (off_p)(bc->fileoff+bc->size));
ptrdiff_t part = 0;
if((size_t)(PTRDIFF_MAX - bc->size) < size)
return -1;
debug2("bc_add: adding %zu bytes at %"PRIi64, size, (int64_t)(bc->fileoff+bc->size));
if(size >=4) debug4("first bytes: %02x %02x %02x %02x", data[0], data[1], data[2], data[3]);
while(size > 0)
......@@ -657,7 +634,7 @@ static int bc_add(struct bufferchain *bc, const unsigned char *data, ssize_t siz
part = bc->last->realsize - bc->last->size;
if(part > size) part = size;
debug2("bc_add: adding %"SSIZE_P" B to existing block %p", (ssize_p)part, (void*)bc->last);
debug2("bc_add: adding %td B to existing block %p", part, (void*)bc->last);
memcpy(bc->last->data+bc->last->size, data, part);
bc->last->size += part;
size -= part;
......@@ -674,21 +651,21 @@ static int bc_add(struct bufferchain *bc, const unsigned char *data, ssize_t siz
}
/* Common handler for "You want more than I can give." situation. */
static ssize_t bc_need_more(struct bufferchain *bc)
static ptrdiff_t bc_need_more(struct bufferchain *bc, ptrdiff_t size)
{
debug3("hit end, back to beginning (%li - %li < %li)", (long)bc->size, (long)bc->pos, (long)bc->size);
debug3("hit end, back to beginning (%td - %td < %td)", bc->size, bc->pos, size);
/* go back to firstpos, undo the previous reads */
bc->pos = bc->firstpos;
return READER_MORE;
}
/* Give some data, advancing position but not forgetting yet. */
static ssize_t bc_give(struct bufferchain *bc, unsigned char *out, ssize_t size)
static ptrdiff_t bc_give(struct bufferchain *bc, unsigned char *out, ptrdiff_t size)
{
struct buffy *b = bc->first;
ssize_t gotcount = 0;
ssize_t offset = 0;
if(bc->size - bc->pos < size) return bc_need_more(bc);
ptrdiff_t gotcount = 0;
ptrdiff_t offset = 0;
if(bc->size - bc->pos < size) return bc_need_more(bc, size);
/* find the current buffer */
while(b != NULL && (offset + b->size) <= bc->pos)
......@@ -699,8 +676,8 @@ static ssize_t bc_give(struct bufferchain *bc, unsigned char *out, ssize_t size)
/* now start copying from there */
while(gotcount < size && (b != NULL))
{
ssize_t loff = bc->pos - offset;
ssize_t chunk = size - gotcount; /* amount of bytes to get from here... */
ptrdiff_t loff = bc->pos - offset;
ptrdiff_t chunk = size - gotcount; /* amount of bytes to get from here... */
if(chunk > b->size - loff) chunk = b->size - loff;
#ifdef EXTRA_DEBUG
......@@ -722,17 +699,17 @@ static ssize_t bc_give(struct bufferchain *bc, unsigned char *out, ssize_t size)
/* Skip some bytes and return the new position.
The buffers are still there, just the read pointer is moved! */
static ssize_t bc_skip(struct bufferchain *bc, ssize_t count)
static ptrdiff_t bc_skip(struct bufferchain *bc, ptrdiff_t count)
{
if(count >= 0)
{
if(bc->size - bc->pos < count) return bc_need_more(bc);
if(bc->size - bc->pos < count) return bc_need_more(bc, count);
else return bc->pos += count;
}
else return READER_ERROR;
}
static ssize_t bc_seekback(struct bufferchain *bc, ssize_t count)
static ptrdiff_t bc_seekback(struct bufferchain *bc, ptrdiff_t count)
{
if(count >= 0 && count <= bc->pos) return bc->pos -= count;
else return READER_ERROR;
......@@ -744,7 +721,7 @@ static void bc_forget(struct bufferchain *bc)
struct buffy *b = bc->first;
/* free all buffers that are def'n'tly outdated */
/* we have buffers until filepos... delete all buffers fully below it */
if(b) debug2("bc_forget: block %lu pos %lu", (unsigned long)b->size, (unsigned long)bc->pos);
if(b) debug2("bc_forget: block %td pos %td", b->size, bc->pos);
else debug("forget with nothing there!");
while(b != NULL && bc->pos >= b->size)
......@@ -755,7 +732,8 @@ static void bc_forget(struct bufferchain *bc)
bc->pos -= b->size;
bc->size -= b->size;
debug5("bc_forget: forgot %p with %lu, pos=%li, size=%li, fileoff=%li", (void*)b->data, (long)b->size, (long)bc->pos, (long)bc->size, (long)bc->fileoff);
debug5("bc_forget: forgot %p with %td, pos=%td, size=%td, fileoff=%td"
, (void*)b->data, b->size, bc->pos, bc->size, bc->fileoff);
bc_free(bc, b);
b = n;
......@@ -777,98 +755,104 @@ static int feed_init(mpg123_handle *fr)
}
/* externally called function, returns 0 on success, -1 on error */
int feed_more(mpg123_handle *fr, const unsigned char *in, long count)
// External API uses size_t, we use signed ptrdiff_t internally. Overflow
// is a theoretical possibility.
int INT123_feed_more(mpg123_handle *fr, const unsigned char *in, size_t count)
{
int ret = 0;
if(VERBOSE3) debug("feed_more");
if((ret = bc_add(&fr->rdat.buffer, in, count)) != 0)
if(VERBOSE3) debug("INT123_feed_more");
if(count > PTRDIFF_MAX)
return READER_ERROR;
if((ret = bc_add(&fr->rdat.buffer, in, (ptrdiff_t)count)) != 0)
{
ret = READER_ERROR;
if(NOQUIET) error1("Failed to add buffer, return: %i", ret);
}
else /* Not talking about filelen... that stays at 0. */
if(VERBOSE3) debug3("feed_more: %p %luB bufsize=%lu", fr->rdat.buffer.last->data,
if(VERBOSE3) debug3("INT123_feed_more: %p %luB bufsize=%lu", fr->rdat.buffer.last->data,
(unsigned long)fr->rdat.buffer.last->size, (unsigned long)fr->rdat.buffer.size);
return ret;
}
static ssize_t feed_read(mpg123_handle *fr, unsigned char *out, ssize_t count)
static ptrdiff_t feed_read(mpg123_handle *fr, unsigned char *out, ptrdiff_t count)
{
ssize_t gotcount = bc_give(&fr->rdat.buffer, out, count);
ptrdiff_t gotcount = bc_give(&fr->rdat.buffer, out, count);
if(gotcount >= 0 && gotcount != count) return READER_ERROR;
else return gotcount;
}
/* returns reached position... negative ones are bad... */
static off_t feed_skip_bytes(mpg123_handle *fr,off_t len)
static int64_t feed_skip_bytes(mpg123_handle *fr, int64_t len)
{
/* This is either the new buffer offset or some negative error value. */
off_t res = bc_skip(&fr->rdat.buffer, (ssize_t)len);
int64_t res = bc_skip(&fr->rdat.buffer, (ptrdiff_t)len);
if(res < 0) return res;
return fr->rdat.buffer.fileoff+res;
}
static int feed_back_bytes(mpg123_handle *fr, off_t bytes)
static int feed_back_bytes(mpg123_handle *fr, int64_t bytes)
{
if(bytes >=0)
return bc_seekback(&fr->rdat.buffer, (ssize_t)bytes) >= 0 ? 0 : READER_ERROR;
return bc_seekback(&fr->rdat.buffer, (ptrdiff_t)bytes) >= 0 ? 0 : READER_ERROR;
else
return feed_skip_bytes(fr, -bytes) >= 0 ? 0 : READER_ERROR;
}
static int feed_seek_frame(mpg123_handle *fr, off_t num){ return READER_ERROR; }
static int feed_seek_frame(mpg123_handle *fr, int64_t num){ return READER_ERROR; }
/* Not just for feed reader, also for self-feeding buffered reader. */
static void buffered_forget(mpg123_handle *fr)
{
bc_forget(&fr->rdat.buffer);
fr->rdat.filepos = fr->rdat.buffer.fileoff;
SATURATE_ADD(fr->rdat.filepos, fr->rdat.buffer.pos, OFF_MAX);
SATURATE_ADD(fr->rdat.filepos, fr->rdat.buffer.pos, INT64_MAX);
}
off_t feed_set_pos(mpg123_handle *fr, off_t pos)
int64_t INT123_feed_set_pos(mpg123_handle *fr, int64_t pos)
{
struct bufferchain *bc = &fr->rdat.buffer;
if(pos >= bc->fileoff && pos-bc->fileoff < bc->size)
{ /* We have the position! */
bc->pos = (ssize_t)(pos - bc->fileoff);
debug1("feed_set_pos inside, next feed from %"OFF_P, (off_p)(bc->fileoff+bc->size));
bc->pos = (ptrdiff_t)(pos - bc->fileoff);
debug1("INT123_feed_set_pos inside, next feed from %"PRIi64, (int64_t)(bc->fileoff+bc->size));
return bc->fileoff+bc->size; /* Next input after end of buffer... */
}
else
{ /* I expect to get the specific position on next feed. Forget what I have now. */
bc_reset(bc);
bc->fileoff = pos;
debug1("feed_set_pos outside, buffer reset, next feed from %"OFF_P, (off_p)pos);
debug1("INT123_feed_set_pos outside, buffer reset, next feed from %"PRIi64, pos);
return pos; /* Next input from exactly that position. */
}
}
/* The specific stuff for buffered stream reader. */
static ssize_t buffered_fullread(mpg123_handle *fr, unsigned char *out, ssize_t count)
static ptrdiff_t buffered_fullread(mpg123_handle *fr, unsigned char *out, ptrdiff_t count
, ptrdiff_t (*fullread)(mpg123_handle *, unsigned char *, ptrdiff_t))
{
struct bufferchain *bc = &fr->rdat.buffer;
ssize_t gotcount;
ptrdiff_t gotcount;
if(VERBOSE3)
mdebug("buffered_fullread: want %zd", count);
if(bc->size - bc->pos < count)
{ /* Add more stuff to buffer. If hitting end of file, adjust count. */
unsigned char readbuf[4096];
ssize_t need = count - (bc->size-bc->pos);
ptrdiff_t need = count - (bc->size-bc->pos);
while(need>0)
{
int ret;
ssize_t got = fr->rdat.fullread(fr, readbuf, sizeof(readbuf));
ptrdiff_t got = fullread(fr, readbuf, sizeof(readbuf));
if(got < 0)
{
if(NOQUIET) error("buffer reading");
return READER_ERROR;
}
if(VERBOSE3) debug1("buffered_fullread: buffering %li bytes from stream (if > 0)", (long)got);
if(VERBOSE3)
debug1("buffered_fullread: buffering %td bytes from stream (if > 0)", got);
if(got > 0 && (ret=bc_add(bc, readbuf, got)) != 0)
{
if(NOQUIET) error1("unable to add to chain, return: %i", ret);
......@@ -887,17 +871,28 @@ static ssize_t buffered_fullread(mpg123_handle *fr, unsigned char *out, ssize_t
}
gotcount = bc_give(bc, out, count);
if(VERBOSE3)
mdebug("buffered_fullread: got %zd", gotcount);
mdebug("buffered_fullread: got %td", gotcount);
if(gotcount != count){ if(NOQUIET) error("gotcount != count"); return READER_ERROR; }
else return gotcount;
}
static ptrdiff_t buffered_plain_fullread(mpg123_handle *fr, unsigned char *out, ptrdiff_t count)
{
return buffered_fullread(fr, out, count, plain_fullread);
}
static ptrdiff_t buffered_icy_fullread(mpg123_handle *fr, unsigned char *out, ptrdiff_t count)
{
return buffered_fullread(fr, out, count, icy_fullread);
}
#else
int feed_more(mpg123_handle *fr, const unsigned char *in, long count)
int INT123_feed_more(mpg123_handle *fr, const unsigned char *in, size_t count)
{
fr->err = MPG123_MISSING_FEATURE;
return -1;
}
off_t feed_set_pos(mpg123_handle *fr, off_t pos)
int64_t INT123_feed_set_pos(mpg123_handle *fr, int64_t pos)
{
fr->err = MPG123_MISSING_FEATURE;
return -1;
......@@ -911,14 +906,14 @@ off_t feed_set_pos(mpg123_handle *fr, off_t pos)
#define bugger_off { mh->err = MPG123_NO_READER; return MPG123_ERR; }
static int bad_init(mpg123_handle *mh) bugger_off
static void bad_close(mpg123_handle *mh){}
static ssize_t bad_fullread(mpg123_handle *mh, unsigned char *data, ssize_t count) bugger_off
static ptrdiff_t bad_fullread(mpg123_handle *mh, unsigned char *data, ptrdiff_t count) bugger_off
static int bad_head_read(mpg123_handle *mh, unsigned long *newhead) bugger_off
static int bad_head_shift(mpg123_handle *mh, unsigned long *head) bugger_off
static off_t bad_skip_bytes(mpg123_handle *mh, off_t len) bugger_off
static int64_t bad_skip_bytes(mpg123_handle *mh, int64_t len) bugger_off
static int bad_read_frame_body(mpg123_handle *mh, unsigned char *data, int size) bugger_off
static int bad_back_bytes(mpg123_handle *mh, off_t bytes) bugger_off
static int bad_seek_frame(mpg123_handle *mh, off_t num) bugger_off
static off_t bad_tell(mpg123_handle *mh) bugger_off
static int bad_back_bytes(mpg123_handle *mh, int64_t bytes) bugger_off
static int bad_seek_frame(mpg123_handle *mh, int64_t num) bugger_off
static int64_t bad_tell(mpg123_handle *mh) bugger_off
static void bad_rewind(mpg123_handle *mh){}
#undef bugger_off
......@@ -930,7 +925,7 @@ static void bad_rewind(mpg123_handle *mh){}
static struct reader readers[] =
{
{ /* READER_STREAM */
default_init,
stream_init,
stream_close,
plain_fullread,
generic_head_read,
......@@ -944,7 +939,7 @@ static struct reader readers[] =
NULL
} ,
{ /* READER_ICY_STREAM */
default_init,
stream_init,
stream_close,
icy_fullread,
generic_head_read,
......@@ -961,6 +956,8 @@ static struct reader readers[] =
#define feed_init NULL
#define feed_read NULL
#define buffered_fullread NULL
#define buffered_plain_fullread NULL
#define buffered_icy_fullread NULL
#define feed_seek_frame NULL
#define feed_back_bytes NULL
#define feed_skip_bytes NULL
......@@ -981,9 +978,9 @@ static struct reader readers[] =
buffered_forget
},
{ /* READER_BUF_STREAM */
default_init,
stream_init,
stream_close,
buffered_fullread,
buffered_plain_fullread,
generic_head_read,
generic_head_shift,
stream_skip_bytes,
......@@ -995,9 +992,9 @@ static struct reader readers[] =
buffered_forget
} ,
{ /* READER_BUF_ICY_STREAM */
default_init,
stream_init,
stream_close,
buffered_fullread,
buffered_icy_fullread,
generic_head_read,
generic_head_shift,
stream_skip_bytes,
......@@ -1008,22 +1005,6 @@ static struct reader readers[] =
stream_rewind,
buffered_forget
},
#ifdef READ_SYSTEM
,{
system_init,
NULL, /* filled in by system_init() */
fullread,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
#endif
};
static struct reader bad_reader =
......@@ -1042,41 +1023,20 @@ static struct reader bad_reader =
NULL
};
static int default_init(mpg123_handle *fr)
static int stream_init(mpg123_handle *fr)
{
#ifdef TIMEOUT_READ
if(fr->p.timeout > 0)
{
int flags;
if(fr->rdat.r_read != NULL)
{
if(NOQUIET)
error( "Timeout reading does not work with user-provided"
" read function. Implement it yourself!" );
return -1;
}
flags = fcntl(fr->rdat.filept, F_GETFL);
flags |= O_NONBLOCK;
fcntl(fr->rdat.filept, F_SETFL, flags);
fr->rdat.fdread = timeout_read;
fr->rdat.timeout_sec = fr->p.timeout;
fr->rdat.flags |= READER_NONBLOCK;
}
else
#endif
fr->rdat.fdread = plain_read;
fr->rdat.read = fr->rdat.r_read != NULL ? fr->rdat.r_read : posix_read;
fr->rdat.lseek = fr->rdat.r_lseek != NULL ? fr->rdat.r_lseek : posix_lseek;
#ifndef NO_ICY
/* ICY streams of any sort shall not be seekable. */
if(fr->p.icy_interval > 0) fr->rdat.lseek = nix_lseek;
if(fr->p.icy_interval > 0) fr->rdat.flags |= READER_NOSEEK;
#endif
fr->rdat.filepos = 0;
fr->rdat.filelen = fr->p.flags & MPG123_NO_PEEK_END ? -1 : get_fileinfo(fr);
if(fr->p.flags & MPG123_FORCE_SEEKABLE)
{
fr->rdat.flags |= READER_SEEKABLE;
fr->rdat.flags &= ~READER_NOSEEK;
}
/*
Don't enable seeking on ICY streams, just plain normal files.
This check is necessary since the client can enforce ICY parsing on files that would otherwise be seekable.
......@@ -1105,14 +1065,12 @@ static int default_init(mpg123_handle *fr)
{
debug("switching to buffered stream reader");
fr->rd = &readers[READER_BUF_STREAM];
fr->rdat.fullread = plain_fullread;
}
#ifndef NO_ICY
else if(fr->rd == &readers[READER_ICY_STREAM])
{
debug("switching to buffered ICY stream reader");
fr->rd = &readers[READER_BUF_ICY_STREAM];
fr->rdat.fullread = icy_fullread;
}
#endif
else
......@@ -1129,11 +1087,11 @@ static int default_init(mpg123_handle *fr)
}
void open_bad(mpg123_handle *mh)
void INT123_open_bad(mpg123_handle *mh)
{
debug("open_bad");
debug("INT123_open_bad");
#ifndef NO_ICY
clear_icy(&mh->icy);
INT123_clear_icy(&mh->icy);
#endif
mh->rd = &bad_reader;
mh->rdat.flags = 0;
......@@ -1143,7 +1101,7 @@ void open_bad(mpg123_handle *mh)
mh->rdat.filelen = -1;
}
int open_feed(mpg123_handle *fr)
int INT123_open_feed(mpg123_handle *fr)
{
debug("feed reader");
#ifdef NO_FEEDER
......@@ -1159,7 +1117,7 @@ int open_feed(mpg123_handle *fr)
return -1;
}
clear_icy(&fr->icy);
INT123_clear_icy(&fr->icy);
#endif
fr->rd = &readers[READER_FEED];
fr->rdat.flags = 0;
......@@ -1170,9 +1128,15 @@ int open_feed(mpg123_handle *fr)
#endif /* NO_FEEDER */
}
/* Final code common to open_stream and open_stream_handle. */
static int open_finish(mpg123_handle *fr)
/* Final code common to open_stream and INT123_open_stream_handle. */
int INT123_open_stream_handle(mpg123_handle *fr, void *iohandle)
{
INT123_clear_icy(&fr->icy); /* can be done inside frame_clear ...? */
fr->rdat.filelen = -1;
fr->rdat.iohandle = iohandle;
fr->rdat.flags = 0;
fr->rdat.flags |= READER_HANDLEIO;
#ifndef NO_ICY
if(fr->p.icy_interval > 0)
{
......@@ -1192,75 +1156,3 @@ static int open_finish(mpg123_handle *fr)
return MPG123_OK;
}
int open_stream(mpg123_handle *fr, const char *bs_filenam, int fd)
{
int filept_opened = 1;
int filept; /* descriptor of opened file/stream */
clear_icy(&fr->icy); /* can be done inside frame_clear ...? */
if(!bs_filenam) /* no file to open, got a descriptor (stdin) */
{
filept = fd;
filept_opened = 0; /* and don't try to close it... */
}
#ifndef O_BINARY
#define O_BINARY (0)
#endif
else if((filept = compat_open(bs_filenam, O_RDONLY|O_BINARY)) < 0) /* a plain old file to open... */
{
if(NOQUIET) error2("Cannot open file %s: %s", bs_filenam, strerror(errno));
fr->err = MPG123_BAD_FILE;
return MPG123_ERR; /* error... */
}
/* now we have something behind filept and can init the reader */
fr->rdat.filelen = -1;
fr->rdat.filept = filept;
fr->rdat.flags = 0;
if(filept_opened) fr->rdat.flags |= READER_FD_OPENED;
return open_finish(fr);
}
int open_stream_handle(mpg123_handle *fr, void *iohandle)
{
clear_icy(&fr->icy); /* can be done inside frame_clear ...? */
fr->rdat.filelen = -1;
fr->rdat.filept = -1;
fr->rdat.iohandle = iohandle;
fr->rdat.flags = 0;
fr->rdat.flags |= READER_HANDLEIO;
return open_finish(fr);
}
/* Wrappers for actual reading/seeking... I'm full of wrappers here. */
static off_t io_seek(struct reader_data *rdat, off_t offset, int whence)
{
if(rdat->flags & READER_HANDLEIO)
{
if(rdat->r_lseek_handle != NULL)
{
return rdat->r_lseek_handle(rdat->iohandle, offset, whence);
}
else return -1;
}
else
return rdat->lseek(rdat->filept, offset, whence);
}
static ssize_t io_read(struct reader_data *rdat, void *buf, size_t count)
{
if(rdat->flags & READER_HANDLEIO)
{
if(rdat->r_read_handle != NULL)
{
return rdat->r_read_handle(rdat->iohandle, buf, count);
}
else return -1;
}
else
return rdat->read(rdat->filept, buf, count);
}
......@@ -71,8 +71,8 @@ int attribute_align_arg mpg123_resize_string(mpg123_string* sb, size_t new)
{
char* t;
debug("really!");
t = (char*) safe_realloc(sb->p, new*sizeof(char));
debug1("safe_realloc returned %p", (void*) t);
t = (char*) INT123_safe_realloc(sb->p, new*sizeof(char));
debug1("INT123_safe_realloc returned %p", (void*) t);
if(t != NULL)
{
sb->p = t;
......@@ -217,23 +217,19 @@ size_t attribute_align_arg mpg123_strlen(mpg123_string *sb, int utf8)
int attribute_align_arg mpg123_chomp_string(mpg123_string *sb)
{
ssize_t i;
if(!sb || !sb->fill) return 0;
/* Ensure that it is zero-terminated. */
sb->p[sb->fill-1] = 0;
for(i=sb->fill-2; i>=0; --i)
char *c = sb->p+sb->fill-1;
*c = 0;
for(; c >= sb->p; --c)
{
char *c = sb->p+i;
/* Stop at the first proper character. */
if(*c && *c != '\r' && *c != '\n') break;
else *c = 0;
}
/* initial fill at least 1, so i at least -1,
+2 means nothing happened for fill=1 .
With i=0, we got one non-null character, fill shall be 2
to accomodate the trailing zero. */
sb->fill = (size_t)i+2;
// We at least got a trailing zero.
sb->fill = (size_t)(c - sb->p + 1) + 1;
return 1;
}
......
......@@ -16,9 +16,9 @@
/*
Part 1: All synth functions that produce signed short.
That is:
- synth_1to1 with cpu-specific variants (synth_1to1_i386, synth_1to1_i586 ...)
- synth_1to1_mono and synth_1to1_m2s; which use fr->synths.plain[r_1to1][f_16].
Nearly every decoder variant has it's own synth_1to1, while the mono conversion is shared.
- INT123_synth_1to1 with cpu-specific variants (INT123_synth_1to1_i386, INT123_synth_1to1_i586 ...)
- INT123_synth_1to1_mono and INT123_synth_1to1_m2s; which use fr->synths.plain[r_1to1][f_16].
Nearly every decoder variant has it's own INT123_synth_1to1, while the mono conversion is shared.
*/
#define SAMPLE_T short
......@@ -27,24 +27,24 @@
/* Part 1a: All straight 1to1 decoding functions */
#define BLOCK 0x40 /* One decoding block is 64 samples. */
#define SYNTH_NAME synth_1to1
#define SYNTH_NAME INT123_synth_1to1
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_1to1. */
/* Mono-related synths; they wrap over _some_ INT123_synth_1to1. */
#define SYNTH_NAME fr->synths.plain[r_1to1][f_16]
#define MONO_NAME synth_1to1_mono
#define MONO2STEREO_NAME synth_1to1_m2s
#define MONO_NAME INT123_synth_1to1_mono
#define MONO2STEREO_NAME INT123_synth_1to1_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
#undef MONO2STEREO_NAME
/* Now we have possibly some special synth_1to1 ...
/* Now we have possibly some special INT123_synth_1to1 ...
... they produce signed short; the mono functions defined above work on the special synths, too. */
#ifdef OPT_GENERIC_DITHER
#define SYNTH_NAME synth_1to1_dither
#define SYNTH_NAME INT123_synth_1to1_dither
/* We need the accurate sample writing... */
#undef WRITE_SAMPLE
#define WRITE_SAMPLE(samples,sum,clip) WRITE_SHORT_SAMPLE_ACCURATE(samples,sum,clip)
......@@ -62,7 +62,7 @@
#ifdef OPT_X86
/* The i386-specific C code, here as short variant, later 8bit and float. */
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_1to1_i386
#define SYNTH_NAME INT123_synth_1to1_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -73,15 +73,15 @@
#ifdef OPT_I586
/* This is defined in assembler. */
int synth_1to1_i586_asm(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin);
int INT123_synth_1to1_i586_asm(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_i586(real *bandPtr, int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_i586(real *bandPtr, int channel, mpg123_handle *fr, int final)
{
int ret;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
ret = synth_1to1_i586_asm(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, &fr->bo, fr->decwin);
ret = INT123_synth_1to1_i586_asm(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, &fr->bo, fr->decwin);
if(final) fr->buffer.fill += 128;
return ret;
}
......@@ -89,19 +89,19 @@ int synth_1to1_i586(real *bandPtr, int channel, mpg123_handle *fr, int final)
#ifdef OPT_I586_DITHER
/* This is defined in assembler. */
int synth_1to1_i586_asm_dither(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin, float *dithernoise);
int INT123_synth_1to1_i586_asm_dither(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin, float *dithernoise);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_i586_dither(real *bandPtr, int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_i586_dither(real *bandPtr, int channel, mpg123_handle *fr, int final)
{
int ret;
int bo_dither[2]; /* Temporary workaround? Could expand the asm code. */
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
/* Applying this hack, to change the asm only bit by bit (adding dithernoise pointer). */
bo_dither[0] = fr->bo;
bo_dither[1] = fr->ditherindex;
ret = synth_1to1_i586_asm_dither(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, bo_dither, fr->decwin, fr->dithernoise);
ret = INT123_synth_1to1_i586_asm_dither(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, bo_dither, fr->decwin, fr->dithernoise);
fr->bo = bo_dither[0];
fr->ditherindex = bo_dither[1];
......@@ -112,18 +112,18 @@ int synth_1to1_i586_dither(real *bandPtr, int channel, mpg123_handle *fr, int fi
#if defined(OPT_3DNOW) || defined(OPT_3DNOW_VINTAGE)
/* Those are defined in assembler. */
void do_equalizer_3dnow(real *bandPtr,int channel, real equalizer[2][32]);
int synth_1to1_3dnow_asm(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin);
void INT123_do_equalizer_3dnow(real *bandPtr,int channel, real equalizer[2][32]);
int INT123_synth_1to1_3dnow_asm(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_3dnow(real *bandPtr, int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_3dnow(real *bandPtr, int channel, mpg123_handle *fr, int final)
{
int ret;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer_3dnow(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer_3dnow(bandPtr,channel,fr->equalizer);
#endif
/* this is in asm, can be dither or not */
/* uh, is this return from pointer correct? */
ret = (int) synth_1to1_3dnow_asm(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, &fr->bo, fr->decwin);
ret = (int) INT123_synth_1to1_3dnow_asm(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, &fr->bo, fr->decwin);
if(final) fr->buffer.fill += 128;
return ret;
}
......@@ -131,15 +131,15 @@ int synth_1to1_3dnow(real *bandPtr, int channel, mpg123_handle *fr, int final)
#ifdef OPT_MMX
/* This is defined in assembler. */
int synth_1to1_MMX(real *bandPtr, int channel, short *out, short *buffs, int *bo, float *decwins);
int INT123_synth_1to1_MMX(real *bandPtr, int channel, short *out, short *buffs, int *bo, float *decwins);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_mmx(real *bandPtr, int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_mmx(real *bandPtr, int channel, mpg123_handle *fr, int final)
{
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
/* in asm */
synth_1to1_MMX(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
INT123_synth_1to1_MMX(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
if(final) fr->buffer.fill += 128;
return 0;
}
......@@ -148,18 +148,18 @@ int synth_1to1_mmx(real *bandPtr, int channel, mpg123_handle *fr, int final)
#if defined(OPT_SSE) || defined(OPT_SSE_VINTAGE)
#ifdef ACCURATE_ROUNDING
/* This is defined in assembler. */
int synth_1to1_sse_accurate_asm(real *window, real *b0, short *samples, int bo1);
int synth_1to1_s_sse_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void dct64_real_sse(real *out0, real *out1, real *samples);
int INT123_synth_1to1_sse_accurate_asm(real *window, real *b0, short *samples, int bo1);
int INT123_synth_1to1_s_sse_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void INT123_dct64_real_sse(real *out0, real *out1, real *samples);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
real *b0, **buf;
int clip;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -177,23 +177,23 @@ int synth_1to1_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_sse(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_sse(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_sse(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_sse(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_sse_accurate_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_sse_accurate_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -203,8 +203,8 @@ int synth_1to1_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -217,19 +217,19 @@ int synth_1to1_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_sse_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_sse_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -237,14 +237,14 @@ int synth_1to1_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
}
#else
/* This is defined in assembler. */
void synth_1to1_sse_asm(real *bandPtr, int channel, short *samples, short *buffs, int *bo, real *decwin);
void INT123_synth_1to1_sse_asm(real *bandPtr, int channel, short *samples, short *buffs, int *bo, real *decwin);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_sse(real *bandPtr, int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_sse(real *bandPtr, int channel, mpg123_handle *fr, int final)
{
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
synth_1to1_sse_asm(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
INT123_synth_1to1_sse_asm(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
if(final) fr->buffer.fill += 128;
return 0;
}
......@@ -253,14 +253,14 @@ int synth_1to1_sse(real *bandPtr, int channel, mpg123_handle *fr, int final)
#if defined(OPT_3DNOWEXT) || defined(OPT_3DNOWEXT_VINTAGE)
/* This is defined in assembler. */
void synth_1to1_3dnowext_asm(real *bandPtr, int channel, short *samples, short *buffs, int *bo, real *decwin);
void INT123_synth_1to1_3dnowext_asm(real *bandPtr, int channel, short *samples, short *buffs, int *bo, real *decwin);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_3dnowext(real *bandPtr, int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_3dnowext(real *bandPtr, int channel, mpg123_handle *fr, int final)
{
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
synth_1to1_3dnowext_asm(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
INT123_synth_1to1_3dnowext_asm(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
if(final) fr->buffer.fill += 128;
return 0;
}
......@@ -269,11 +269,11 @@ int synth_1to1_3dnowext(real *bandPtr, int channel, mpg123_handle *fr, int final
#ifdef OPT_X86_64
#ifdef ACCURATE_ROUNDING
/* Assembler routines. */
int synth_1to1_x86_64_accurate_asm(real *window, real *b0, short *samples, int bo1);
int synth_1to1_s_x86_64_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void dct64_real_x86_64(real *out0, real *out1, real *samples);
int INT123_synth_1to1_x86_64_accurate_asm(real *window, real *b0, short *samples, int bo1);
int INT123_synth_1to1_s_x86_64_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void INT123_dct64_real_x86_64(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -281,7 +281,7 @@ int synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -299,23 +299,23 @@ int synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_x86_64_accurate_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_x86_64_accurate_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -325,8 +325,8 @@ int synth_1to1_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -339,19 +339,19 @@ int synth_1to1_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_x86_64_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_x86_64_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -359,18 +359,18 @@ int synth_1to1_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr
}
#else
/* This is defined in assembler. */
int synth_1to1_x86_64_asm(short *window, short *b0, short *samples, int bo1);
int synth_1to1_s_x86_64_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
void dct64_x86_64(short *out0, short *out1, real *samples);
int INT123_synth_1to1_x86_64_asm(short *window, short *b0, short *samples, int bo1);
int INT123_synth_1to1_s_x86_64_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
void INT123_dct64_x86_64(short *out0, short *out1, real *samples);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
short *b0, **buf;
int clip;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -388,23 +388,23 @@ int synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_x86_64_asm((short *)fr->decwins, b0, samples, bo1);
clip = INT123_synth_1to1_x86_64_asm((short *)fr->decwins, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_x86_64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_x86_64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
short *b0l, *b0r, **bufl, **bufr;
......@@ -413,8 +413,8 @@ int synth_1to1_stereo_x86_64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -427,19 +427,19 @@ int synth_1to1_stereo_x86_64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_x86_64_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_x86_64_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -452,12 +452,12 @@ int synth_1to1_stereo_x86_64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifdef ACCURATE_ROUNDING
/* Assembler routines. */
#ifndef OPT_X86_64
int synth_1to1_x86_64_accurate_asm(real *window, real *b0, short *samples, int bo1);
int INT123_synth_1to1_x86_64_accurate_asm(real *window, real *b0, short *samples, int bo1);
#endif
int synth_1to1_s_avx_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void dct64_real_avx(real *out0, real *out1, real *samples);
int INT123_synth_1to1_s_avx_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void INT123_dct64_real_avx(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -465,7 +465,7 @@ int synth_1to1_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -483,23 +483,23 @@ int synth_1to1_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_avx(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_avx(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_avx(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_avx(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_x86_64_accurate_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_x86_64_accurate_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -509,8 +509,8 @@ int synth_1to1_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -523,19 +523,19 @@ int synth_1to1_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_avx(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_avx(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_avx(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_avx(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_avx(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_avx(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_avx(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_avx(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_avx_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_avx_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -544,19 +544,19 @@ int synth_1to1_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#else
/* This is defined in assembler. */
#ifndef OPT_X86_64
int synth_1to1_x86_64_asm(short *window, short *b0, short *samples, int bo1);
int INT123_synth_1to1_x86_64_asm(short *window, short *b0, short *samples, int bo1);
#endif
int synth_1to1_s_avx_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
void dct64_avx(short *out0, short *out1, real *samples);
int INT123_synth_1to1_s_avx_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
void INT123_dct64_avx(short *out0, short *out1, real *samples);
/* This is just a hull to use the mpg123 handle. */
int synth_1to1_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
short *b0, **buf;
int clip;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -574,23 +574,23 @@ int synth_1to1_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_avx(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_avx(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_avx(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_avx(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_x86_64_asm((short *)fr->decwins, b0, samples, bo1);
clip = INT123_synth_1to1_x86_64_asm((short *)fr->decwins, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_avx(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_avx(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
short *b0l, *b0r, **bufl, **bufr;
......@@ -599,8 +599,8 @@ int synth_1to1_stereo_avx(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -613,19 +613,19 @@ int synth_1to1_stereo_avx(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_avx(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_avx(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_avx(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_avx(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_avx(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_avx(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_avx(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_avx(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_avx_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_avx_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -637,9 +637,9 @@ int synth_1to1_stereo_avx(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifdef OPT_ARM
#ifdef ACCURATE_ROUNDING
/* Assembler routines. */
int synth_1to1_arm_accurate_asm(real *window, real *b0, short *samples, int bo1);
int INT123_synth_1to1_arm_accurate_asm(real *window, real *b0, short *samples, int bo1);
/* Hull for C mpg123 API */
int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -647,7 +647,7 @@ int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -665,16 +665,16 @@ int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_arm_accurate_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_arm_accurate_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
......@@ -682,9 +682,9 @@ int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
}
#else
/* Assembler routines. */
int synth_1to1_arm_asm(real *window, real *b0, short *samples, int bo1);
int INT123_synth_1to1_arm_asm(real *window, real *b0, short *samples, int bo1);
/* Hull for C mpg123 API */
int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -692,7 +692,7 @@ int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -710,16 +710,16 @@ int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_arm_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_arm_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
......@@ -731,11 +731,11 @@ int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
#ifdef OPT_NEON
#ifdef ACCURATE_ROUNDING
/* This is defined in assembler. */
int synth_1to1_neon_accurate_asm(real *window, real *b0, short *samples, int bo1);
int synth_1to1_s_neon_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void dct64_real_neon(real *out0, real *out1, real *samples);
int INT123_synth_1to1_neon_accurate_asm(real *window, real *b0, short *samples, int bo1);
int INT123_synth_1to1_s_neon_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void INT123_dct64_real_neon(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -743,7 +743,7 @@ int synth_1to1_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -761,23 +761,23 @@ int synth_1to1_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_neon(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_neon(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_neon(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_neon(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_neon_accurate_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_neon_accurate_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -787,8 +787,8 @@ int synth_1to1_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -801,19 +801,19 @@ int synth_1to1_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_neon(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_neon(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_neon(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_neon(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_neon(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_neon(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_neon(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_neon(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_neon_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_neon_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -821,18 +821,18 @@ int synth_1to1_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
}
#else
/* This is defined in assembler. */
int synth_1to1_neon_asm(short *window, short *b0, short *samples, int bo1);
int synth_1to1_s_neon_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
void dct64_neon(short *out0, short *out1, real *samples);
int INT123_synth_1to1_neon_asm(short *window, short *b0, short *samples, int bo1);
int INT123_synth_1to1_s_neon_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
void INT123_dct64_neon(short *out0, short *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
short *b0, **buf;
int clip;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -850,23 +850,23 @@ int synth_1to1_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_neon(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_neon(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_neon(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_neon(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_neon_asm((short *)fr->decwins, b0, samples, bo1);
clip = INT123_synth_1to1_neon_asm((short *)fr->decwins, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_neon(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_neon(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
short *b0l, *b0r, **bufl, **bufr;
......@@ -875,8 +875,8 @@ int synth_1to1_stereo_neon(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -889,19 +889,19 @@ int synth_1to1_stereo_neon(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_neon(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_neon(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_neon(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_neon(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_neon(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_neon(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_neon(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_neon(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_neon_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_neon_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -913,11 +913,11 @@ int synth_1to1_stereo_neon(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifdef OPT_NEON64
#ifdef ACCURATE_ROUNDING
/* This is defined in assembler. */
int synth_1to1_neon64_accurate_asm(real *window, real *b0, short *samples, int bo1);
int synth_1to1_s_neon64_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void dct64_real_neon64(real *out0, real *out1, real *samples);
int INT123_synth_1to1_neon64_accurate_asm(real *window, real *b0, short *samples, int bo1);
int INT123_synth_1to1_s_neon64_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
void INT123_dct64_real_neon64(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -925,7 +925,7 @@ int synth_1to1_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -943,23 +943,23 @@ int synth_1to1_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_neon64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_neon64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_neon64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_neon64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_neon64_accurate_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_neon64_accurate_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
......@@ -969,8 +969,8 @@ int synth_1to1_stereo_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -983,19 +983,19 @@ int synth_1to1_stereo_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_neon64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_neon64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_neon64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_neon64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_neon64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_neon64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_neon64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_neon64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_neon64_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_neon64_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -1003,18 +1003,18 @@ int synth_1to1_stereo_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr
}
#else
/* This is defined in assembler. */
int synth_1to1_neon64_asm(short *window, short *b0, short *samples, int bo1);
int synth_1to1_s_neon64_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
void dct64_neon64(short *out0, short *out1, real *samples);
int INT123_synth_1to1_neon64_asm(short *window, short *b0, short *samples, int bo1);
int INT123_synth_1to1_s_neon64_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
void INT123_dct64_neon64(short *out0, short *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
short *b0, **buf;
int clip;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -1032,23 +1032,23 @@ int synth_1to1_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_neon64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_neon64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_neon64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_neon64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_neon64_asm((short *)fr->decwins, b0, samples, bo1);
clip = INT123_synth_1to1_neon64_asm((short *)fr->decwins, b0, samples, bo1);
if(final) fr->buffer.fill += 128;
return clip;
}
int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
{
short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
short *b0l, *b0r, **bufl, **bufr;
......@@ -1057,8 +1057,8 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -1071,19 +1071,19 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_neon64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_neon64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_neon64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_neon64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_neon64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_neon64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_neon64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_neon64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s_neon64_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s_neon64_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
fr->buffer.fill += 128;
......@@ -1100,12 +1100,12 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
*/
#define BLOCK 0x20 /* One decoding block is 32 samples. */
#define SYNTH_NAME synth_2to1
#define SYNTH_NAME INT123_synth_2to1
#include "synth.h"
#undef SYNTH_NAME
#ifdef OPT_DITHER /* Used for generic_dither and as fallback for i586_dither. */
#define SYNTH_NAME synth_2to1_dither
#define SYNTH_NAME INT123_synth_2to1_dither
#define USE_DITHER
#include "synth.h"
#undef USE_DITHER
......@@ -1113,8 +1113,8 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#endif
#define SYNTH_NAME fr->synths.plain[r_2to1][f_16]
#define MONO_NAME synth_2to1_mono
#define MONO2STEREO_NAME synth_2to1_m2s
#define MONO_NAME INT123_synth_2to1_mono
#define MONO2STEREO_NAME INT123_synth_2to1_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -1122,7 +1122,7 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_2to1_i386
#define SYNTH_NAME INT123_synth_2to1_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -1137,12 +1137,12 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
*/
#define BLOCK 0x10 /* One decoding block is 16 samples. */
#define SYNTH_NAME synth_4to1
#define SYNTH_NAME INT123_synth_4to1
#include "synth.h"
#undef SYNTH_NAME
#ifdef OPT_DITHER
#define SYNTH_NAME synth_4to1_dither
#define SYNTH_NAME INT123_synth_4to1_dither
#define USE_DITHER
#include "synth.h"
#undef USE_DITHER
......@@ -1150,8 +1150,8 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#endif
#define SYNTH_NAME fr->synths.plain[r_4to1][f_16] /* This is just for the _i386 one... gotta check if it is really useful... */
#define MONO_NAME synth_4to1_mono
#define MONO2STEREO_NAME synth_4to1_m2s
#define MONO_NAME INT123_synth_4to1_mono
#define MONO2STEREO_NAME INT123_synth_4to1_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -1159,7 +1159,7 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_4to1_i386
#define SYNTH_NAME INT123_synth_4to1_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -1173,13 +1173,13 @@ int synth_1to1_stereo_neon64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_NTOM
/*
Part 1d: ntom synth.
Same procedure as above... Just no extra play anymore, straight synth that uses the plain dct64.
Same procedure as above... Just no extra play anymore, straight synth that uses the plain INT123_dct64.
*/
/* These are all in one header, there's no flexibility to gain. */
#define SYNTH_NAME synth_ntom
#define MONO_NAME synth_ntom_mono
#define MONO2STEREO_NAME synth_ntom_m2s
#define SYNTH_NAME INT123_synth_ntom
#define MONO_NAME INT123_synth_ntom_mono
#define MONO2STEREO_NAME INT123_synth_ntom_m2s
#include "synth_ntom.h"
#undef SYNTH_NAME
#undef MONO_NAME
......
......@@ -20,15 +20,15 @@
*/
/* Main synth function, uses the plain dct64 or dct64_i386. */
/* Main synth function, uses the plain INT123_dct64 or INT123_dct64_i386. */
int SYNTH_NAME(real *bandPtr, int channel, mpg123_handle *fr, int final)
{
#ifndef NO_AUTOINCREMENT
#define BACKPEDAL 0x10 /* We use autoincrement and thus need this re-adjustment for window/b0. */
#define MY_DCT64 dct64
#define MY_DCT64 INT123_dct64
#else
#define BACKPEDAL 0x00 /* i386 code does not need that. */
#define MY_DCT64 dct64_i386
#define MY_DCT64 INT123_dct64_i386
#endif
static const int step = 2;
SAMPLE_T *samples = (SAMPLE_T *) (fr->buffer.data + fr->buffer.fill);
......@@ -37,7 +37,7 @@ int SYNTH_NAME(real *bandPtr, int channel, mpg123_handle *fr, int final)
int clip = 0;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......
......@@ -13,7 +13,7 @@
/*
Part 2: All synth functions that produce 8bit output.
What we need is just a special WRITE_SAMPLE. For the generic and i386 functions, that is.
For the rather optimized synth_1to1, we will need the postprocessing 8bit converters from synth_8bit.h .
For the rather optimized INT123_synth_1to1, we will need the postprocessing 8bit converters from synth_8bit.h .
*/
#define SAMPLE_T unsigned char
......@@ -22,14 +22,14 @@
/* Part 2a: All straight 1to1 decoding functions */
#define BLOCK 0x40 /* One decoding block is 64 samples. */
#define SYNTH_NAME synth_1to1_8bit
#define SYNTH_NAME INT123_synth_1to1_8bit
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_1to1_8bit (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_1to1_8bit (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_1to1][f_8]
#define MONO_NAME synth_1to1_8bit_mono
#define MONO2STEREO_NAME synth_1to1_8bit_m2s
#define MONO_NAME INT123_synth_1to1_8bit_mono
#define MONO2STEREO_NAME INT123_synth_1to1_8bit_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -37,20 +37,20 @@
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_1to1_8bit_i386
#define SYNTH_NAME INT123_synth_1to1_8bit_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
#undef NO_AUTOINCREMENT
#endif
/* But now, we need functions that take the 16bit output of optimized synth_1to1 and convert it.
/* But now, we need functions that take the 16bit output of optimized INT123_synth_1to1 and convert it.
I suppose that is still faster than dropping the optimization altogether! */
#define BASE_SYNTH_NAME fr->synths.plain[r_1to1][f_16]
#define SYNTH_NAME synth_1to1_8bit_wrap
#define MONO_NAME synth_1to1_8bit_wrap_mono
#define MONO2STEREO_NAME synth_1to1_8bit_wrap_m2s
#define SYNTH_NAME INT123_synth_1to1_8bit_wrap
#define MONO_NAME INT123_synth_1to1_8bit_wrap_mono
#define MONO2STEREO_NAME INT123_synth_1to1_8bit_wrap_m2s
#include "synth_8bit.h"
#undef BASE_SYNTH_NAME
#undef SYNTH_NAME
......@@ -66,14 +66,14 @@
*/
#define BLOCK 0x20 /* One decoding block is 32 samples. */
#define SYNTH_NAME synth_2to1_8bit
#define SYNTH_NAME INT123_synth_2to1_8bit
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_2to1_8bit (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_2to1_8bit (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_2to1][f_8]
#define MONO_NAME synth_2to1_8bit_mono
#define MONO2STEREO_NAME synth_2to1_8bit_m2s
#define MONO_NAME INT123_synth_2to1_8bit_mono
#define MONO2STEREO_NAME INT123_synth_2to1_8bit_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -81,7 +81,7 @@
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_2to1_8bit_i386
#define SYNTH_NAME INT123_synth_2to1_8bit_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -95,14 +95,14 @@
*/
#define BLOCK 0x10 /* One decoding block is 16 samples. */
#define SYNTH_NAME synth_4to1_8bit
#define SYNTH_NAME INT123_synth_4to1_8bit
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_4to1_8bit (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_4to1_8bit (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_4to1][f_8]
#define MONO_NAME synth_4to1_8bit_mono
#define MONO2STEREO_NAME synth_4to1_8bit_m2s
#define MONO_NAME INT123_synth_4to1_8bit_mono
#define MONO2STEREO_NAME INT123_synth_4to1_8bit_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -110,7 +110,7 @@
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_4to1_8bit_i386
#define SYNTH_NAME INT123_synth_4to1_8bit_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -124,13 +124,13 @@
#ifndef NO_NTOM
/*
Part 2d: ntom synth.
Same procedure as above... Just no extra play anymore, straight synth that may use an optimized dct64.
Same procedure as above... Just no extra play anymore, straight synth that may use an optimized INT123_dct64.
*/
/* These are all in one header, there's no flexibility to gain. */
#define SYNTH_NAME synth_ntom_8bit
#define MONO_NAME synth_ntom_8bit_mono
#define MONO2STEREO_NAME synth_ntom_8bit_m2s
#define SYNTH_NAME INT123_synth_ntom_8bit
#define MONO_NAME INT123_synth_ntom_8bit_mono
#define MONO2STEREO_NAME INT123_synth_ntom_8bit_m2s
#include "synth_ntom.h"
#undef SYNTH_NAME
#undef MONO_NAME
......
......@@ -7,7 +7,7 @@
Only variable is the BLOCK size to choose 1to1, 2to1 or 4to1.
Oh, and the names: BASE_SYNTH_NAME, SYNTH_NAME, MONO_NAME, MONO2STEREO_NAME
(p.ex. opt_synth_1to1(fr), synth_1to1_8bit, synth_1to1_8bit_mono, ...).
(p.ex. opt_synth_1to1(fr), INT123_synth_1to1_8bit, INT123_synth_1to1_8bit_mono, ...).
*/
int SYNTH_NAME(real *bandPtr, int channel, mpg123_handle *fr, int final)
......@@ -83,4 +83,3 @@ int MONO2STEREO_NAME(real *bandPtr, mpg123_handle *fr)
return ret;
}
......@@ -13,7 +13,7 @@
This is what resulted...
Reason to separate this from synth.h:
There are decoders that have a special synth_1to1 but still can use these generic derivations for the mono stuff.
There are decoders that have a special INT123_synth_1to1 but still can use these generic derivations for the mono stuff.
It generally makes a good deal of sense to set SYNTH_NAME to opt_synth_1to1(fr) (or opt_synth_2to1(fr), etc.).
*/
......
/*
synth_ntom.h: ntom-resampling synth functions
This header is used multiple times to create different variants of this function.
Hint: MONO_NAME, MONO2STEREO_NAME, SYNTH_NAME and SAMPLE_T as well as WRITE_SAMPLE do vary.
......@@ -73,33 +73,33 @@ int SYNTH_NAME(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int ntom;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
fr->bo--;
fr->bo &= 0xf;
buf = fr->real_buffs[0];
ntom = fr->ntom_val[1] = fr->ntom_val[0];
ntom = fr->INT123_ntom_val[1] = fr->INT123_ntom_val[0];
}
else
{
samples++;
buf = fr->real_buffs[1];
ntom = fr->ntom_val[1];
ntom = fr->INT123_ntom_val[1];
}
if(fr->bo & 0x1)
{
b0 = buf[0];
bo1 = fr->bo;
dct64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
{
......@@ -205,9 +205,8 @@ int SYNTH_NAME(real *bandPtr,int channel, mpg123_handle *fr, int final)
}
}
fr->ntom_val[channel] = ntom;
fr->INT123_ntom_val[channel] = ntom;
if(final) fr->buffer.fill = ((unsigned char *) samples - fr->buffer.data - (channel ? sizeof(SAMPLE_T) : 0));
return clip;
}
......@@ -25,14 +25,14 @@
/* Part 3a: All straight 1to1 decoding functions */
#define BLOCK 0x40 /* One decoding block is 64 samples. */
#define SYNTH_NAME synth_1to1_real
#define SYNTH_NAME INT123_synth_1to1_real
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_1to1_real (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_1to1_real (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_1to1][f_real]
#define MONO_NAME synth_1to1_real_mono
#define MONO2STEREO_NAME synth_1to1_real_m2s
#define MONO_NAME INT123_synth_1to1_real_mono
#define MONO2STEREO_NAME INT123_synth_1to1_real_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -40,7 +40,7 @@
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_1to1_real_i386
#define SYNTH_NAME INT123_synth_1to1_real_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -52,18 +52,18 @@
/* At least one optimized real decoder... */
#ifdef OPT_X86_64
/* Assembler routines. */
int synth_1to1_real_x86_64_asm(real *window, real *b0, real *samples, int bo1);
int synth_1to1_real_s_x86_64_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void dct64_real_x86_64(real *out0, real *out1, real *samples);
int INT123_synth_1to1_real_x86_64_asm(real *window, real *b0, real *samples, int bo1);
int INT123_synth_1to1_real_s_x86_64_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void INT123_dct64_real_x86_64(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_real_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_real_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
real *b0, **buf;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -81,23 +81,23 @@ int synth_1to1_real_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int fin
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
synth_1to1_real_x86_64_asm(fr->decwin, b0, samples, bo1);
INT123_synth_1to1_real_x86_64_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
return 0;
}
int synth_1to1_real_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_real_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
......@@ -106,8 +106,8 @@ int synth_1to1_real_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handl
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -120,19 +120,19 @@ int synth_1to1_real_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handl
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
synth_1to1_real_s_x86_64_asm(fr->decwin, b0l, b0r, samples, bo1);
INT123_synth_1to1_real_s_x86_64_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -143,19 +143,19 @@ int synth_1to1_real_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handl
#ifdef OPT_AVX
/* Assembler routines. */
#ifndef OPT_X86_64
int synth_1to1_real_x86_64_asm(real *window, real *b0, real *samples, int bo1);
int INT123_synth_1to1_real_x86_64_asm(real *window, real *b0, real *samples, int bo1);
#endif
int synth_1to1_real_s_avx_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void dct64_real_avx(real *out0, real *out1, real *samples);
int INT123_synth_1to1_real_s_avx_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void INT123_dct64_real_avx(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_real_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_real_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
real *b0, **buf;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -173,23 +173,23 @@ int synth_1to1_real_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_avx(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_avx(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_avx(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_avx(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
synth_1to1_real_x86_64_asm(fr->decwin, b0, samples, bo1);
INT123_synth_1to1_real_x86_64_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
return 0;
}
int synth_1to1_fltst_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_fltst_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
......@@ -198,8 +198,8 @@ int synth_1to1_fltst_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -212,19 +212,19 @@ int synth_1to1_fltst_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_avx(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_avx(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_avx(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_avx(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_avx(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_avx(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_avx(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_avx(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
synth_1to1_real_s_avx_asm(fr->decwin, b0l, b0r, samples, bo1);
INT123_synth_1to1_real_s_avx_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -234,18 +234,18 @@ int synth_1to1_fltst_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#if defined(OPT_SSE) || defined(OPT_SSE_VINTAGE)
/* Assembler routines. */
int synth_1to1_real_sse_asm(real *window, real *b0, real *samples, int bo1);
int synth_1to1_real_s_sse_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void dct64_real_sse(real *out0, real *out1, real *samples);
int INT123_synth_1to1_real_sse_asm(real *window, real *b0, real *samples, int bo1);
int INT123_synth_1to1_real_s_sse_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void INT123_dct64_real_sse(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_real_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_real_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
real *b0, **buf;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -263,23 +263,23 @@ int synth_1to1_real_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_sse(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_sse(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_sse(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_sse(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
synth_1to1_real_sse_asm(fr->decwin, b0, samples, bo1);
INT123_synth_1to1_real_sse_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
return 0;
}
int synth_1to1_real_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_real_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
......@@ -288,8 +288,8 @@ int synth_1to1_real_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -302,19 +302,19 @@ int synth_1to1_real_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
synth_1to1_real_s_sse_asm(fr->decwin, b0l, b0r, samples, bo1);
INT123_synth_1to1_real_s_sse_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -324,18 +324,18 @@ int synth_1to1_real_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *
#ifdef OPT_NEON
/* Assembler routines. */
int synth_1to1_real_neon_asm(real *window, real *b0, real *samples, int bo1);
int synth_1to1_real_s_neon_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void dct64_real_neon(real *out0, real *out1, real *samples);
int INT123_synth_1to1_real_neon_asm(real *window, real *b0, real *samples, int bo1);
int INT123_synth_1to1_real_s_neon_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void INT123_dct64_real_neon(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_real_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_real_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
real *b0, **buf;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -353,22 +353,22 @@ int synth_1to1_real_neon(real *bandPtr,int channel, mpg123_handle *fr, int final
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_neon(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_neon(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_neon(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_neon(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
synth_1to1_real_neon_asm(fr->decwin, b0, samples, bo1);
INT123_synth_1to1_real_neon_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
return 0;
}
int synth_1to1_real_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_real_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
......@@ -377,8 +377,8 @@ int synth_1to1_real_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -391,19 +391,19 @@ int synth_1to1_real_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_neon(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_neon(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_neon(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_neon(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_neon(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_neon(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_neon(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_neon(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
synth_1to1_real_s_neon_asm(fr->decwin, b0l, b0r, samples, bo1);
INT123_synth_1to1_real_s_neon_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -413,18 +413,18 @@ int synth_1to1_real_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle
#ifdef OPT_NEON64
/* Assembler routines. */
int synth_1to1_real_neon64_asm(real *window, real *b0, real *samples, int bo1);
int synth_1to1_real_s_neon64_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void dct64_real_neon64(real *out0, real *out1, real *samples);
int INT123_synth_1to1_real_neon64_asm(real *window, real *b0, real *samples, int bo1);
int INT123_synth_1to1_real_s_neon64_asm(real *window, real *b0l, real *b0r, real *samples, int bo1);
void INT123_dct64_real_neon64(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_real_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_real_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
real *b0, **buf;
int bo1;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -442,22 +442,22 @@ int synth_1to1_real_neon64(real *bandPtr,int channel, mpg123_handle *fr, int fin
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_neon64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_neon64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_neon64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_neon64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
synth_1to1_real_neon64_asm(fr->decwin, b0, samples, bo1);
INT123_synth_1to1_real_neon64_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
return 0;
}
int synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
real *samples = (real *) (fr->buffer.data+fr->buffer.fill);
......@@ -466,8 +466,8 @@ int synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -480,19 +480,19 @@ int synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_neon64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_neon64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_neon64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_neon64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_neon64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_neon64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_neon64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_neon64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
synth_1to1_real_s_neon64_asm(fr->decwin, b0l, b0r, samples, bo1);
INT123_synth_1to1_real_s_neon64_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -507,14 +507,14 @@ int synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
*/
#define BLOCK 0x20 /* One decoding block is 32 samples. */
#define SYNTH_NAME synth_2to1_real
#define SYNTH_NAME INT123_synth_2to1_real
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_2to1_real (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_2to1_real (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_2to1][f_real]
#define MONO_NAME synth_2to1_real_mono
#define MONO2STEREO_NAME synth_2to1_real_m2s
#define MONO_NAME INT123_synth_2to1_real_mono
#define MONO2STEREO_NAME INT123_synth_2to1_real_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -522,7 +522,7 @@ int synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_2to1_real_i386
#define SYNTH_NAME INT123_synth_2to1_real_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -536,14 +536,14 @@ int synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
*/
#define BLOCK 0x10 /* One decoding block is 16 samples. */
#define SYNTH_NAME synth_4to1_real
#define SYNTH_NAME INT123_synth_4to1_real
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_4to1_real (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_4to1_real (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_4to1][f_real]
#define MONO_NAME synth_4to1_real_mono
#define MONO2STEREO_NAME synth_4to1_real_m2s
#define MONO_NAME INT123_synth_4to1_real_mono
#define MONO2STEREO_NAME INT123_synth_4to1_real_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -551,7 +551,7 @@ int synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_4to1_real_i386
#define SYNTH_NAME INT123_synth_4to1_real_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -565,13 +565,13 @@ int synth_1to1_fltst_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_NTOM
/*
Part 3d: ntom synth.
Same procedure as above... Just no extra play anymore, straight synth that may use an optimized dct64.
Same procedure as above... Just no extra play anymore, straight synth that may use an optimized INT123_dct64.
*/
/* These are all in one header, there's no flexibility to gain. */
#define SYNTH_NAME synth_ntom_real
#define MONO_NAME synth_ntom_real_mono
#define MONO2STEREO_NAME synth_ntom_real_m2s
#define SYNTH_NAME INT123_synth_ntom_real
#define MONO_NAME INT123_synth_ntom_real_mono
#define MONO2STEREO_NAME INT123_synth_ntom_real_m2s
#include "synth_ntom.h"
#undef SYNTH_NAME
#undef MONO_NAME
......
......@@ -24,14 +24,14 @@
/* Part 4a: All straight 1to1 decoding functions */
#define BLOCK 0x40 /* One decoding block is 64 samples. */
#define SYNTH_NAME synth_1to1_s32
#define SYNTH_NAME INT123_synth_1to1_s32
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_1to1_s32 (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_1to1_s32 (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_1to1][f_32]
#define MONO_NAME synth_1to1_s32_mono
#define MONO2STEREO_NAME synth_1to1_s32_m2s
#define MONO_NAME INT123_synth_1to1_s32_mono
#define MONO2STEREO_NAME INT123_synth_1to1_s32_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -39,7 +39,7 @@
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_1to1_s32_i386
#define SYNTH_NAME INT123_synth_1to1_s32_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -48,11 +48,11 @@
#ifdef OPT_X86_64
/* Assembler routines. */
int synth_1to1_s32_x86_64_asm(real *window, real *b0, int32_t *samples, int bo1);
int synth_1to1_s32_s_x86_64_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void dct64_real_x86_64(real *out0, real *out1, real *samples);
int INT123_synth_1to1_s32_x86_64_asm(real *window, real *b0, int32_t *samples, int bo1);
int INT123_synth_1to1_s32_s_x86_64_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void INT123_dct64_real_x86_64(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_s32_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_s32_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -60,7 +60,7 @@ int synth_1to1_s32_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int fina
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -78,16 +78,16 @@ int synth_1to1_s32_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int fina
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_s32_x86_64_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_s32_x86_64_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
......@@ -95,7 +95,7 @@ int synth_1to1_s32_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int fina
}
int synth_1to1_s32_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_s32_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -105,8 +105,8 @@ int synth_1to1_s32_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -119,19 +119,19 @@ int synth_1to1_s32_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s32_s_x86_64_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s32_s_x86_64_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -142,12 +142,12 @@ int synth_1to1_s32_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle
#ifdef OPT_AVX
/* Assembler routines. */
#ifndef OPT_x86_64
int synth_1to1_s32_x86_64_asm(real *window, real *b0, int32_t *samples, int bo1);
int INT123_synth_1to1_s32_x86_64_asm(real *window, real *b0, int32_t *samples, int bo1);
#endif
int synth_1to1_s32_s_avx_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void dct64_real_avx(real *out0, real *out1, real *samples);
int INT123_synth_1to1_s32_s_avx_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void INT123_dct64_real_avx(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_s32_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_s32_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -155,7 +155,7 @@ int synth_1to1_s32_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -173,16 +173,16 @@ int synth_1to1_s32_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_avx(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_avx(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_avx(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_avx(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_s32_x86_64_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_s32_x86_64_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
......@@ -190,7 +190,7 @@ int synth_1to1_s32_avx(real *bandPtr,int channel, mpg123_handle *fr, int final)
}
int synth_1to1_s32_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_s32_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -200,8 +200,8 @@ int synth_1to1_s32_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *f
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -214,19 +214,19 @@ int synth_1to1_s32_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *f
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_avx(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_avx(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_avx(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_avx(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_avx(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_avx(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_avx(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_avx(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s32_s_avx_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s32_s_avx_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -236,11 +236,11 @@ int synth_1to1_s32_stereo_avx(real *bandPtr_l, real *bandPtr_r, mpg123_handle *f
#if defined(OPT_SSE) || defined(OPT_SSE_VINTAGE)
/* Assembler routines. */
int synth_1to1_s32_sse_asm(real *window, real *b0, int32_t *samples, int bo1);
int synth_1to1_s32_s_sse_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void dct64_real_sse(real *out0, real *out1, real *samples);
int INT123_synth_1to1_s32_sse_asm(real *window, real *b0, int32_t *samples, int bo1);
int INT123_synth_1to1_s32_s_sse_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void INT123_dct64_real_sse(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_s32_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_s32_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -248,7 +248,7 @@ int synth_1to1_s32_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -266,16 +266,16 @@ int synth_1to1_s32_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_sse(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_sse(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_sse(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_sse(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_s32_sse_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_s32_sse_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
......@@ -283,7 +283,7 @@ int synth_1to1_s32_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
}
int synth_1to1_s32_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_s32_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -293,8 +293,8 @@ int synth_1to1_s32_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *f
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -307,19 +307,19 @@ int synth_1to1_s32_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *f
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s32_s_sse_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s32_s_sse_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -329,11 +329,11 @@ int synth_1to1_s32_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *f
#ifdef OPT_NEON
/* Assembler routines. */
int synth_1to1_s32_neon_asm(real *window, real *b0, int32_t *samples, int bo1);
int synth_1to1_s32_s_neon_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void dct64_real_neon(real *out0, real *out1, real *samples);
int INT123_synth_1to1_s32_neon_asm(real *window, real *b0, int32_t *samples, int bo1);
int INT123_synth_1to1_s32_s_neon_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void INT123_dct64_real_neon(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_s32_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_s32_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -341,7 +341,7 @@ int synth_1to1_s32_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -359,23 +359,23 @@ int synth_1to1_s32_neon(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_neon(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_neon(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_neon(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_neon(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_s32_neon_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_s32_neon_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
return clip;
}
int synth_1to1_s32_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_s32_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -385,8 +385,8 @@ int synth_1to1_s32_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -399,19 +399,19 @@ int synth_1to1_s32_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_neon(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_neon(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_neon(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_neon(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_neon(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_neon(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_neon(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_neon(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s32_s_neon_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s32_s_neon_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -421,11 +421,11 @@ int synth_1to1_s32_stereo_neon(real *bandPtr_l, real *bandPtr_r, mpg123_handle *
#ifdef OPT_NEON64
/* Assembler routines. */
int synth_1to1_s32_neon64_asm(real *window, real *b0, int32_t *samples, int bo1);
int synth_1to1_s32_s_neon64_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void dct64_real_neon64(real *out0, real *out1, real *samples);
int INT123_synth_1to1_s32_neon64_asm(real *window, real *b0, int32_t *samples, int bo1);
int INT123_synth_1to1_s32_s_neon64_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
void INT123_dct64_real_neon64(real *out0, real *out1, real *samples);
/* Hull for C mpg123 API */
int synth_1to1_s32_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
int INT123_synth_1to1_s32_neon64(real *bandPtr,int channel, mpg123_handle *fr, int final)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -433,7 +433,7 @@ int synth_1to1_s32_neon64(real *bandPtr,int channel, mpg123_handle *fr, int fina
int bo1;
int clip;
#ifndef NO_EQUALIZER
if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
if(fr->have_eq_settings) INT123_do_equalizer(bandPtr,channel,fr->equalizer);
#endif
if(!channel)
{
......@@ -451,23 +451,23 @@ int synth_1to1_s32_neon64(real *bandPtr,int channel, mpg123_handle *fr, int fina
{
b0 = buf[0];
bo1 = fr->bo;
dct64_real_neon64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
INT123_dct64_real_neon64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
}
else
{
b0 = buf[1];
bo1 = fr->bo+1;
dct64_real_neon64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
INT123_dct64_real_neon64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
}
clip = synth_1to1_s32_neon64_asm(fr->decwin, b0, samples, bo1);
clip = INT123_synth_1to1_s32_neon64_asm(fr->decwin, b0, samples, bo1);
if(final) fr->buffer.fill += 256;
return clip;
}
int synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
int INT123_synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
{
int32_t *samples = (int32_t *) (fr->buffer.data+fr->buffer.fill);
......@@ -477,8 +477,8 @@ int synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_EQUALIZER
if(fr->have_eq_settings)
{
do_equalizer(bandPtr_l,0,fr->equalizer);
do_equalizer(bandPtr_r,1,fr->equalizer);
INT123_do_equalizer(bandPtr_l,0,fr->equalizer);
INT123_do_equalizer(bandPtr_r,1,fr->equalizer);
}
#endif
fr->bo--;
......@@ -491,19 +491,19 @@ int synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
b0l = bufl[0];
b0r = bufr[0];
bo1 = fr->bo;
dct64_real_neon64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
dct64_real_neon64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
INT123_dct64_real_neon64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
INT123_dct64_real_neon64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
}
else
{
b0l = bufl[1];
b0r = bufr[1];
bo1 = fr->bo+1;
dct64_real_neon64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
dct64_real_neon64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
INT123_dct64_real_neon64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
INT123_dct64_real_neon64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
}
clip = synth_1to1_s32_s_neon64_asm(fr->decwin, b0l, b0r, samples, bo1);
clip = INT123_synth_1to1_s32_s_neon64_asm(fr->decwin, b0l, b0r, samples, bo1);
fr->buffer.fill += 256;
......@@ -520,14 +520,14 @@ int synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
*/
#define BLOCK 0x20 /* One decoding block is 32 samples. */
#define SYNTH_NAME synth_2to1_s32
#define SYNTH_NAME INT123_synth_2to1_s32
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_2to1_s32 (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_2to1_s32 (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_2to1][f_32]
#define MONO_NAME synth_2to1_s32_mono
#define MONO2STEREO_NAME synth_2to1_s32_m2s
#define MONO_NAME INT123_synth_2to1_s32_mono
#define MONO2STEREO_NAME INT123_synth_2to1_s32_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -535,7 +535,7 @@ int synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_2to1_s32_i386
#define SYNTH_NAME INT123_synth_2to1_s32_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -549,14 +549,14 @@ int synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
*/
#define BLOCK 0x10 /* One decoding block is 16 samples. */
#define SYNTH_NAME synth_4to1_s32
#define SYNTH_NAME INT123_synth_4to1_s32
#include "synth.h"
#undef SYNTH_NAME
/* Mono-related synths; they wrap over _some_ synth_4to1_s32 (could be generic, could be i386). */
/* Mono-related synths; they wrap over _some_ INT123_synth_4to1_s32 (could be generic, could be i386). */
#define SYNTH_NAME fr->synths.plain[r_4to1][f_32]
#define MONO_NAME synth_4to1_s32_mono
#define MONO2STEREO_NAME synth_4to1_s32_m2s
#define MONO_NAME INT123_synth_4to1_s32_mono
#define MONO2STEREO_NAME INT123_synth_4to1_s32_m2s
#include "synth_mono.h"
#undef SYNTH_NAME
#undef MONO_NAME
......@@ -564,7 +564,7 @@ int synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifdef OPT_X86
#define NO_AUTOINCREMENT
#define SYNTH_NAME synth_4to1_s32_i386
#define SYNTH_NAME INT123_synth_4to1_s32_i386
#include "synth.h"
#undef SYNTH_NAME
/* i386 uses the normal mono functions. */
......@@ -578,13 +578,13 @@ int synth_1to1_s32st_neon64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
#ifndef NO_NTOM
/*
Part 4d: ntom synth.
Same procedure as above... Just no extra play anymore, straight synth that may use an optimized dct64.
Same procedure as above... Just no extra play anymore, straight synth that may use an optimized INT123_dct64.
*/
/* These are all in one header, there's no flexibility to gain. */
#define SYNTH_NAME synth_ntom_s32
#define MONO_NAME synth_ntom_s32_mono
#define MONO2STEREO_NAME synth_ntom_s32_m2s
#define SYNTH_NAME INT123_synth_ntom_s32
#define MONO_NAME INT123_synth_ntom_s32_mono
#define MONO2STEREO_NAME INT123_synth_ntom_s32_m2s
#include "synth_ntom.h"
#undef SYNTH_NAME
#undef MONO_NAME
......
......@@ -16,7 +16,7 @@
#else
const
#endif
real *pnts[] = { cos64,cos32,cos16,cos8,cos4 };
real *INT123_pnts[] = { cos64,cos32,cos16,cos8,cos4 };
static const long intwinbase[] = {
0, -1, -1, -1, -1, -1, -1, -2, -2, -2,
......@@ -48,12 +48,12 @@ static const long intwinbase[] = {
#ifdef OPT_MMXORSSE
#if !defined(OPT_X86_64) && !defined(OPT_NEON) && !defined(OPT_NEON64) && !defined(OPT_AVX)
void make_decode_tables_mmx_asm(long scaleval, float* decwin_mmx, float *decwins);
void make_decode_tables_mmx(mpg123_handle *fr)
void INT123_make_decode_tables_mmx_asm(long scaleval, float* decwin_mmx, float *decwins);
void INT123_make_decode_tables_mmx(mpg123_handle *fr)
{
debug("MMX decode tables");
/* Take care: The scale should be like before, when we didn't have float output all around. */
make_decode_tables_mmx_asm((long)((fr->lastscale < 0 ? fr->p.outscale : fr->lastscale)*SHORT_SCALE), fr->decwin_mmx, fr->decwins);
INT123_make_decode_tables_mmx_asm((long)((fr->lastscale < 0 ? fr->p.outscale : fr->lastscale)*SHORT_SCALE), fr->decwin_mmx, fr->decwins);
debug("MMX decode tables done");
}
#else
......@@ -65,7 +65,7 @@ static int rounded(double f)
}
/* x86-64 doesn't use asm version */
void make_decode_tables_mmx(mpg123_handle *fr)
void INT123_make_decode_tables_mmx(mpg123_handle *fr)
{
int i,j,val;
int idx = 0;
......@@ -135,7 +135,7 @@ static int32_t sat_mul32(int32_t a, int32_t b)
}
#endif
void make_decode_tables(mpg123_handle *fr)
void INT123_make_decode_tables(mpg123_handle *fr)
{
int i,j;
int idx = 0;
......@@ -231,7 +231,7 @@ void make_decode_tables(mpg123_handle *fr)
}
#ifndef NO_8BIT
int make_conv16to8_table(mpg123_handle *fr)
int INT123_make_conv16to8_table(mpg123_handle *fr)
{
int i;
int mode = fr->af.dec_enc;
......@@ -342,4 +342,3 @@ int make_conv16to8_table(mpg123_handle *fr)
return 0;
}
#endif
#ifndef MPG123_VERSION_H
#define MPG123_VERSION_H
/*
version: mpg123 distribution version
This is the main source of mpg123 distribution version information, parsed
by the build system for packaging.
copyright 2023 by the mpg123 project,
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
// only single spaces as separator to ease parsing by build scripts
#define MPG123_MAJOR 1
#define MPG123_MINOR 32
#define MPG123_PATCH 2
// Don't get too wild with that to avoid confusing m4. No brackets.
// Also, it should fit well into a sane file name for the tarball.
#define MPG123_SUFFIX ""
#define MPG123_VERSION_CAT_REALLY(a, b, c) #a "." #b "." #c
#define MPG123_VERSION_CAT(a, b, c) MPG123_VERSION_CAT_REALLY(a, b, c)
#define MPG123_VERSION \
MPG123_VERSION_CAT(MPG123_MAJOR, MPG123_MINOR, MPG123_PATCH) MPG123_SUFFIX
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment