Bug 1823443 - Vendor libsoundtouch through mach vendor, with patch r=padenot

Through ./mach vendor media/libsoundtouch/moz.yaml -r 17a63e99d58053b0fbde8b69d7cc76a38119ce70 --patch-mode only --force

Differential Revision: https://phabricator.services.mozilla.com/D173047
This commit is contained in:
serge-sans-paille 2023-03-21 13:14:47 +00:00
parent 8a6e644520
commit 46333ee321
6 changed files with 31 additions and 22 deletions

View File

@ -42,7 +42,7 @@
using namespace soundtouch;
#define PI 3.14159265358979323846
#define PI M_PI
#define TWOPI (2 * PI)
// define this to save AA filter coefficients to a file

View File

@ -298,9 +298,11 @@ void * FIRFilter::operator new(size_t s)
FIRFilter * FIRFilter::newInstance()
{
#if defined(SOUNDTOUCH_ALLOW_MMX) || defined(SOUNDTOUCH_ALLOW_SSE)
uint uExtensions;
uExtensions = detectCPUextensions();
#endif
// Check if MMX/SSE instruction set extensions supported by CPU

View File

@ -47,12 +47,17 @@ typedef unsigned long ulong;
#define SOUNDTOUCH_ALIGN_POINTER_16(x) ( ( (ulongptr)(x) + 15 ) & ~(ulongptr)15 )
#if (defined(__GNUC__) && !defined(ANDROID))
// In GCC, include soundtouch_config.h made by config scritps.
// Skip this in Android compilation that uses GCC but without configure scripts.
#include "soundtouch_config.h"
#endif
#include "soundtouch_config.h"
#if defined(WIN32)
#if defined(BUILDING_SOUNDTOUCH)
#define SOUNDTOUCH_API __declspec(dllexport)
#else
#define SOUNDTOUCH_API __declspec(dllimport)
#endif
#else
#define SOUNDTOUCH_API
#endif
namespace soundtouch
{

View File

@ -165,7 +165,7 @@ namespace soundtouch
#define SETTING_INITIAL_LATENCY 8
class SoundTouch : public FIFOProcessor
class SOUNDTOUCH_API SoundTouch : public FIFOProcessor
{
private:
/// Rate transposer class instance

View File

@ -769,9 +769,11 @@ void * TDStretch::operator new(size_t s)
TDStretch * TDStretch::newInstance()
{
#if defined(SOUNDTOUCH_ALLOW_MMX) || defined(SOUNDTOUCH_ALLOW_SSE)
uint uExtensions;
uExtensions = detectCPUextensions();
#endif
// Check if MMX/SSE instruction set extensions supported by CPU

View File

@ -37,9 +37,8 @@
#if defined(SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS)
#if defined(__GNUC__) && defined(__i386__)
// gcc
#if defined(__GNUC__) && defined(HAVE_CPUID_H)
// gcc and clang
#include "cpuid.h"
#elif defined(_M_IX86)
// windows non-gcc
@ -89,18 +88,7 @@ uint detectCPUextensions(void)
uint res = 0;
#if defined(__GNUC__)
// GCC version of cpuid. Requires GCC 4.3.0 or later for __cpuid intrinsic support.
uint eax, ebx, ecx, edx; // unsigned int is the standard type. uint is defined by the compiler and not guaranteed to be portable.
// Check if no cpuid support.
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) return 0; // always disable extensions.
if (edx & bit_MMX) res = res | SUPPORT_MMX;
if (edx & bit_SSE) res = res | SUPPORT_SSE;
if (edx & bit_SSE2) res = res | SUPPORT_SSE2;
#else
#if !defined(__GNUC__)
// Window / VS version of cpuid. Notice that Visual Studio 2005 or later required
// for __cpuid intrinsic support.
int reg[4] = {-1};
@ -113,7 +101,19 @@ uint detectCPUextensions(void)
if ((unsigned int)reg[3] & bit_MMX) res = res | SUPPORT_MMX;
if ((unsigned int)reg[3] & bit_SSE) res = res | SUPPORT_SSE;
if ((unsigned int)reg[3] & bit_SSE2) res = res | SUPPORT_SSE2;
#elif defined(HAVE_CPUID_H)
// GCC version of cpuid. Requires GCC 4.3.0 or later for __cpuid intrinsic support.
uint eax, ebx, ecx, edx; // unsigned int is the standard type. uint is defined by the compiler and not guaranteed to be portable.
// Check if no cpuid support.
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) return 0; // always disable extensions.
if (edx & bit_MMX) res = res | SUPPORT_MMX;
if (edx & bit_SSE) res = res | SUPPORT_SSE;
if (edx & bit_SSE2) res = res | SUPPORT_SSE2;
#else
// Compatible with GCC but no cpuid.h.
return 0;
#endif
return res & ~_dwDisabledISA;