mirror of
https://github.com/xiph/opus
synced 2024-11-21 06:25:56 -07:00
Refactoring analysis downmix to use sig scaling
Some checks failed
Autotools / AutoMake/Linux/GCC (push) Has been cancelled
Autotools / AutoMake/Linux/GCC/EnableDNN (push) Has been cancelled
Autotools / AutoMake/Linux/GCC/EnableCustomModes (push) Has been cancelled
Autotools / AutoMake/Linux/GCC/EnableAssertions (push) Has been cancelled
CMake / Test build with CMake 3.16.0 (push) Has been cancelled
CMake / CMake MINGW (push) Has been cancelled
CMake / CMake/Linux/Lib/X64/Release (push) Has been cancelled
CMake / CMake/MacOSX/Lib/X64/Release (push) Has been cancelled
CMake / CMake/MacOSX/Framework/X64/Release (push) Has been cancelled
CMake / CMake/Linux/So/X64/Release (push) Has been cancelled
CMake / CMake/MacOSX/So/X64/Release (push) Has been cancelled
CMake / CMake/Android/So/ARMv8/Release (push) Has been cancelled
CMake / CMake/Android/Lib/ARMv8/Release (push) Has been cancelled
CMake / CMake/Android/So/X86/Release (push) Has been cancelled
CMake / CMake/Android/Lib/X86/Release (push) Has been cancelled
CMake / CMake/Android/So/X64/Release (push) Has been cancelled
CMake / CMake/Android/Lib/X64/Release (push) Has been cancelled
CMake / CMake/AssertionsFuzz/Linux/Lib/X64/Release (push) Has been cancelled
CMake / CMake/AssertionsFuzz/MacOSX/Lib/X64/Release (push) Has been cancelled
CMake / CMake/CustomModes/Linux/Lib/X64/Release (push) Has been cancelled
CMake / CMake/iOS/Framework/arm64/Release (push) Has been cancelled
CMake / CMake/iOS/Dll/arm64/Release (push) Has been cancelled
CMake / CMake/iOS/Lib/arm64/Release (push) Has been cancelled
CMake / CMake/Windows/Dll/ARMv8/Release (push) Has been cancelled
CMake / CMake/Windows/Lib/armv8/Release (push) Has been cancelled
CMake / CMake/Windows/Dll/X64/Release (push) Has been cancelled
CMake / CMake/Windows/Dll/X86/Release (push) Has been cancelled
CMake / CMake/AssertionsFuzz/Windows/Lib/X64/Release (push) Has been cancelled
CMake / CMake/Windows/Lib/X64/Release (push) Has been cancelled
CMake / CMake/Windows/Lib/X86/Release (push) Has been cancelled
DRED / CMake/Android/Lib/ARMv8/Release (push) Has been cancelled
DRED / CMake/Android/Lib/X64/Release (push) Has been cancelled
DRED / CMake/MacOSX/Lib/X64/Release (push) Has been cancelled
DRED / CMake/Linux/Lib/X64/Release (push) Has been cancelled
DRED / CMake/iOS/Lib/arm64/Release (push) Has been cancelled
DRED / CMake/Windows/Lib/armv8/Release (push) Has been cancelled
DRED / CMake/Windows/Lib/X64/Release (push) Has been cancelled
DRED / AutoTools/Linux/Clang (push) Has been cancelled
DRED / AutoTools/Linux/GCC (push) Has been cancelled
Repository / Check trailing white spaces (push) Has been cancelled
Some checks failed
Autotools / AutoMake/Linux/GCC (push) Has been cancelled
Autotools / AutoMake/Linux/GCC/EnableDNN (push) Has been cancelled
Autotools / AutoMake/Linux/GCC/EnableCustomModes (push) Has been cancelled
Autotools / AutoMake/Linux/GCC/EnableAssertions (push) Has been cancelled
CMake / Test build with CMake 3.16.0 (push) Has been cancelled
CMake / CMake MINGW (push) Has been cancelled
CMake / CMake/Linux/Lib/X64/Release (push) Has been cancelled
CMake / CMake/MacOSX/Lib/X64/Release (push) Has been cancelled
CMake / CMake/MacOSX/Framework/X64/Release (push) Has been cancelled
CMake / CMake/Linux/So/X64/Release (push) Has been cancelled
CMake / CMake/MacOSX/So/X64/Release (push) Has been cancelled
CMake / CMake/Android/So/ARMv8/Release (push) Has been cancelled
CMake / CMake/Android/Lib/ARMv8/Release (push) Has been cancelled
CMake / CMake/Android/So/X86/Release (push) Has been cancelled
CMake / CMake/Android/Lib/X86/Release (push) Has been cancelled
CMake / CMake/Android/So/X64/Release (push) Has been cancelled
CMake / CMake/Android/Lib/X64/Release (push) Has been cancelled
CMake / CMake/AssertionsFuzz/Linux/Lib/X64/Release (push) Has been cancelled
CMake / CMake/AssertionsFuzz/MacOSX/Lib/X64/Release (push) Has been cancelled
CMake / CMake/CustomModes/Linux/Lib/X64/Release (push) Has been cancelled
CMake / CMake/iOS/Framework/arm64/Release (push) Has been cancelled
CMake / CMake/iOS/Dll/arm64/Release (push) Has been cancelled
CMake / CMake/iOS/Lib/arm64/Release (push) Has been cancelled
CMake / CMake/Windows/Dll/ARMv8/Release (push) Has been cancelled
CMake / CMake/Windows/Lib/armv8/Release (push) Has been cancelled
CMake / CMake/Windows/Dll/X64/Release (push) Has been cancelled
CMake / CMake/Windows/Dll/X86/Release (push) Has been cancelled
CMake / CMake/AssertionsFuzz/Windows/Lib/X64/Release (push) Has been cancelled
CMake / CMake/Windows/Lib/X64/Release (push) Has been cancelled
CMake / CMake/Windows/Lib/X86/Release (push) Has been cancelled
DRED / CMake/Android/Lib/ARMv8/Release (push) Has been cancelled
DRED / CMake/Android/Lib/X64/Release (push) Has been cancelled
DRED / CMake/MacOSX/Lib/X64/Release (push) Has been cancelled
DRED / CMake/Linux/Lib/X64/Release (push) Has been cancelled
DRED / CMake/iOS/Lib/arm64/Release (push) Has been cancelled
DRED / CMake/Windows/Lib/armv8/Release (push) Has been cancelled
DRED / CMake/Windows/Lib/X64/Release (push) Has been cancelled
DRED / AutoTools/Linux/Clang (push) Has been cancelled
DRED / AutoTools/Linux/GCC (push) Has been cancelled
Repository / Check trailing white spaces (push) Has been cancelled
This commit is contained in:
parent
69adba33ec
commit
5daf8d511f
3 changed files with 16 additions and 29 deletions
|
@ -138,7 +138,6 @@ typedef opus_val32 celt_ener;
|
|||
#ifdef ENABLE_RES24
|
||||
typedef opus_val32 opus_res;
|
||||
#define RES_SHIFT 8
|
||||
#define SCALEIN(a) (a)
|
||||
#define SIG2RES(a) PSHR32(a, SIG_SHIFT-RES_SHIFT)
|
||||
#define RES2INT16(a) SAT16(PSHR32(a, RES_SHIFT))
|
||||
#define RES2FLOAT(a) ((1.f/32768.f/256.)*(a))
|
||||
|
@ -150,7 +149,6 @@ typedef opus_val32 opus_res;
|
|||
#else
|
||||
typedef opus_val16 opus_res;
|
||||
#define RES_SHIFT 0
|
||||
#define SCALEIN(a) (a)
|
||||
#define SIG2RES(a) SIG2WORD16(a)
|
||||
#define RES2INT16(a) (a)
|
||||
#define RES2FLOAT(a) ((1.f/32768.f)*(a))
|
||||
|
@ -162,6 +160,8 @@ typedef opus_val16 opus_res;
|
|||
#endif
|
||||
|
||||
#define RES2VAL16(a) RES2INT16(a)
|
||||
#define FLOAT2SIG(a) float2int(((opus_int32)32768<<SIG_SHIFT)*(a))
|
||||
#define INT16TOSIG(a) SHL32(EXTEND32(a), SIG_SHIFT)
|
||||
|
||||
#define celt_isnan(x) 0
|
||||
|
||||
|
@ -314,8 +314,6 @@ static OPUS_INLINE int celt_isnan(float x)
|
|||
#define DIV32_16(a,b) (((opus_val32)(a))/(opus_val16)(b))
|
||||
#define DIV32(a,b) (((opus_val32)(a))/(opus_val32)(b))
|
||||
|
||||
#define SCALEIN(a) ((a)*CELT_SIG_SCALE)
|
||||
|
||||
#define SIG2RES(a) ((1/CELT_SIG_SCALE)*(a))
|
||||
#define RES2INT16(a) FLOAT2INT16(a)
|
||||
#define RES2FLOAT(a) (a)
|
||||
|
@ -326,6 +324,8 @@ static OPUS_INLINE int celt_isnan(float x)
|
|||
#define MULT16_RES_Q15(a,b) MULT16_16_Q15(a,b)
|
||||
|
||||
#define RES2VAL16(a) (a)
|
||||
#define FLOAT2SIG(a) ((a)*CELT_SIG_SCALE)
|
||||
#define INT16TOSIG(a) ((float)(a))
|
||||
|
||||
|
||||
#endif /* !FIXED_POINT */
|
||||
|
|
|
@ -163,7 +163,6 @@ static opus_val32 silk_resampler_down2_hp(
|
|||
static opus_val32 downmix_and_resample(downmix_func downmix, const void *_x, opus_val32 *y, opus_val32 S[3], int subframe, int offset, int c1, int c2, int C, int Fs)
|
||||
{
|
||||
VARDECL(opus_val32, tmp);
|
||||
opus_val32 scale;
|
||||
int j;
|
||||
opus_val32 ret = 0;
|
||||
SAVE_STACK;
|
||||
|
@ -180,17 +179,11 @@ static opus_val32 downmix_and_resample(downmix_func downmix, const void *_x, opu
|
|||
ALLOC(tmp, subframe, opus_val32);
|
||||
|
||||
downmix(_x, tmp, subframe, offset, c1, c2, C);
|
||||
#ifdef FIXED_POINT
|
||||
scale = (1<<SIG_SHIFT);
|
||||
#else
|
||||
scale = 1.f/32768;
|
||||
#endif
|
||||
if (c2==-2)
|
||||
scale /= C;
|
||||
else if (c2>-1)
|
||||
scale /= 2;
|
||||
for (j=0;j<subframe;j++)
|
||||
tmp[j] *= scale;
|
||||
if ((c2==-2 && C==2) || c2>-1) {
|
||||
for (j=0;j<subframe;j++) {
|
||||
tmp[j] = HALF32(tmp[j]);
|
||||
}
|
||||
}
|
||||
if (Fs == 48000)
|
||||
{
|
||||
ret = silk_resampler_down2_hp(S, y, tmp, subframe);
|
||||
|
@ -422,7 +415,7 @@ static const float std_feature_bias[9] = {
|
|||
#define SCALE_COMPENS (1.f/((opus_int32)1<<(15+SIG_SHIFT)))
|
||||
#define SCALE_ENER(e) ((SCALE_COMPENS*SCALE_COMPENS)*(e))
|
||||
#else
|
||||
#define SCALE_ENER(e) (e)
|
||||
#define SCALE_ENER(e) ((1.f/32768/32768)*e)
|
||||
#endif
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
|
|
|
@ -692,12 +692,6 @@ static opus_int32 user_bitrate_to_bitrate(OpusEncoder *st, int frame_size, int m
|
|||
}
|
||||
|
||||
#ifndef DISABLE_FLOAT_API
|
||||
#ifdef FIXED_POINT
|
||||
#define PCM2VAL(x) FLOAT2INT16(x)
|
||||
#else
|
||||
#define PCM2VAL(x) SCALEIN(x)
|
||||
#endif
|
||||
|
||||
void downmix_float(const void *_x, opus_val32 *y, int subframe, int offset, int c1, int c2, int C)
|
||||
{
|
||||
const float *x;
|
||||
|
@ -705,18 +699,18 @@ void downmix_float(const void *_x, opus_val32 *y, int subframe, int offset, int
|
|||
|
||||
x = (const float *)_x;
|
||||
for (j=0;j<subframe;j++)
|
||||
y[j] = PCM2VAL(x[(j+offset)*C+c1]);
|
||||
y[j] = FLOAT2SIG(x[(j+offset)*C+c1]);
|
||||
if (c2>-1)
|
||||
{
|
||||
for (j=0;j<subframe;j++)
|
||||
y[j] += PCM2VAL(x[(j+offset)*C+c2]);
|
||||
y[j] += FLOAT2SIG(x[(j+offset)*C+c2]);
|
||||
} else if (c2==-2)
|
||||
{
|
||||
int c;
|
||||
for (c=1;c<C;c++)
|
||||
{
|
||||
for (j=0;j<subframe;j++)
|
||||
y[j] += PCM2VAL(x[(j+offset)*C+c]);
|
||||
y[j] += FLOAT2SIG(x[(j+offset)*C+c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -729,18 +723,18 @@ void downmix_int(const void *_x, opus_val32 *y, int subframe, int offset, int c1
|
|||
|
||||
x = (const opus_int16 *)_x;
|
||||
for (j=0;j<subframe;j++)
|
||||
y[j] = x[(j+offset)*C+c1];
|
||||
y[j] = INT16TOSIG(x[(j+offset)*C+c1]);
|
||||
if (c2>-1)
|
||||
{
|
||||
for (j=0;j<subframe;j++)
|
||||
y[j] += x[(j+offset)*C+c2];
|
||||
y[j] += INT16TOSIG(x[(j+offset)*C+c2]);
|
||||
} else if (c2==-2)
|
||||
{
|
||||
int c;
|
||||
for (c=1;c<C;c++)
|
||||
{
|
||||
for (j=0;j<subframe;j++)
|
||||
y[j] += x[(j+offset)*C+c];
|
||||
y[j] += INT16TOSIG(x[(j+offset)*C+c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue