Refactor and unittest for CNG.

Patch Set 1:
- Formatted file.
- Fixed format of comments.
- Removed:
  - WebRtcCng_Version,
  - WebRtcCng_AssignSizeEnc
  - WebRtcCng_AssignSizeDec.
- Changed type of input variable |fs| in WebRtcCng_InitEnc
  to unsigned.
- Added extra check in WebRtcCng_CreateEnc and
  WebRtcCng_CreateDec.
- Added extra check in WebRtcCng_InitEnc for |quality|.
- Removed () on return values.

Patch Set 2:
- Formatted cng_helpfunc.*.
- Added tests for Encoder.
- Added calls to WebRtcSpl_Init();

Patch Set 3:
- Added tests for WebRtcCng_UpdateSid.
- Added tests for WebRtcCng_Generate.

Patch Set 4:
- More comments.
- Re-ordered some lines.
- Adding calls to WebRtcCng_GetErrorCodeEnc and WebRtcCng_GetErrorCodeDec.

TEST=cng_unittests

Review URL: https://webrtc-codereview.appspot.com/822004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2837 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tina.legrand@webrtc.org
2012-09-28 07:12:00 +00:00
parent 9a6dac4193
commit a4f9ba6a3f
5 changed files with 817 additions and 709 deletions

View File

@@ -8,57 +8,43 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc_cng.h"
#include "signal_processing_library.h"
#include "typedefs.h"
#include "cng_helpfuns.h"
#include "signal_processing_library.h"
#include "typedefs.h"
#include "webrtc_cng.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Values in |k| are Q15, and |a| Q12. */
void WebRtcCng_K2a16(int16_t* k, int useOrder, int16_t* a) {
int16_t any[WEBRTC_SPL_MAX_LPC_ORDER + 1];
int16_t *aptr, *aptr2, *anyptr;
const int16_t *kptr;
int m, i;
kptr = k;
*a = 4096; /* i.e., (Word16_MAX >> 3) + 1 */
*any = *a;
a[1] = (*k + 4) >> 3;
for (m = 1; m < useOrder; m++) {
kptr++;
aptr = a;
aptr++;
aptr2 = &a[m];
anyptr = any;
anyptr++;
void WebRtcCng_K2a16(
WebRtc_Word16 *k, /* Q15. */
int useOrder,
WebRtc_Word16 *a /* Q12. */
)
{
WebRtc_Word16 any[WEBRTC_SPL_MAX_LPC_ORDER+1];
WebRtc_Word16 *aptr, *aptr2, *anyptr;
G_CONST WebRtc_Word16 *kptr;
int m, i;
kptr = k;
*a = 4096; /* i.e., (Word16_MAX >> 3)+1 */
*any = *a;
a[1] = (*k+4) >> 3;
for( m=1; m<useOrder; m++ )
{
kptr++;
aptr = a;
aptr++;
aptr2 = &a[m];
anyptr = any;
anyptr++;
any[m+1] = (*kptr+4) >> 3;
for( i=0; i<m; i++ ) {
*anyptr++ = (*aptr++) + (WebRtc_Word16)( (( (WebRtc_Word32)(*aptr2--) * (WebRtc_Word32)*kptr )+16384) >> 15);
}
aptr = a;
anyptr = any;
for( i=0; i<(m+2); i++ ){
*aptr++ = *anyptr++;
}
any[m + 1] = (*kptr + 4) >> 3;
for (i = 0; i < m; i++) {
*anyptr++ = (*aptr++) +
(WebRtc_Word16)(
(((WebRtc_Word32)(*aptr2--) * (WebRtc_Word32) * kptr) + 16384)
>> 15);
}
aptr = a;
anyptr = any;
for (i = 0; i < (m + 2); i++) {
*aptr++ = *anyptr++;
}
}
}
#ifdef __cplusplus
}
#endif

View File

@@ -7,22 +7,19 @@
* 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_CNG_CNG_HELPFUNS_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_CNG_HELPFUNS_H_
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_MAIN_SOURCE_CNG_HELPFUNS_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_MAIN_SOURCE_CNG_HELPFUNS_H_
extern WebRtc_Word32 lpc_lagwinTbl_fixw32[WEBRTC_CNG_MAX_LPC_ORDER + 1];
#include "typedefs.h"
#ifdef __cplusplus
extern "C" {
#endif
void WebRtcCng_K2a16(WebRtc_Word16 *k, int useOrder, WebRtc_Word16 *a);
void WebRtcCng_K2a16(int16_t* k, int useOrder, int16_t* a);
#ifdef __cplusplus
}
#endif
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_MAIN_SOURCE_CNG_HELPFUNS_H_
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_CNG_HELPFUNS_H_

View File

@@ -7,11 +7,340 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <string>
/*
* Empty test just to get code coverage metrics for this dir.
*/
#include "webrtc_cng.h"
#include "gtest/gtest.h"
#include "testsupport/fileutils.h"
#include "webrtc_cng.h"
TEST(CngTest, EmptyTestToGetCodeCoverage) {}
namespace webrtc {
enum {
kSidShortIntervalUpdate = 1,
kSidNormalIntervalUpdate = 100,
kSidLongIntervalUpdate = 10000
};
enum {
kCNGNumParamsLow = 0,
kCNGNumParamsNormal = 8,
kCNGNumParamsHigh = WEBRTC_CNG_MAX_LPC_ORDER,
kCNGNumParamsTooHigh = WEBRTC_CNG_MAX_LPC_ORDER + 1
};
enum {
kNoSid,
kForceSid
};
class CngTest : public ::testing::Test {
protected:
CngTest();
virtual void SetUp();
CNG_enc_inst* cng_enc_inst_;
CNG_dec_inst* cng_dec_inst_;
int16_t speech_data_[640]; // Max size of CNG internal buffers.
};
CngTest::CngTest()
: cng_enc_inst_(NULL),
cng_dec_inst_(NULL) {
}
void CngTest::SetUp() {
FILE* input_file;
const std::string file_name =
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
input_file = fopen(file_name.c_str(), "rb");
ASSERT_TRUE(input_file != NULL);
ASSERT_EQ(480, static_cast<int32_t>(fread(speech_data_, sizeof(int16_t),
480, input_file)));
fclose(input_file);
input_file = NULL;
}
// Test failing Create.
TEST_F(CngTest, CngCreateFail) {
// Test to see that an invalid pointer is caught.
EXPECT_EQ(-1, WebRtcCng_CreateEnc(NULL));
EXPECT_EQ(-1, WebRtcCng_CreateDec(NULL));
}
// Test normal Create.
TEST_F(CngTest, CngCreate) {
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
EXPECT_TRUE(cng_enc_inst_ != NULL);
EXPECT_TRUE(cng_dec_inst_ != NULL);
// Free encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_FreeDec(cng_dec_inst_));
}
// Create CNG encoder, init with faulty values, free CNG encoder.
TEST_F(CngTest, CngInitFail) {
// Create encoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
// Call with too few parameters.
EXPECT_EQ(-1, WebRtcCng_InitEnc(cng_enc_inst_, 8000, kSidNormalIntervalUpdate,
kCNGNumParamsLow));
EXPECT_EQ(6130, WebRtcCng_GetErrorCodeEnc(cng_enc_inst_));
// Call with too many parameters.
EXPECT_EQ(-1, WebRtcCng_InitEnc(cng_enc_inst_, 8000, kSidNormalIntervalUpdate,
kCNGNumParamsTooHigh));
EXPECT_EQ(6130, WebRtcCng_GetErrorCodeEnc(cng_enc_inst_));
// Free encoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
}
TEST_F(CngTest, CngEncode) {
uint8_t sid_data[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t number_bytes;
// Create encoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
// 8 kHz, Normal number of parameters
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 8000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 80, sid_data,
&number_bytes, kNoSid));
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 80, sid_data, &number_bytes, kForceSid));
// 16 kHz, Normal number of parameters
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 160, sid_data,
&number_bytes, kNoSid));
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 160, sid_data, &number_bytes, kForceSid));
// 32 kHz, Max number of parameters
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 32000, kSidNormalIntervalUpdate,
kCNGNumParamsHigh));
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 320, sid_data,
&number_bytes, kNoSid));
EXPECT_EQ(kCNGNumParamsHigh + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 320, sid_data, &number_bytes, kForceSid));
// 48 kHz, Normal number of parameters
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 48000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 480, sid_data,
&number_bytes, kNoSid));
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 480, sid_data, &number_bytes, kForceSid));
// 64 kHz, Normal number of parameters
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 64000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 640, sid_data,
&number_bytes, kNoSid));
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 640, sid_data, &number_bytes, kForceSid));
// Free encoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
}
// Encode Cng with too long input vector.
TEST_F(CngTest, CngEncodeTooLong) {
uint8_t sid_data[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t number_bytes;
// Create and init encoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 8000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
// Run encoder with too much data.
EXPECT_EQ(-1, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 641, sid_data,
&number_bytes, kNoSid));
EXPECT_EQ(6140, WebRtcCng_GetErrorCodeEnc(cng_enc_inst_));
// Free encoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
}
// Call encode without calling init.
TEST_F(CngTest, CngEncodeNoInit) {
uint8_t sid_data[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t number_bytes;
// Create encoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
// Run encoder without calling init.
EXPECT_EQ(-1, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 640, sid_data,
&number_bytes, kNoSid));
EXPECT_EQ(6120, WebRtcCng_GetErrorCodeEnc(cng_enc_inst_));
// Free encoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
}
// Update SID parameters, for both 9 and 16 parameters.
TEST_F(CngTest, CngUpdateSid) {
uint8_t sid_data[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t number_bytes;
// Create and initialize encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
// Run normal Encode and UpdateSid.
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 160, sid_data, &number_bytes, kForceSid));
EXPECT_EQ(0, WebRtcCng_UpdateSid(cng_dec_inst_, sid_data,
kCNGNumParamsNormal + 1));
// Reinit with new length.
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
kCNGNumParamsHigh));
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
// Expect 0 because of unstable parameters after switching length.
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 160, sid_data,
&number_bytes, kForceSid));
EXPECT_EQ(kCNGNumParamsHigh + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_ + 160, 160, sid_data, &number_bytes,
kForceSid));
EXPECT_EQ(0, WebRtcCng_UpdateSid(cng_dec_inst_, sid_data,
kCNGNumParamsNormal + 1));
// Free encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_FreeDec(cng_dec_inst_));
}
// Update SID parameters, with wrong parameters or without calling decode.
TEST_F(CngTest, CngUpdateSidErroneous) {
uint8_t sid_data[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t number_bytes;
// Create encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
// Encode.
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 160, sid_data, &number_bytes, kForceSid));
// Update Sid before initializing decoder.
EXPECT_EQ(-1, WebRtcCng_UpdateSid(cng_dec_inst_, sid_data,
kCNGNumParamsNormal + 1));
EXPECT_EQ(6220, WebRtcCng_GetErrorCodeDec(cng_dec_inst_));
// Initialize decoder.
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
// First run with valid parameters, then with too many CNG parameters.
// The function will operate correctly by only reading the maximum number of
// parameters, skipping the extra.
EXPECT_EQ(0, WebRtcCng_UpdateSid(cng_dec_inst_, sid_data,
kCNGNumParamsNormal + 1));
EXPECT_EQ(0, WebRtcCng_UpdateSid(cng_dec_inst_, sid_data,
kCNGNumParamsTooHigh + 1));
// Free encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_FreeDec(cng_dec_inst_));
}
// Test to generate cng data, by forcing SID. Both normal and faulty condition.
TEST_F(CngTest, CngGenerate) {
uint8_t sid_data[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t out_data[640];
int16_t number_bytes;
// Create and initialize encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
// Normal Encode.
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 160, sid_data, &number_bytes, kForceSid));
// Normal UpdateSid.
EXPECT_EQ(0, WebRtcCng_UpdateSid(cng_dec_inst_, sid_data,
kCNGNumParamsNormal + 1));
// Two normal Generate, one with new_period.
EXPECT_EQ(0, WebRtcCng_Generate(cng_dec_inst_, out_data, 640, 1));
EXPECT_EQ(0, WebRtcCng_Generate(cng_dec_inst_, out_data, 640, 0));
// Call Genereate with too much data.
EXPECT_EQ(-1, WebRtcCng_Generate(cng_dec_inst_, out_data, 641, 0));
EXPECT_EQ(6140, WebRtcCng_GetErrorCodeDec(cng_dec_inst_));
// Free encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_FreeDec(cng_dec_inst_));
}
// Test automatic SID.
TEST_F(CngTest, CngAutoSid) {
uint8_t sid_data[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t number_bytes;
// Create and initialize encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
// Normal Encode, 100 msec, where no SID data should be generated.
for (int i = 0; i < 10; i++) {
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 160, sid_data,
&number_bytes, kNoSid));
}
// We have reached 100 msec, and SID data should be generated.
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 160, sid_data, &number_bytes, kNoSid));
// Free encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
}
// Test automatic SID, with very short interval.
TEST_F(CngTest, CngAutoSidShort) {
uint8_t sid_data[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t number_bytes;
// Create and initialize encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_CreateEnc(&cng_enc_inst_));
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidShortIntervalUpdate,
kCNGNumParamsNormal));
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
// First call will never generate SID, unless forced to.
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 160, sid_data,
&number_bytes, kNoSid));
// Normal Encode, 100 msec, SID data should be generated all the time.
for (int i = 0; i < 10; i++) {
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
cng_enc_inst_, speech_data_, 160, sid_data, &number_bytes, kNoSid));
}
// Free encoder and decoder memory.
EXPECT_EQ(0, WebRtcCng_FreeEnc(cng_enc_inst_));
}
} // namespace webrtc

View File

@@ -21,71 +21,18 @@ extern "C" {
#define WEBRTC_CNG_MAX_LPC_ORDER 12
#define WEBRTC_CNG_MAX_OUTSIZE_ORDER 640
/* Define Error codes */
/* Define Error codes. */
/* 6100 Encoder */
#define CNG_ENCODER_MEMORY_ALLOCATION_FAILED 6110
#define CNG_ENCODER_NOT_INITIATED 6120
#define CNG_DISALLOWED_LPC_ORDER 6130
#define CNG_DISALLOWED_FRAME_SIZE 6140
#define CNG_DISALLOWED_SAMPLING_FREQUENCY 6150
/* 6200 Decoder */
#define CNG_DECODER_MEMORY_ALLOCATION_FAILED 6210
#define CNG_DECODER_NOT_INITIATED 6220
typedef struct WebRtcCngEncInst CNG_enc_inst;
typedef struct WebRtcCngDecInst CNG_dec_inst;
/****************************************************************************
* WebRtcCng_Version(...)
*
* These functions returns the version name (string must be at least
* 500 characters long)
*
* Output:
* - version : Pointer to character string
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcCng_Version(char *version);
/****************************************************************************
* WebRtcCng_AssignSizeEnc/Dec(...)
*
* These functions get the size needed for storing the instance for encoder
* and decoder, respectively
*
* Input/Output:
* - sizeinbytes : Pointer to integer where the size is returned
*
* Return value : 0
*/
WebRtc_Word16 WebRtcCng_AssignSizeEnc(int *sizeinbytes);
WebRtc_Word16 WebRtcCng_AssignSizeDec(int *sizeinbytes);
/****************************************************************************
* WebRtcCng_AssignEnc/Dec(...)
*
* These functions Assignes memory for the instances.
*
* Input:
* - CNG_inst_Addr : Adress to where to assign memory
* Output:
* - inst : Pointer to the instance that should be created
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcCng_AssignEnc(CNG_enc_inst **inst, void *CNG_inst_Addr);
WebRtc_Word16 WebRtcCng_AssignDec(CNG_dec_inst **inst, void *CNG_inst_Addr);
typedef struct WebRtcCngEncInst CNG_enc_inst;
typedef struct WebRtcCngDecInst CNG_dec_inst;
/****************************************************************************
* WebRtcCng_CreateEnc/Dec(...)
@@ -98,10 +45,8 @@ WebRtc_Word16 WebRtcCng_AssignDec(CNG_dec_inst **inst, void *CNG_inst_Addr);
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcCng_CreateEnc(CNG_enc_inst **cng_inst);
WebRtc_Word16 WebRtcCng_CreateDec(CNG_dec_inst **cng_inst);
int16_t WebRtcCng_CreateEnc(CNG_enc_inst** cng_inst);
int16_t WebRtcCng_CreateDec(CNG_dec_inst** cng_inst);
/****************************************************************************
* WebRtcCng_InitEnc/Dec(...)
@@ -122,13 +67,10 @@ WebRtc_Word16 WebRtcCng_CreateDec(CNG_dec_inst **cng_inst);
* -1 - Error
*/
WebRtc_Word16 WebRtcCng_InitEnc(CNG_enc_inst *cng_inst,
WebRtc_Word16 fs,
WebRtc_Word16 interval,
WebRtc_Word16 quality);
WebRtc_Word16 WebRtcCng_InitDec(CNG_dec_inst *cng_dec_inst);
int16_t WebRtcCng_InitEnc(CNG_enc_inst* cng_inst, uint16_t fs, int16_t interval,
int16_t quality);
int16_t WebRtcCng_InitDec(CNG_dec_inst* cng_inst);
/****************************************************************************
* WebRtcCng_FreeEnc/Dec(...)
*
@@ -140,12 +82,8 @@ WebRtc_Word16 WebRtcCng_InitDec(CNG_dec_inst *cng_dec_inst);
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcCng_FreeEnc(CNG_enc_inst *cng_inst);
WebRtc_Word16 WebRtcCng_FreeDec(CNG_dec_inst *cng_inst);
int16_t WebRtcCng_FreeEnc(CNG_enc_inst* cng_inst);
int16_t WebRtcCng_FreeDec(CNG_dec_inst* cng_inst);
/****************************************************************************
* WebRtcCng_Encode(...)
@@ -164,14 +102,9 @@ WebRtc_Word16 WebRtcCng_FreeDec(CNG_dec_inst *cng_inst);
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcCng_Encode(CNG_enc_inst *cng_inst,
WebRtc_Word16 *speech,
WebRtc_Word16 nrOfSamples,
WebRtc_UWord8* SIDdata,
WebRtc_Word16 *bytesOut,
WebRtc_Word16 forceSID);
int16_t WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech,
int16_t nrOfSamples, uint8_t* SIDdata,
int16_t* bytesOut, int16_t forceSID);
/****************************************************************************
* WebRtcCng_UpdateSid(...)
@@ -186,10 +119,8 @@ WebRtc_Word16 WebRtcCng_Encode(CNG_enc_inst *cng_inst,
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcCng_UpdateSid(CNG_dec_inst *cng_inst,
WebRtc_UWord8 *SID,
WebRtc_Word16 length);
int16_t WebRtcCng_UpdateSid(CNG_dec_inst* cng_inst, uint8_t* SID,
int16_t length);
/****************************************************************************
* WebRtcCng_Generate(...)
@@ -205,11 +136,8 @@ WebRtc_Word16 WebRtcCng_UpdateSid(CNG_dec_inst *cng_inst,
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcCng_Generate(CNG_dec_inst *cng_inst,
WebRtc_Word16 * outData,
WebRtc_Word16 nrOfSamples,
WebRtc_Word16 new_period);
int16_t WebRtcCng_Generate(CNG_dec_inst* cng_inst, int16_t* outData,
int16_t nrOfSamples, int16_t new_period);
/*****************************************************************************
* WebRtcCng_GetErrorCodeEnc/Dec(...)
@@ -224,10 +152,8 @@ WebRtc_Word16 WebRtcCng_Generate(CNG_dec_inst *cng_inst,
*
* Return value : Error code
*/
WebRtc_Word16 WebRtcCng_GetErrorCodeEnc(CNG_enc_inst *cng_inst);
WebRtc_Word16 WebRtcCng_GetErrorCodeDec(CNG_dec_inst *cng_inst);
int16_t WebRtcCng_GetErrorCodeEnc(CNG_enc_inst* cng_inst);
int16_t WebRtcCng_GetErrorCodeDec(CNG_dec_inst* cng_inst);
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff