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@7609 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
index 097e11f..6454e93 100644
--- a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
+++ b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
@@ -82,8 +82,7 @@
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 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/webrtc/modules/audio_coding/codecs/g711/g711_interface.c b/webrtc/modules/audio_coding/codecs/g711/g711_interface.c
index 134c1e4..ec726c5 100644
--- a/webrtc/modules/audio_coding/codecs/g711/g711_interface.c
+++ b/webrtc/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 @@
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 @@
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 @@
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 @@
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/webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h b/webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h
index 83357e4..545ca3e 100644
--- a/webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h
+++ b/webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h
@@ -28,8 +28,6 @@
* 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 @@
* -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 @@
* 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 @@
* -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 @@
* 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 @@
* -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 @@
* 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 @@
* -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 @@
* 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 @@
* 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/webrtc/modules/audio_coding/codecs/g711/test/testG711.cc b/webrtc/modules/audio_coding/codecs/g711/test/testG711.cc
index 95a0246..76950fa 100644
--- a/webrtc/modules/audio_coding/codecs/g711/test/testG711.cc
+++ b/webrtc/modules/audio_coding/codecs/g711/test/testG711.cc
@@ -127,7 +127,7 @@
/* 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 @@
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 @@
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/webrtc/modules/audio_coding/main/acm2/acm_pcma.cc b/webrtc/modules/audio_coding/main/acm2/acm_pcma.cc
index 548e8fd..41d4d08 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_pcma.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_pcma.cc
@@ -27,7 +27,7 @@
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/webrtc/modules/audio_coding/main/acm2/acm_pcmu.cc b/webrtc/modules/audio_coding/main/acm2/acm_pcmu.cc
index 5c03236..4f16062 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_pcmu.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_pcmu.cc
@@ -27,7 +27,7 @@
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/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
index 0215f36..c3f2f0b 100644
--- a/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
@@ -45,7 +45,7 @@
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 @@
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/webrtc/modules/audio_coding/neteq/test/RTPencode.cc b/webrtc/modules/audio_coding/neteq/test/RTPencode.cc
index ab338a7..b73e70e 100644
--- a/webrtc/modules/audio_coding/neteq/test/RTPencode.cc
+++ b/webrtc/modules/audio_coding/neteq/test/RTPencode.cc
@@ -235,9 +235,6 @@
#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 @@
/* 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