From 6a092637f0f9468299867d0f25e24424dbef8c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Thu, 19 Sep 2019 14:37:59 +0200 Subject: [PATCH] Delete obsolete isac "assign" api Bug: None Change-Id: I116e3f4b89e2c1e1f0d06e2ff5d58d2a50e2aadb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153665 Reviewed-by: Oskar Sundbom Reviewed-by: Karl Wiberg Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#29239} --- .../codecs/isac/fix/include/isacfix.h | 28 ---------- .../codecs/isac/fix/source/isacfix.c | 43 -------------- .../codecs/isac/fix/test/kenny.cc | 12 +--- .../codecs/isac/main/include/isac.h | 36 ------------ .../codecs/isac/main/source/isac.c | 56 ------------------- .../test/ReleaseTest-API/ReleaseTest-API.cc | 27 ++------- .../codecs/isac/main/test/simpleKenny.c | 4 -- 7 files changed, 6 insertions(+), 200 deletions(-) diff --git a/modules/audio_coding/codecs/isac/fix/include/isacfix.h b/modules/audio_coding/codecs/isac/fix/include/isacfix.h index 4c95bfdddd..afbacd0235 100644 --- a/modules/audio_coding/codecs/isac/fix/include/isacfix.h +++ b/modules/audio_coding/codecs/isac/fix/include/isacfix.h @@ -23,34 +23,6 @@ typedef struct { extern "C" { #endif -/************************************************************************** - * WebRtcIsacfix_AssignSize(...) - * - * Functions used when malloc is not allowed - * Output the number of bytes needed to allocate for iSAC struct. - * - */ - -int16_t WebRtcIsacfix_AssignSize(int* sizeinbytes); - -/************************************************************************** - * WebRtcIsacfix_Assign(...) - * - * Functions used when malloc is not allowed, it - * places a struct at the given address. - * - * Input: - * - *ISAC_main_inst : a pointer to the coder instance. - * - ISACFIX_inst_Addr : address of the memory where a space is - * for iSAC structure. - * - * Return value : 0 - Ok - * -1 - Error - */ - -int16_t WebRtcIsacfix_Assign(ISACFIX_MainStruct** inst, - void* ISACFIX_inst_Addr); - /**************************************************************************** * WebRtcIsacfix_Create(...) * diff --git a/modules/audio_coding/codecs/isac/fix/source/isacfix.c b/modules/audio_coding/codecs/isac/fix/source/isacfix.c index ef5655e5e0..35cc7e6d7f 100644 --- a/modules/audio_coding/codecs/isac/fix/source/isacfix.c +++ b/modules/audio_coding/codecs/isac/fix/source/isacfix.c @@ -48,45 +48,6 @@ static void InitializeDecoderBitstream(size_t stream_size_bytes, memset(bitstream->stream, 0, sizeof(bitstream->stream)); } -/************************************************************************** - * WebRtcIsacfix_AssignSize(...) - * - * Functions used when malloc is not allowed - * Returns number of bytes needed to allocate for iSAC struct. - * - */ - -int16_t WebRtcIsacfix_AssignSize(int *sizeinbytes) { - *sizeinbytes=sizeof(ISACFIX_SubStruct)*2/sizeof(int16_t); - return(0); -} - -/*************************************************************************** - * WebRtcIsacfix_Assign(...) - * - * Functions used when malloc is not allowed - * Place struct at given address - * - * If successful, Return 0, else Return -1 - */ - -int16_t WebRtcIsacfix_Assign(ISACFIX_MainStruct **inst, void *ISACFIX_inst_Addr) { - if (ISACFIX_inst_Addr!=NULL) { - ISACFIX_SubStruct* self = ISACFIX_inst_Addr; - *inst = (ISACFIX_MainStruct*)self; - self->errorcode = 0; - self->initflag = 0; - self->ISACenc_obj.SaveEnc_ptr = NULL; - WebRtcIsacfix_InitBandwidthEstimator(&self->bwestimator_obj); - return(0); - } else { - return(-1); - } -} - - -#ifndef ISACFIX_NO_DYNAMIC_MEM - /**************************************************************************** * WebRtcIsacfix_Create(...) * @@ -147,10 +108,6 @@ int16_t WebRtcIsacfix_CreateInternal(ISACFIX_MainStruct *ISAC_main_inst) } -#endif - - - /**************************************************************************** * WebRtcIsacfix_Free(...) * diff --git a/modules/audio_coding/codecs/isac/fix/test/kenny.cc b/modules/audio_coding/codecs/isac/fix/test/kenny.cc index c6e54bc4f0..ee5acffbb4 100644 --- a/modules/audio_coding/codecs/isac/fix/test/kenny.cc +++ b/modules/audio_coding/codecs/isac/fix/test/kenny.cc @@ -538,16 +538,8 @@ TEST(IsacFixTest, Kenny) { /* Initialize the ISAC and BN structs */ if (testNum != 8) { - if (1) { - err = WebRtcIsacfix_Create(&ISAC_main_inst); - } else { - /* Test the Assign functions */ - int sss; - void* ppp; - err = WebRtcIsacfix_AssignSize(&sss); - ppp = malloc(sss); - err = WebRtcIsacfix_Assign(&ISAC_main_inst, ppp); - } + err = WebRtcIsacfix_Create(&ISAC_main_inst); + /* Error check */ if (err < 0) { printf("\n\n Error in create.\n\n"); diff --git a/modules/audio_coding/codecs/isac/main/include/isac.h b/modules/audio_coding/codecs/isac/main/include/isac.h index 6cd70a6419..73c38a46d8 100644 --- a/modules/audio_coding/codecs/isac/main/include/isac.h +++ b/modules/audio_coding/codecs/isac/main/include/isac.h @@ -21,42 +21,6 @@ typedef struct WebRtcISACStruct ISACStruct; extern "C" { #endif -/****************************************************************************** - * WebRtcIsac_AssignSize(...) - * - * This function returns the size of the ISAC instance, so that the instance - * can be created outside iSAC. - * - * Input: - * - samplingRate : sampling rate of the input/output audio. - * - * Output: - * - sizeinbytes : number of bytes needed to allocate for the - * instance. - * - * Return value : 0 - Ok - * -1 - Error - */ - -int16_t WebRtcIsac_AssignSize(int* sizeinbytes); - -/****************************************************************************** - * WebRtcIsac_Assign(...) - * - * This function assignes the memory already created to the ISAC instance. - * - * Input: - * - *ISAC_main_inst : a pointer to the coder instance. - * - samplingRate : sampling rate of the input/output audio. - * - ISAC_inst_Addr : the already allocated memory, where we put the - * iSAC structure. - * - * Return value : 0 - Ok - * -1 - Error - */ - -int16_t WebRtcIsac_Assign(ISACStruct** ISAC_main_inst, void* ISAC_inst_Addr); - /****************************************************************************** * WebRtcIsac_Create(...) * diff --git a/modules/audio_coding/codecs/isac/main/source/isac.c b/modules/audio_coding/codecs/isac/main/source/isac.c index 866959691c..720de050b1 100644 --- a/modules/audio_coding/codecs/isac/main/source/isac.c +++ b/modules/audio_coding/codecs/isac/main/source/isac.c @@ -206,62 +206,6 @@ static void GetSendBandwidthInfo(ISACMainStruct* instISAC, } -/**************************************************************************** - * WebRtcIsac_AssignSize(...) - * - * This function returns the size of the ISAC instance, so that the instance - * can be created out side iSAC. - * - * Output: - * - sizeinbytes : number of bytes needed to allocate for the - * instance. - * - * Return value : 0 - Ok - * -1 - Error - */ -int16_t WebRtcIsac_AssignSize(int* sizeInBytes) { - *sizeInBytes = sizeof(ISACMainStruct) * 2 / sizeof(int16_t); - return 0; -} - - -/**************************************************************************** - * WebRtcIsac_Assign(...) - * - * This function assigns the memory already created to the ISAC instance. - * - * Input: - * - ISAC_main_inst : address of the pointer to the coder instance. - * - instISAC_Addr : the already allocated memory, where we put the - * iSAC structure. - * - * Return value : 0 - Ok - * -1 - Error - */ -int16_t WebRtcIsac_Assign(ISACStruct** ISAC_main_inst, - void* instISAC_Addr) { - if (instISAC_Addr != NULL) { - ISACMainStruct* instISAC = (ISACMainStruct*)instISAC_Addr; - instISAC->errorCode = 0; - instISAC->initFlag = 0; - - /* Assign the address. */ - *ISAC_main_inst = (ISACStruct*)instISAC_Addr; - - /* Default is wideband. */ - instISAC->encoderSamplingRateKHz = kIsacWideband; - instISAC->decoderSamplingRateKHz = kIsacWideband; - instISAC->bandwidthKHz = isac8kHz; - instISAC->in_sample_rate_hz = 16000; - - WebRtcIsac_InitTransform(&instISAC->transform_tables); - return 0; - } else { - return -1; - } -} - - /**************************************************************************** * WebRtcIsac_Create(...) * diff --git a/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc b/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc index de97d22a8d..9129df8fb8 100644 --- a/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc +++ b/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc @@ -91,7 +91,6 @@ int main(int argc, char* argv[]) { size_t maxStreamLen60 = 0; short sampFreqKHz = 32; short samplesIn10Ms; - short useAssign = 0; // FILE logFile; bool doTransCoding = false; int32_t rateTransCoding = 0; @@ -186,7 +185,6 @@ int main(int argc, char* argv[]) { /* Loop over all command line arguments */ CodingMode = 0; testNum = 0; - useAssign = 0; // logFile = NULL; char transCodingFileName[500]; int16_t totFileLoop = 0; @@ -210,11 +208,6 @@ int main(int argc, char* argv[]) { strcpy(transCodingFileName, argv[i]); } - /*Should we use assign API*/ - if (!strcmp("-assign", argv[i])) { - useAssign = 1; - } - /* Set Sampling Rate */ if (!strcmp("-FS", argv[i])) { i++; @@ -452,22 +445,10 @@ int main(int argc, char* argv[]) { /* Initialize the ISAC and BN structs */ if (testNum != 8) { - if (!useAssign) { - err = WebRtcIsac_Create(&ISAC_main_inst); - WebRtcIsac_SetEncSampRate(ISAC_main_inst, sampFreqKHz * 1000); - WebRtcIsac_SetDecSampRate(ISAC_main_inst, - sampFreqKHz >= 32 ? 32000 : 16000); - } else { - /* Test the Assign functions */ - int sss; - void* ppp; - err = WebRtcIsac_AssignSize(&sss); - ppp = malloc(sss); - err = WebRtcIsac_Assign(&ISAC_main_inst, ppp); - WebRtcIsac_SetEncSampRate(ISAC_main_inst, sampFreqKHz * 1000); - WebRtcIsac_SetDecSampRate(ISAC_main_inst, - sampFreqKHz >= 32 ? 32000 : 16000); - } + err = WebRtcIsac_Create(&ISAC_main_inst); + WebRtcIsac_SetEncSampRate(ISAC_main_inst, sampFreqKHz * 1000); + WebRtcIsac_SetDecSampRate(ISAC_main_inst, + sampFreqKHz >= 32 ? 32000 : 16000); /* Error check */ if (err < 0) { printf("\n\n Error in create.\n\n"); diff --git a/modules/audio_coding/codecs/isac/main/test/simpleKenny.c b/modules/audio_coding/codecs/isac/main/test/simpleKenny.c index f5d8e4f3a8..116b051ed2 100644 --- a/modules/audio_coding/codecs/isac/main/test/simpleKenny.c +++ b/modules/audio_coding/codecs/isac/main/test/simpleKenny.c @@ -110,9 +110,6 @@ int main(int argc, char* argv[]) { /* handling wrong input arguments in the command line */ if (argc < 5) { - int size; - WebRtcIsac_AssignSize(&size); - printf("\n\nWrong number of arguments or flag values.\n\n"); printf("Usage:\n\n"); @@ -140,7 +137,6 @@ int main(int argc, char* argv[]) { printf("-dec............ the input file is a bit-stream, decode it.\n\n"); printf("Example usage:\n\n"); printf("%s speechIn.pcm speechOut.pcm -B 40000 -fs 32\n\n", argv[0]); - printf("structure size %d bytes\n", size); exit(0); }