The inline implementation of WebRtcIsac_lrint(), which was implemented in several files, is now os_specific_inline.h. Define guards are modified according to WebRtc OS macros.
This resolves BUG=issue137. Review URL: http://webrtc-codereview.appspot.com/269014 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1323 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -28,8 +28,8 @@
|
|||||||
#include "encode_lpc_swb.h"
|
#include "encode_lpc_swb.h"
|
||||||
#include "lpc_shape_swb12_tables.h"
|
#include "lpc_shape_swb12_tables.h"
|
||||||
#include "lpc_shape_swb16_tables.h"
|
#include "lpc_shape_swb16_tables.h"
|
||||||
|
|
||||||
#include "lpc_gain_swb_tables.h"
|
#include "lpc_gain_swb_tables.h"
|
||||||
|
#include "os_specific_inline.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -75,42 +75,6 @@ static const WebRtc_Word32 lbcnQ10 = -402874;
|
|||||||
#define MINBITS_Q10 10240 /* 10.0 in Q10 */
|
#define MINBITS_Q10 10240 /* 10.0 in Q10 */
|
||||||
#define IS_SWB_12KHZ 1
|
#define IS_SWB_12KHZ 1
|
||||||
|
|
||||||
#if defined(WEBRTC_LINUX)
|
|
||||||
extern long int lrint(double x); /* Note! This declaration is missing in math.h, that is why it is declared as extern*/
|
|
||||||
#define WebRtcIsac_lrint lrint
|
|
||||||
#elif defined(WEBRTC_MAC)
|
|
||||||
extern long int lrint(double x); /* Note! This declaration is missing in math.h, that is why it is declared as extern*/
|
|
||||||
#define WebRtcIsac_lrint lrint
|
|
||||||
#elif defined(X64)
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
intgr = (WebRtc_Word32)floor(flt+.499999999999);
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
#elif defined(WEBRTC_TARGET_PC)
|
|
||||||
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
|
|
||||||
_asm
|
|
||||||
{
|
|
||||||
fld flt
|
|
||||||
fistp intgr
|
|
||||||
} ;
|
|
||||||
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
#else // Do a slow but correct implementation of lrint
|
|
||||||
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
intgr = (WebRtc_Word32)floor(flt+.499999999999);
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__inline WebRtc_UWord32 stepwise(WebRtc_Word32 dinQ10) {
|
__inline WebRtc_UWord32 stepwise(WebRtc_Word32 dinQ10) {
|
||||||
|
|
||||||
WebRtc_Word32 ind, diQ10, dtQ10;
|
WebRtc_Word32 ind, diQ10, dtQ10;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "signal_processing_library.h"
|
#include "signal_processing_library.h"
|
||||||
#include "lpc_shape_swb16_tables.h"
|
#include "lpc_shape_swb16_tables.h"
|
||||||
|
#include "os_specific_inline.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -1200,35 +1201,6 @@ WebRtc_Word16 WebRtcIsac_UpdateBwEstimate(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(WEBRTC_LINUX)
|
|
||||||
#define WebRtcIsac_W16RIntF(x) ((WebRtc_Word16)(x))
|
|
||||||
#elif defined(WEBRTC_MAC)
|
|
||||||
#define WebRtcIsac_W16RIntF(x) ((WebRtc_Word16)(x))
|
|
||||||
#elif defined(X64)
|
|
||||||
#define WebRtcIsac_W16RIntF(x) ((WebRtc_Word16)(x))
|
|
||||||
#elif defined(WEBRTC_TARGET_PC)
|
|
||||||
|
|
||||||
static __inline WebRtc_Word16 WebRtcIsac_W16RIntF(float flt) {
|
|
||||||
|
|
||||||
short intgr;
|
|
||||||
|
|
||||||
_asm
|
|
||||||
{
|
|
||||||
fld flt
|
|
||||||
fistp intgr
|
|
||||||
} ;
|
|
||||||
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define WebRtcIsac_W16RIntF(x) ((WebRtc_Word16)(x))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static WebRtc_Word16 Decode(
|
static WebRtc_Word16 Decode(
|
||||||
ISACStruct* ISAC_main_inst,
|
ISACStruct* ISAC_main_inst,
|
||||||
const WebRtc_UWord16* encoded,
|
const WebRtc_UWord16* encoded,
|
||||||
@@ -1338,7 +1310,7 @@ static WebRtc_Word16 Decode(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
decoded[k] = (WebRtc_Word16)WebRtcIsac_W16RIntF(outFrame[k]);
|
decoded[k] = (WebRtc_Word16)WebRtcIsac_lrint(outFrame[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
numSamplesUB = 0;
|
numSamplesUB = 0;
|
||||||
@@ -1360,7 +1332,7 @@ static WebRtc_Word16 Decode(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
outFrameLB[k] = (WebRtc_Word16)WebRtcIsac_W16RIntF(outFrame[k]);
|
outFrameLB[k] = (WebRtc_Word16)WebRtcIsac_lrint(outFrame[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1553,8 +1525,8 @@ static WebRtc_Word16 Decode(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
outFrameUB[k] = (WebRtc_Word16)WebRtcIsac_W16RIntF(
|
outFrameUB[k] = (WebRtc_Word16)WebRtcIsac_lrint(
|
||||||
outFrame[k]);
|
outFrame[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
'settings.h',
|
'settings.h',
|
||||||
'spectrum_ar_model_tables.h',
|
'spectrum_ar_model_tables.h',
|
||||||
'structs.h',
|
'structs.h',
|
||||||
|
'os_specific_inline.h',
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['OS!="win"', {
|
['OS!="win"', {
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license
|
||||||
|
* that can be found in the LICENSE file in the root of the source
|
||||||
|
* tree. An additional intellectual property rights grant can be found
|
||||||
|
* in the file PATENTS. All contributing project authors may
|
||||||
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_OS_SPECIFIC_INLINE_H_
|
||||||
|
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_OS_SPECIFIC_INLINE_H_
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "typedefs.h"
|
||||||
|
|
||||||
|
// TODO(turaj): switch to WEBRTC_POSIX when available
|
||||||
|
#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
|
||||||
|
#define WebRtcIsac_lrint lrint
|
||||||
|
#elif (defined(WEBRTC_ARCH_X86) && defined(WIN32))
|
||||||
|
static __inline long int WebRtcIsac_lrint(double x_dbl) {
|
||||||
|
long int x_int;
|
||||||
|
|
||||||
|
__asm {
|
||||||
|
fld x_dbl
|
||||||
|
fistp x_int
|
||||||
|
};
|
||||||
|
|
||||||
|
return x_int;
|
||||||
|
}
|
||||||
|
#else // Do a slow but correct implementation of lrint
|
||||||
|
|
||||||
|
static __inline long int WebRtcIsac_lrint(double x_dbl) {
|
||||||
|
long int x_int;
|
||||||
|
x_int = (long int)floor(x_dbl + 0.499999999999);
|
||||||
|
return x_int;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_OS_SPECIFIC_INLINE_H_
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pitch_estimator.h"
|
#include "pitch_estimator.h"
|
||||||
|
#include "os_specific_inline.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -27,41 +29,6 @@ static const double kIntrpCoef[PITCH_FRACS][PITCH_FRACORDER] = {
|
|||||||
{ 0.01654127246315, -0.04533310458085, 0.09585268418557, -0.20266133815190, 0.79117042386878, 0.44560418147640, -0.13991265473712, 0.05816126837865, -0.01985640750433}
|
{ 0.01654127246315, -0.04533310458085, 0.09585268418557, -0.20266133815190, 0.79117042386878, 0.44560418147640, -0.13991265473712, 0.05816126837865, -0.01985640750433}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(WEBRTC_LINUX)
|
|
||||||
extern long int lrint(double x); /* Note! This declaration is missing in math.h, that is why it is declared as extern*/
|
|
||||||
#define WebRtcIsac_lrint lrint
|
|
||||||
#elif defined(WEBRTC_MAC)
|
|
||||||
extern long int lrint(double x); /* Note! This declaration is missing in math.h, that is why it is declared as extern*/
|
|
||||||
#define WebRtcIsac_lrint lrint
|
|
||||||
#elif defined(X64)
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
intgr = (WebRtc_Word32)floor(flt+.499999999999);
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
#elif defined(WEBRTC_TARGET_PC)
|
|
||||||
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
|
|
||||||
_asm
|
|
||||||
{
|
|
||||||
fld flt
|
|
||||||
fistp intgr
|
|
||||||
} ;
|
|
||||||
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else// Do a slow but correct implementation of lrint
|
|
||||||
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
intgr = (WebRtc_Word32)floor(flt+.499999999999);
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WebRtcIsac_PitchfilterPre(double *indat,
|
void WebRtcIsac_PitchfilterPre(double *indat,
|
||||||
double *outdat,
|
double *outdat,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
#include "codec.h"
|
#include "codec.h"
|
||||||
|
#include "os_specific_inline.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
static double costab1[FRAMESAMPLES_HALF];
|
static double costab1[FRAMESAMPLES_HALF];
|
||||||
@@ -18,41 +19,6 @@ static double sintab1[FRAMESAMPLES_HALF];
|
|||||||
static double costab2[FRAMESAMPLES_QUARTER];
|
static double costab2[FRAMESAMPLES_QUARTER];
|
||||||
static double sintab2[FRAMESAMPLES_QUARTER];
|
static double sintab2[FRAMESAMPLES_QUARTER];
|
||||||
|
|
||||||
#if defined(WEBRTC_LINUX)
|
|
||||||
extern long int lrint(double x); /* Note! This declaration is missing in math.h, that is why it is declared as extern*/
|
|
||||||
#define WebRtcIsac_lrint lrint
|
|
||||||
#elif defined(WEBRTC_MAC)
|
|
||||||
extern long int lrint(double x); /* Note! This declaration is missing in math.h, that is why it is declared as extern*/
|
|
||||||
#define WebRtcIsac_lrint lrint
|
|
||||||
#elif defined(X64)
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
intgr = (WebRtc_Word32)floor(flt+.499999999999);
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
#elif defined(WEBRTC_TARGET_PC)
|
|
||||||
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
|
|
||||||
_asm
|
|
||||||
{
|
|
||||||
fld flt
|
|
||||||
fistp intgr
|
|
||||||
} ;
|
|
||||||
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
#else// Do a slow but correct implementation of lrint
|
|
||||||
|
|
||||||
static __inline WebRtc_Word32 WebRtcIsac_lrint(double flt) {
|
|
||||||
WebRtc_Word32 intgr;
|
|
||||||
intgr = (WebRtc_Word32)floor(flt+.499999999999);
|
|
||||||
return intgr ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WebRtcIsac_InitTransform()
|
void WebRtcIsac_InitTransform()
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
|
|||||||
Reference in New Issue
Block a user