48 kHz extension to iSAC.
Test: -manual test with voe_cmd_test. -manual test with RTPEncode & NetEqRTPPlay. -manual test with simpleKenny. -Bit-exact test of iSAC-swb and iSAC-wb with head revision of trunk. The bit-exactness is confirmed on all files generated by running webrtc/modules/audio_coding/codecs/isac/main/test/QA/runiSACLongtest.txt Review URL: https://webrtc-codereview.appspot.com/937025 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3226 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -115,6 +115,9 @@ int WebRtcNetEQ_DbAdd(CodecDbInst_t *inst, enum WebRtcNetEQDecoder codec,
|
||||
#ifdef NETEQ_ISAC_SWB_CODEC
|
||||
case kDecoderISACswb :
|
||||
#endif
|
||||
#ifdef NETEQ_ISAC_FB_CODEC
|
||||
case kDecoderISACfb :
|
||||
#endif
|
||||
#ifdef NETEQ_OPUS_CODEC
|
||||
case kDecoderOpus :
|
||||
#endif
|
||||
@ -463,6 +466,9 @@ int WebRtcNetEQ_DbGetSplitInfo(SplitInfo_t *inst, enum WebRtcNetEQDecoder codecI
|
||||
#ifdef NETEQ_ISAC_SWB_CODEC
|
||||
case kDecoderISACswb:
|
||||
#endif
|
||||
#ifdef NETEQ_ISAC_FB_CODEC
|
||||
case kDecoderISACfb:
|
||||
#endif
|
||||
#ifdef NETEQ_OPUS_CODEC
|
||||
case kDecoderOpus:
|
||||
#endif
|
||||
|
||||
@ -37,6 +37,7 @@ enum WebRtcNetEQDecoder
|
||||
kDecoderILBC,
|
||||
kDecoderISAC,
|
||||
kDecoderISACswb,
|
||||
kDecoderISACfb,
|
||||
kDecoderPCM16B,
|
||||
kDecoderPCM16Bwb,
|
||||
kDecoderPCM16Bswb32kHz,
|
||||
|
||||
@ -102,6 +102,18 @@
|
||||
inst.funcDurationEst=NULL; \
|
||||
inst.funcGetErrorCode=(WebRtcNetEQ_FuncGetErrorCode)WebRtcIsac_GetErrorCode;
|
||||
|
||||
#define SET_ISACFB_FUNCTIONS(inst) \
|
||||
inst.funcDecode=(WebRtcNetEQ_FuncDecode)WebRtcIsac_Decode; \
|
||||
inst.funcDecodeRCU=(WebRtcNetEQ_FuncDecode)WebRtcIsac_DecodeRcu; \
|
||||
inst.funcDecodePLC=NULL; \
|
||||
inst.funcDecodeInit=(WebRtcNetEQ_FuncDecodeInit)WebRtcIsac_DecoderInit; \
|
||||
inst.funcAddLatePkt=NULL; \
|
||||
inst.funcGetMDinfo=NULL; \
|
||||
inst.funcGetPitch=NULL; \
|
||||
inst.funcUpdBWEst=(WebRtcNetEQ_FuncUpdBWEst)WebRtcIsac_UpdateBwEstimate; \
|
||||
inst.funcDurationEst=NULL; \
|
||||
inst.funcGetErrorCode=(WebRtcNetEQ_FuncGetErrorCode)WebRtcIsac_GetErrorCode;
|
||||
|
||||
#define SET_G729_FUNCTIONS(inst) \
|
||||
inst.funcDecode=(WebRtcNetEQ_FuncDecode)WebRtcG729_Decode; \
|
||||
inst.funcDecodeRCU=NULL; \
|
||||
|
||||
@ -122,6 +122,7 @@
|
||||
'CODEC_ISAC',
|
||||
'CODEC_PCM16B_WB',
|
||||
'CODEC_ISAC_SWB',
|
||||
'CODEC_ISAC_FB',
|
||||
'CODEC_PCM16B_32KHZ',
|
||||
'CODEC_CNGCODEC8',
|
||||
'CODEC_CNGCODEC16',
|
||||
@ -159,6 +160,7 @@
|
||||
'CODEC_ISAC',
|
||||
'CODEC_PCM16B_WB',
|
||||
'CODEC_ISAC_SWB',
|
||||
'CODEC_ISAC_FB',
|
||||
'CODEC_PCM16B_32KHZ',
|
||||
'CODEC_CNGCODEC8',
|
||||
'CODEC_CNGCODEC16',
|
||||
@ -271,6 +273,7 @@
|
||||
'CODEC_ISAC',
|
||||
'CODEC_PCM16B_WB',
|
||||
'CODEC_ISAC_SWB',
|
||||
'CODEC_ISAC_FB',
|
||||
'CODEC_PCM16B_32KHZ',
|
||||
'CODEC_CNGCODEC8',
|
||||
'CODEC_CNGCODEC16',
|
||||
|
||||
@ -65,6 +65,10 @@
|
||||
*
|
||||
* NETEQ_ISAC_SWB_CODEC Enable iSAC-SWB
|
||||
*
|
||||
* Note that the decoder of iSAC full-band operates at 32 kHz, that is the
|
||||
* decoded signal is at 32 kHz.
|
||||
* NETEQ_ISAC_FB_CODEC Enable iSAC-FB
|
||||
*
|
||||
* NETEQ_G722_CODEC Enable G.722
|
||||
*
|
||||
* NETEQ_G729_CODEC Enable G.729
|
||||
@ -302,6 +306,7 @@
|
||||
|
||||
/* Fullband 48 kHz codecs */
|
||||
#define NETEQ_OPUS_CODEC
|
||||
#define NETEQ_ISAC_FB_CODEC
|
||||
#endif
|
||||
|
||||
#if (defined(NETEQ_ALL_CODECS))
|
||||
@ -339,6 +344,7 @@
|
||||
/* Super wideband 48kHz codecs */
|
||||
#define NETEQ_48KHZ_WIDEBAND
|
||||
#define NETEQ_OPUS_CODEC
|
||||
#define NETEQ_ISAC_FB
|
||||
#endif
|
||||
|
||||
/* Max output size from decoding one frame */
|
||||
|
||||
@ -615,7 +615,8 @@ int WebRtcNetEQ_GetDefaultCodecSettings(const enum WebRtcNetEQDecoder *codecID,
|
||||
codecBytes = 960; /* 240ms @ 32kbps (60ms frames) */
|
||||
codecBuffers = 8;
|
||||
}
|
||||
else if (codecID[i] == kDecoderISACswb)
|
||||
else if ((codecID[i] == kDecoderISACswb) ||
|
||||
(codecID[i] == kDecoderISACfb))
|
||||
{
|
||||
codecBytes = 1560; /* 240ms @ 52kbps (30ms frames) */
|
||||
codecBuffers = 8;
|
||||
|
||||
@ -380,11 +380,12 @@ int WebRtcNetEQ_GetTimestampScaling(MCUInst_t *MCU_inst, int rtpPayloadType)
|
||||
MCU_inst->scalingFactor = kTSscalingTwo;
|
||||
break;
|
||||
}
|
||||
case kDecoderISACfb:
|
||||
case kDecoderOpus:
|
||||
{
|
||||
/* We resample Opus internally to 32 kHz, but timestamps
|
||||
* are counted at 48 kHz. So there are two output samples
|
||||
* per three RTP timestamp ticks. */
|
||||
/* We resample Opus internally to 32 kHz, and isac-fb decodes at
|
||||
* 32 kHz, but timestamps are counted at 48 kHz. So there are two
|
||||
* output samples per three RTP timestamp ticks. */
|
||||
MCU_inst->scalingFactor = kTSscalingTwoThirds;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ NETEQTEST_Decoder(kDecoderISAC, 16000, "iSAC", pt)
|
||||
}
|
||||
|
||||
WebRtcIsac_EncoderInit((ISACStruct *) _decoder, 0);
|
||||
WebRtcIsac_SetDecSampRate((ISACStruct *) _decoder, kIsacWideband);
|
||||
WebRtcIsac_SetDecSampRate((ISACStruct *) _decoder, 16000);
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ NETEQTEST_Decoder(kDecoderISACswb, 32000, "iSAC swb", pt)
|
||||
}
|
||||
|
||||
WebRtcIsac_EncoderInit((ISACStruct *) _decoder, 0);
|
||||
WebRtcIsac_SetDecSampRate((ISACStruct *) _decoder, kIsacSuperWideband);
|
||||
WebRtcIsac_SetDecSampRate((ISACStruct *) _decoder, 32000);
|
||||
}
|
||||
|
||||
decoder_iSACSWB::~decoder_iSACSWB()
|
||||
@ -113,6 +113,32 @@ int decoder_iSACSWB::loadToNetEQ(NETEQTEST_NetEQClass & neteq)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CODEC_ISAC_FB
|
||||
decoder_iSACFB::decoder_iSACFB(WebRtc_UWord8 pt)
|
||||
: NETEQTEST_Decoder(kDecoderISACfb, 32000, "iSAC fb", pt) {
|
||||
WebRtc_Word16 err = WebRtcIsac_Create((ISACStruct **) &_decoder);
|
||||
if (err) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
WebRtcIsac_EncoderInit((ISACStruct *) _decoder, 0);
|
||||
WebRtcIsac_SetDecSampRate((ISACStruct *) _decoder, 32000);
|
||||
}
|
||||
|
||||
decoder_iSACFB::~decoder_iSACFB() {
|
||||
if (_decoder) {
|
||||
WebRtcIsac_Free((ISACStruct *) _decoder);
|
||||
_decoder = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int decoder_iSACFB::loadToNetEQ(NETEQTEST_NetEQClass & neteq){
|
||||
WebRtcNetEQ_CodecDef codecInst;
|
||||
SET_ISACFB_FUNCTIONS(codecInst);
|
||||
return(NETEQTEST_Decoder::loadToNetEQ(neteq, codecInst));
|
||||
}
|
||||
#endif
|
||||
|
||||
// PCM u/A
|
||||
#ifdef CODEC_G711
|
||||
#include "g711_interface.h"
|
||||
|
||||
@ -64,6 +64,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class decoder_iSACFB : public NETEQTEST_Decoder {
|
||||
public:
|
||||
decoder_iSACFB(WebRtc_UWord8 pt = 0);
|
||||
virtual ~decoder_iSACFB();
|
||||
int loadToNetEQ(NETEQTEST_NetEQClass & neteq);
|
||||
};
|
||||
|
||||
|
||||
class decoder_PCMU : public NETEQTEST_Decoder
|
||||
{
|
||||
public:
|
||||
|
||||
@ -955,6 +955,12 @@ void parsePtypeFile(FILE *ptypeFile, std::map<WebRtc_UWord8, decoderStruct>* dec
|
||||
tempDecoder.fs = 32000;
|
||||
}
|
||||
#endif
|
||||
#ifdef CODEC_ISAC_FB
|
||||
else if(strcmp(codec, "isacfb") == 0) {
|
||||
tempDecoder.codec = kDecoderISACfb;
|
||||
tempDecoder.fs = 32000;
|
||||
}
|
||||
#endif
|
||||
#ifdef CODEC_IPCMWB
|
||||
else if(strcmp(codec, "ipcmwb") == 0) {
|
||||
tempDecoder.codec = kDecoderIPCMwb;
|
||||
@ -1358,6 +1364,11 @@ void createAndInsertDecoders (NETEQTEST_NetEQClass *neteq, std::map<WebRtc_UWord
|
||||
*dec = new decoder_iSACSWB( pt );
|
||||
break;
|
||||
#endif
|
||||
#ifdef CODEC_ISAC_FB
|
||||
case kDecoderISACfb:
|
||||
*dec = new decoder_iSACFB(pt);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CODEC_G729
|
||||
case kDecoderG729:
|
||||
*dec = new decoder_G729( pt );
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#define NETEQ_CODEC_ISAC_PT 103
|
||||
#define NETEQ_CODEC_ISACLC_PT 119
|
||||
#define NETEQ_CODEC_ISACSWB_PT 104
|
||||
#define NETEQ_CODEC_ISACFB_PT 124
|
||||
#define NETEQ_CODEC_AVT_PT 106
|
||||
#define NETEQ_CODEC_G722_1_16_PT 108
|
||||
#define NETEQ_CODEC_G722_1_24_PT 109
|
||||
@ -53,7 +54,7 @@
|
||||
#define NETEQ_CODEC_CN_SWB_PT 126
|
||||
#define NETEQ_CODEC_G729_1_PT 107
|
||||
#define NETEQ_CODEC_G729D_PT 123
|
||||
#define NETEQ_CODEC_MELPE_PT 124
|
||||
//#define NETEQ_CODEC_MELPE_PT 124
|
||||
#define NETEQ_CODEC_CELT32_PT 114
|
||||
|
||||
/* Extra dynamic codepoints */
|
||||
|
||||
@ -110,7 +110,7 @@ void stereoInterleave(unsigned char* data, int dataLen, int stride);
|
||||
#ifdef CODEC_ILBC
|
||||
#include "ilbc.h"
|
||||
#endif
|
||||
#if (defined CODEC_ISAC || defined CODEC_ISAC_SWB)
|
||||
#if (defined CODEC_ISAC || defined CODEC_ISAC_SWB || defined CODEC_ISAC_FB)
|
||||
#include "isac.h"
|
||||
#endif
|
||||
#ifdef NETEQ_ISACFIX_CODEC
|
||||
@ -217,6 +217,9 @@ WebRtcVadInst *VAD_inst[2];
|
||||
#ifdef CODEC_ISAC_SWB
|
||||
ISACStruct *ISACSWB_inst[2];
|
||||
#endif
|
||||
#ifdef CODEC_ISAC_FB
|
||||
ISACStruct *ISACFB_inst[2];
|
||||
#endif
|
||||
#ifdef CODEC_GSMFR
|
||||
GSMFR_encinst_t *GSMFRenc_inst[2];
|
||||
#endif
|
||||
@ -362,6 +365,9 @@ int main(int argc, char* argv[])
|
||||
#ifdef CODEC_ISAC_SWB
|
||||
printf(" : isacswb iSAC SWB (32kHz and 32.0-52.0 kbps). To set rate specify a rate parameter as last parameter\n");
|
||||
#endif
|
||||
#ifdef CODEC_ISAC_FB
|
||||
printf(" : isacfb iSAC FB (48kHz encoder 32kHz decoder and 32.0-52.0 kbps). To set rate specify a rate parameter as last parameter\n");
|
||||
#endif
|
||||
#ifdef CODEC_GSMFR
|
||||
printf(" : gsmfr GSM FR codec (8kHz and 13kbps)\n");
|
||||
#endif
|
||||
@ -482,7 +488,8 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if ((usedCodec == kDecoderISAC) || (usedCodec == kDecoderISACswb))
|
||||
if ((usedCodec == kDecoderISAC) || (usedCodec == kDecoderISACswb) ||
|
||||
(usedCodec == kDecoderISACfb))
|
||||
{
|
||||
if (argc != 7)
|
||||
{
|
||||
@ -492,7 +499,7 @@ int main(int argc, char* argv[])
|
||||
printf(
|
||||
"Running iSAC at default bitrate of 32000 bps (to specify explicitly add the bps as last parameter)\n");
|
||||
}
|
||||
else // (usedCodec==kDecoderISACswb)
|
||||
else // usedCodec == kDecoderISACswb || usedCodec == kDecoderISACfb
|
||||
{
|
||||
bitrate = 56000;
|
||||
printf(
|
||||
@ -513,12 +520,12 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
printf("Running iSAC at bitrate of %i bps\n", bitrate);
|
||||
}
|
||||
else // (usedCodec==kDecoderISACswb)
|
||||
else // usedCodec == kDecoderISACswb || usedCodec == kDecoderISACfb
|
||||
{
|
||||
if ((bitrate < 32000) || (bitrate > 56000))
|
||||
{
|
||||
printf(
|
||||
"Error: iSAC SWB bitrate must be between 32000 and 56000 bps (%i is invalid)\n",
|
||||
"Error: iSAC SWB/FB bitrate must be between 32000 and 56000 bps (%i is invalid)\n",
|
||||
bitrate);
|
||||
exit(0);
|
||||
}
|
||||
@ -970,11 +977,16 @@ void NetEQTest_GetCodec_and_PT(char * name, enum WebRtcNetEQDecoder *codec, int
|
||||
*codec=kDecoderISAC;
|
||||
*PT=NETEQ_CODEC_ISAC_PT;
|
||||
}
|
||||
else if(!strcmp(name,"isacswb")){
|
||||
*fs=32000;
|
||||
*codec=kDecoderISACswb;
|
||||
*PT=NETEQ_CODEC_ISACSWB_PT;
|
||||
else if(!strcmp(name,"isacswb")){
|
||||
*fs=32000;
|
||||
*codec=kDecoderISACswb;
|
||||
*PT=NETEQ_CODEC_ISACSWB_PT;
|
||||
}
|
||||
else if(!strcmp(name,"isacfb")){
|
||||
*fs=48000;
|
||||
*codec=kDecoderISACfb;
|
||||
*PT=NETEQ_CODEC_ISACFB_PT;
|
||||
}
|
||||
else if(!strcmp(name,"g729")){
|
||||
*fs=8000;
|
||||
*codec=kDecoderG729;
|
||||
@ -1481,7 +1493,7 @@ int NetEQTest_init_coders(enum WebRtcNetEQDecoder coder, int enc_frameSize, int
|
||||
printf("\nError - iSAC SWB only supports frameSize 30 ms\n");
|
||||
exit(0);
|
||||
}
|
||||
ok = WebRtcIsac_SetEncSampRate(ISACSWB_inst[k], kIsacSuperWideband);
|
||||
ok = WebRtcIsac_SetEncSampRate(ISACSWB_inst[k], 32000);
|
||||
if (ok!=0) {
|
||||
printf("Error: Couldn't set sample rate for iSAC SWB instance\n");
|
||||
exit(0);
|
||||
@ -1498,6 +1510,38 @@ int NetEQTest_init_coders(enum WebRtcNetEQDecoder coder, int enc_frameSize, int
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef CODEC_ISAC_FB
|
||||
case kDecoderISACfb:
|
||||
if (sampfreq == 48000) {
|
||||
ok = WebRtcIsac_Create(&ISACFB_inst[k]);
|
||||
if (ok != 0) {
|
||||
printf("Error: Couldn't allocate memory for iSAC FB "
|
||||
"instance\n");
|
||||
exit(0);
|
||||
}
|
||||
if (enc_frameSize != 1440) {
|
||||
printf("\nError - iSAC FB only supports frameSize 30 ms\n");
|
||||
exit(0);
|
||||
}
|
||||
ok = WebRtcIsac_SetEncSampRate(ISACFB_inst[k], 48000);
|
||||
if (ok != 0) {
|
||||
printf("Error: Couldn't set sample rate for iSAC FB "
|
||||
"instance\n");
|
||||
exit(0);
|
||||
}
|
||||
WebRtcIsac_EncoderInit(ISACFB_inst[k], 1);
|
||||
if ((bitrate < 32000) || (bitrate > 56000)) {
|
||||
printf("\nError - iSAC FB bitrate has to be between 32000 and"
|
||||
"56000 bps (not %i)\n", bitrate);
|
||||
exit(0);
|
||||
}
|
||||
WebRtcIsac_Control(ISACFB_inst[k], bitrate, 30);
|
||||
} else {
|
||||
printf("\nError - iSAC FB only support 48 kHz sampling rate.\n");
|
||||
exit(0);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef CODEC_GSMFR
|
||||
case kDecoderGSMFR:
|
||||
if (sampfreq==8000) {
|
||||
@ -1657,6 +1701,11 @@ int NetEQTest_free_coders(enum WebRtcNetEQDecoder coder, int numChannels) {
|
||||
WebRtcIsac_Free(ISACSWB_inst[k]);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CODEC_ISAC_FB
|
||||
case kDecoderISACfb:
|
||||
WebRtcIsac_Free(ISACFB_inst[k]);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CODEC_GSMFR
|
||||
case kDecoderGSMFR:
|
||||
WebRtcGSMFR_FreeEnc(GSMFRenc_inst[k]);
|
||||
@ -1859,6 +1908,18 @@ int NetEQTest_encode(int coder, WebRtc_Word16 *indata, int frameLen, unsigned ch
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef CODEC_ISAC_FB
|
||||
else if (coder == kDecoderISACfb) { /* iSAC FB */
|
||||
int noOfCalls = 0;
|
||||
cdlen = 0;
|
||||
while (cdlen <= 0) {
|
||||
cdlen = WebRtcIsac_Encode(ISACFB_inst[k],
|
||||
&indata[noOfCalls * 480],
|
||||
(WebRtc_Word16*)encoded);
|
||||
noOfCalls++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef CODEC_GSMFR
|
||||
else if (coder==kDecoderGSMFR) { /* GSM FR */
|
||||
cdlen=WebRtcGSMFR_Encode(GSMFRenc_inst[k], indata, frameLen, (WebRtc_Word16*)encoded);
|
||||
|
||||
@ -7,6 +7,7 @@ cn 13
|
||||
ilbc 102
|
||||
isac 103
|
||||
isacswb 104
|
||||
isacfb 124
|
||||
avt 106
|
||||
red 117
|
||||
cn_wb 98
|
||||
|
||||
@ -239,6 +239,8 @@ void NetEqDecodingTest::SelectDecoders(WebRtcNetEQDecoder* used_codec) {
|
||||
dec_.push_back(new decoder_iSAC(103));
|
||||
*used_codec++ = kDecoderISACswb;
|
||||
dec_.push_back(new decoder_iSACSWB(104));
|
||||
*used_codec++ = kDecoderISACfb;
|
||||
dec_.push_back(new decoder_iSACFB(105));
|
||||
*used_codec++ = kDecoderPCM16B;
|
||||
dec_.push_back(new decoder_PCM16B_NB(93));
|
||||
*used_codec++ = kDecoderPCM16Bwb;
|
||||
|
||||
Reference in New Issue
Block a user