diff options
author | kwiberg@webrtc.org <kwiberg@webrtc.org> | 2014-11-04 13:23:36 +0000 |
---|---|---|
committer | kwiberg@webrtc.org <kwiberg@webrtc.org> | 2014-11-04 13:23:36 +0000 |
commit | 14f28ebb0e988e508784065b4666e6b8ca997321 (patch) | |
tree | 6c75d5e6ac2b85e51f0419180512b62a60b862c6 | |
parent | a1fd19c12e4efdf4b8a5f92323070443d50dc34e (diff) | |
download | webrtc-14f28ebb0e988e508784065b4666e6b8ca997321.tar.gz |
Remove the useless dummy state parameter to WebRtcG711_*
R=henrik.lundin@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/27029004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7609 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r-- | modules/audio_coding/codecs/g711/audio_encoder_pcm.cc | 6 | ||||
-rw-r--r-- | modules/audio_coding/codecs/g711/g711_interface.c | 28 | ||||
-rw-r--r-- | modules/audio_coding/codecs/g711/include/g711_interface.h | 25 | ||||
-rw-r--r-- | modules/audio_coding/codecs/g711/test/testG711.cc | 9 | ||||
-rw-r--r-- | modules/audio_coding/main/acm2/acm_pcma.cc | 2 | ||||
-rw-r--r-- | modules/audio_coding/main/acm2/acm_pcmu.cc | 2 | ||||
-rw-r--r-- | modules/audio_coding/neteq/audio_decoder_impl.cc | 4 | ||||
-rw-r--r-- | modules/audio_coding/neteq/test/RTPencode.cc | 7 |
8 files changed, 22 insertions, 61 deletions
diff --git a/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc b/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc index 097e11f1..6454e93c 100644 --- a/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc +++ b/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc @@ -82,8 +82,7 @@ bool AudioEncoderPcm::Encode(uint32_t timestamp, int16_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, size_t input_len, uint8_t* encoded) { - return WebRtcG711_EncodeA(NULL, - const_cast<int16_t*>(audio), + return WebRtcG711_EncodeA(const_cast<int16_t*>(audio), static_cast<int16_t>(input_len), reinterpret_cast<int16_t*>(encoded)); } @@ -91,8 +90,7 @@ int16_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, int16_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, size_t input_len, uint8_t* encoded) { - return WebRtcG711_EncodeU(NULL, - const_cast<int16_t*>(audio), + return WebRtcG711_EncodeU(const_cast<int16_t*>(audio), static_cast<int16_t>(input_len), reinterpret_cast<int16_t*>(encoded)); } diff --git a/modules/audio_coding/codecs/g711/g711_interface.c b/modules/audio_coding/codecs/g711/g711_interface.c index 134c1e4e..ec726c51 100644 --- a/modules/audio_coding/codecs/g711/g711_interface.c +++ b/modules/audio_coding/codecs/g711/g711_interface.c @@ -12,16 +12,12 @@ #include "g711_interface.h" #include "webrtc/typedefs.h" -int16_t WebRtcG711_EncodeA(void* state, - int16_t* speechIn, +int16_t WebRtcG711_EncodeA(int16_t* speechIn, int16_t len, int16_t* encoded) { int n; uint16_t tempVal, tempVal2; - // Set and discard to avoid getting warnings - (void)(state = NULL); - // Sanity check of input length if (len < 0) { return (-1); @@ -50,16 +46,12 @@ int16_t WebRtcG711_EncodeA(void* state, return (len); } -int16_t WebRtcG711_EncodeU(void* state, - int16_t* speechIn, +int16_t WebRtcG711_EncodeU(int16_t* speechIn, int16_t len, int16_t* encoded) { int n; uint16_t tempVal; - // Set and discard to avoid getting warnings - (void)(state = NULL); - // Sanity check of input length if (len < 0) { return (-1); @@ -86,17 +78,13 @@ int16_t WebRtcG711_EncodeU(void* state, return (len); } -int16_t WebRtcG711_DecodeA(void* state, - int16_t* encoded, +int16_t WebRtcG711_DecodeA(int16_t* encoded, int16_t len, int16_t* decoded, int16_t* speechType) { int n; uint16_t tempVal; - // Set and discard to avoid getting warnings - (void)(state = NULL); - // Sanity check of input length if (len < 0) { return (-1); @@ -123,17 +111,13 @@ int16_t WebRtcG711_DecodeA(void* state, return (len); } -int16_t WebRtcG711_DecodeU(void* state, - int16_t* encoded, +int16_t WebRtcG711_DecodeU(int16_t* encoded, int16_t len, int16_t* decoded, int16_t* speechType) { int n; uint16_t tempVal; - // Set and discard to avoid getting warnings - (void)(state = NULL); - // Sanity check of input length if (len < 0) { return (-1); @@ -160,10 +144,8 @@ int16_t WebRtcG711_DecodeU(void* state, return (len); } -int WebRtcG711_DurationEst(void* state, - const uint8_t* payload, +int WebRtcG711_DurationEst(const uint8_t* payload, int payload_length_bytes) { - (void) state; (void) payload; /* G.711 is one byte per sample, so we can just return the number of bytes. */ return payload_length_bytes; diff --git a/modules/audio_coding/codecs/g711/include/g711_interface.h b/modules/audio_coding/codecs/g711/include/g711_interface.h index 83357e47..545ca3e8 100644 --- a/modules/audio_coding/codecs/g711/include/g711_interface.h +++ b/modules/audio_coding/codecs/g711/include/g711_interface.h @@ -28,8 +28,6 @@ extern "C" { * Input speech length has be of any length. * * Input: - * - state : Dummy state to make this codec look more like - * other codecs * - speechIn : Input speech vector * - len : Samples in speechIn * @@ -40,8 +38,7 @@ extern "C" { * -1 - Error */ -int16_t WebRtcG711_EncodeA(void* state, - int16_t* speechIn, +int16_t WebRtcG711_EncodeA(int16_t* speechIn, int16_t len, int16_t* encoded); @@ -52,8 +49,6 @@ int16_t WebRtcG711_EncodeA(void* state, * Input speech length has be of any length. * * Input: - * - state : Dummy state to make this codec look more like - * other codecs * - speechIn : Input speech vector * - len : Samples in speechIn * @@ -64,8 +59,7 @@ int16_t WebRtcG711_EncodeA(void* state, * -1 - Error */ -int16_t WebRtcG711_EncodeU(void* state, - int16_t* speechIn, +int16_t WebRtcG711_EncodeU(int16_t* speechIn, int16_t len, int16_t* encoded); @@ -75,8 +69,6 @@ int16_t WebRtcG711_EncodeU(void* state, * This function decodes a packet G711 A-law frame. * * Input: - * - state : Dummy state to make this codec look more like - * other codecs * - encoded : Encoded data * - len : Bytes in encoded vector * @@ -90,8 +82,7 @@ int16_t WebRtcG711_EncodeU(void* state, * -1 - Error */ -int16_t WebRtcG711_DecodeA(void* state, - int16_t* encoded, +int16_t WebRtcG711_DecodeA(int16_t* encoded, int16_t len, int16_t* decoded, int16_t* speechType); @@ -102,8 +93,6 @@ int16_t WebRtcG711_DecodeA(void* state, * This function decodes a packet G711 U-law frame. * * Input: - * - state : Dummy state to make this codec look more like - * other codecs * - encoded : Encoded data * - len : Bytes in encoded vector * @@ -117,8 +106,7 @@ int16_t WebRtcG711_DecodeA(void* state, * -1 - Error */ -int16_t WebRtcG711_DecodeU(void* state, - int16_t* encoded, +int16_t WebRtcG711_DecodeU(int16_t* encoded, int16_t len, int16_t* decoded, int16_t* speechType); @@ -129,8 +117,6 @@ int16_t WebRtcG711_DecodeU(void* state, * This function estimates the duration of a G711 packet in samples. * * Input: - * - state : Dummy state to make this codec look more like - * other codecs * - payload : Encoded data * - payloadLengthBytes : Bytes in encoded vector * @@ -139,8 +125,7 @@ int16_t WebRtcG711_DecodeU(void* state, * byte per sample. */ -int WebRtcG711_DurationEst(void* state, - const uint8_t* payload, +int WebRtcG711_DurationEst(const uint8_t* payload, int payload_length_bytes); /********************************************************************** diff --git a/modules/audio_coding/codecs/g711/test/testG711.cc b/modules/audio_coding/codecs/g711/test/testG711.cc index 95a02469..76950fa3 100644 --- a/modules/audio_coding/codecs/g711/test/testG711.cc +++ b/modules/audio_coding/codecs/g711/test/testG711.cc @@ -127,7 +127,7 @@ int main(int argc, char* argv[]) { /* G.711 encoding */ if (!strcmp(law, "A")) { /* A-law encoding */ - stream_len = WebRtcG711_EncodeA(NULL, shortdata, framelength, streamdata); + stream_len = WebRtcG711_EncodeA(shortdata, framelength, streamdata); if (argc == 6) { /* Write bits to file */ if (fwrite(streamdata, sizeof(unsigned char), stream_len, bitp) != @@ -135,11 +135,11 @@ int main(int argc, char* argv[]) { return -1; } } - err = WebRtcG711_DecodeA(NULL, streamdata, stream_len, decoded, + err = WebRtcG711_DecodeA(streamdata, stream_len, decoded, speechType); } else if (!strcmp(law, "u")) { /* u-law encoding */ - stream_len = WebRtcG711_EncodeU(NULL, shortdata, framelength, streamdata); + stream_len = WebRtcG711_EncodeU(shortdata, framelength, streamdata); if (argc == 6) { /* Write bits to file */ if (fwrite(streamdata, sizeof(unsigned char), stream_len, bitp) != @@ -147,8 +147,7 @@ int main(int argc, char* argv[]) { return -1; } } - err = WebRtcG711_DecodeU(NULL, streamdata, stream_len, decoded, - speechType); + err = WebRtcG711_DecodeU(streamdata, stream_len, decoded, speechType); } else { printf("Wrong law mode\n"); exit(1); diff --git a/modules/audio_coding/main/acm2/acm_pcma.cc b/modules/audio_coding/main/acm2/acm_pcma.cc index 548e8fda..41d4d085 100644 --- a/modules/audio_coding/main/acm2/acm_pcma.cc +++ b/modules/audio_coding/main/acm2/acm_pcma.cc @@ -27,7 +27,7 @@ ACMPCMA::~ACMPCMA() { return; } int16_t ACMPCMA::InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte) { *bitstream_len_byte = WebRtcG711_EncodeA( - NULL, &in_audio_[in_audio_ix_read_], frame_len_smpl_ * num_channels_, + &in_audio_[in_audio_ix_read_], frame_len_smpl_ * num_channels_, reinterpret_cast<int16_t*>(bitstream)); // Increment the read index this tell the caller that how far // we have gone forward in reading the audio buffer. diff --git a/modules/audio_coding/main/acm2/acm_pcmu.cc b/modules/audio_coding/main/acm2/acm_pcmu.cc index 5c032363..4f16062f 100644 --- a/modules/audio_coding/main/acm2/acm_pcmu.cc +++ b/modules/audio_coding/main/acm2/acm_pcmu.cc @@ -27,7 +27,7 @@ ACMPCMU::~ACMPCMU() {} int16_t ACMPCMU::InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte) { *bitstream_len_byte = WebRtcG711_EncodeU( - NULL, &in_audio_[in_audio_ix_read_], frame_len_smpl_ * num_channels_, + &in_audio_[in_audio_ix_read_], frame_len_smpl_ * num_channels_, reinterpret_cast<int16_t*>(bitstream)); // Increment the read index this tell the caller that how far diff --git a/modules/audio_coding/neteq/audio_decoder_impl.cc b/modules/audio_coding/neteq/audio_decoder_impl.cc index 0215f36d..c3f2f0b1 100644 --- a/modules/audio_coding/neteq/audio_decoder_impl.cc +++ b/modules/audio_coding/neteq/audio_decoder_impl.cc @@ -45,7 +45,7 @@ int AudioDecoderPcmU::Decode(const uint8_t* encoded, size_t encoded_len, int16_t* decoded, SpeechType* speech_type) { int16_t temp_type = 1; // Default is speech. int16_t ret = WebRtcG711_DecodeU( - state_, reinterpret_cast<int16_t*>(const_cast<uint8_t*>(encoded)), + reinterpret_cast<int16_t*>(const_cast<uint8_t*>(encoded)), static_cast<int16_t>(encoded_len), decoded, &temp_type); *speech_type = ConvertSpeechType(temp_type); return ret; @@ -62,7 +62,7 @@ int AudioDecoderPcmA::Decode(const uint8_t* encoded, size_t encoded_len, int16_t* decoded, SpeechType* speech_type) { int16_t temp_type = 1; // Default is speech. int16_t ret = WebRtcG711_DecodeA( - state_, reinterpret_cast<int16_t*>(const_cast<uint8_t*>(encoded)), + reinterpret_cast<int16_t*>(const_cast<uint8_t*>(encoded)), static_cast<int16_t>(encoded_len), decoded, &temp_type); *speech_type = ConvertSpeechType(temp_type); return ret; diff --git a/modules/audio_coding/neteq/test/RTPencode.cc b/modules/audio_coding/neteq/test/RTPencode.cc index ab338a73..b73e70e5 100644 --- a/modules/audio_coding/neteq/test/RTPencode.cc +++ b/modules/audio_coding/neteq/test/RTPencode.cc @@ -235,9 +235,6 @@ WebRtcVadInst *VAD_inst[2]; #ifdef CODEC_CELT_32 CELT_encinst_t *CELT32enc_inst[2]; #endif -#ifdef CODEC_G711 - void *G711state[2]={NULL, NULL}; -#endif int main(int argc, char* argv[]) @@ -1602,12 +1599,12 @@ int NetEQTest_encode(int coder, int16_t *indata, int frameLen, unsigned char * e /* Encode with the selected coder type */ if (coder==webrtc::kDecoderPCMu) { /*g711 u-law */ #ifdef CODEC_G711 - cdlen = WebRtcG711_EncodeU(G711state[k], indata, frameLen, (int16_t*) encoded); + cdlen = WebRtcG711_EncodeU(indata, frameLen, (int16_t*) encoded); #endif } else if (coder==webrtc::kDecoderPCMa) { /*g711 A-law */ #ifdef CODEC_G711 - cdlen = WebRtcG711_EncodeA(G711state[k], indata, frameLen, (int16_t*) encoded); + cdlen = WebRtcG711_EncodeA(indata, frameLen, (int16_t*) encoded); } #endif #ifdef CODEC_PCM16B |