ilbc: Make the decode input array const
Review URL: https://webrtc-codereview.appspot.com/667009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2518 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
void WebRtcIlbcfix_DecodeImpl(
|
void WebRtcIlbcfix_DecodeImpl(
|
||||||
WebRtc_Word16 *decblock, /* (o) decoded signal block */
|
WebRtc_Word16 *decblock, /* (o) decoded signal block */
|
||||||
WebRtc_UWord16 *bytes, /* (i) encoded signal bits */
|
const WebRtc_UWord16 *bytes, /* (i) encoded signal bits */
|
||||||
iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state
|
iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state
|
||||||
structure */
|
structure */
|
||||||
WebRtc_Word16 mode /* (i) 0: bad packet, PLC,
|
WebRtc_Word16 mode /* (i) 0: bad packet, PLC,
|
||||||
@@ -54,6 +54,9 @@ void WebRtcIlbcfix_DecodeImpl(
|
|||||||
WebRtc_Word16 PLCresidual[BLOCKL_MAX + LPC_FILTERORDER];
|
WebRtc_Word16 PLCresidual[BLOCKL_MAX + LPC_FILTERORDER];
|
||||||
WebRtc_Word16 syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)];
|
WebRtc_Word16 syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)];
|
||||||
WebRtc_Word16 PLClpc[LPC_FILTERORDER + 1];
|
WebRtc_Word16 PLClpc[LPC_FILTERORDER + 1];
|
||||||
|
#ifndef WEBRTC_BIG_ENDIAN
|
||||||
|
WebRtc_UWord16 swapped[NO_OF_WORDS_30MS];
|
||||||
|
#endif
|
||||||
iLBC_bits *iLBCbits_inst = (iLBC_bits*)PLCresidual;
|
iLBC_bits *iLBCbits_inst = (iLBC_bits*)PLCresidual;
|
||||||
|
|
||||||
/* Reuse some buffers that are non overlapping in order to save stack memory */
|
/* Reuse some buffers that are non overlapping in order to save stack memory */
|
||||||
@@ -63,17 +66,13 @@ void WebRtcIlbcfix_DecodeImpl(
|
|||||||
|
|
||||||
/* decode data */
|
/* decode data */
|
||||||
|
|
||||||
#ifndef WEBRTC_BIG_ENDIAN
|
|
||||||
WebRtcIlbcfix_SwapBytes((WebRtc_UWord16*)bytes, iLBCdec_inst->no_of_words);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Unpacketize bits into parameters */
|
/* Unpacketize bits into parameters */
|
||||||
|
|
||||||
last_bit = WebRtcIlbcfix_UnpackBits(bytes, iLBCbits_inst, iLBCdec_inst->mode);
|
|
||||||
|
|
||||||
#ifndef WEBRTC_BIG_ENDIAN
|
#ifndef WEBRTC_BIG_ENDIAN
|
||||||
/* Swap back so that the the input vector "bytes" is unchanged */
|
WebRtcIlbcfix_SwapBytes(bytes, iLBCdec_inst->no_of_words, swapped);
|
||||||
WebRtcIlbcfix_SwapBytes((WebRtc_UWord16*)bytes, iLBCdec_inst->no_of_words);
|
last_bit = WebRtcIlbcfix_UnpackBits(swapped, iLBCbits_inst, iLBCdec_inst->mode);
|
||||||
|
#else
|
||||||
|
last_bit = WebRtcIlbcfix_UnpackBits(bytes, iLBCbits_inst, iLBCdec_inst->mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check for bit errors */
|
/* Check for bit errors */
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
void WebRtcIlbcfix_DecodeImpl(
|
void WebRtcIlbcfix_DecodeImpl(
|
||||||
WebRtc_Word16 *decblock, /* (o) decoded signal block */
|
WebRtc_Word16 *decblock, /* (o) decoded signal block */
|
||||||
WebRtc_UWord16 *bytes, /* (i) encoded signal bits */
|
const WebRtc_UWord16 *bytes, /* (i) encoded signal bits */
|
||||||
iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state
|
iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state
|
||||||
structure */
|
structure */
|
||||||
WebRtc_Word16 mode /* (i) 0: bad packet, PLC,
|
WebRtc_Word16 mode /* (i) 0: bad packet, PLC,
|
||||||
|
@@ -495,10 +495,10 @@ void WebRtcIlbcfix_EncodeImpl(
|
|||||||
#ifdef SPLIT_10MS
|
#ifdef SPLIT_10MS
|
||||||
if (( (iLBCenc_inst->section == 1) && (iLBCenc_inst->mode == 20) ) ||
|
if (( (iLBCenc_inst->section == 1) && (iLBCenc_inst->mode == 20) ) ||
|
||||||
( (iLBCenc_inst->section == 2) && (iLBCenc_inst->mode == 30) )){
|
( (iLBCenc_inst->section == 2) && (iLBCenc_inst->mode == 30) )){
|
||||||
WebRtcIlbcfix_SwapBytes(bytes, iLBCenc_inst->no_of_words);
|
WebRtcIlbcfix_SwapBytes(bytes, iLBCenc_inst->no_of_words, bytes);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
WebRtcIlbcfix_SwapBytes(bytes, iLBCenc_inst->no_of_words);
|
WebRtcIlbcfix_SwapBytes(bytes, iLBCenc_inst->no_of_words, bytes);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -134,7 +134,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decoderinit30Ms(iLBC_decinst_t *iLBCdec_inst) {
|
|||||||
|
|
||||||
|
|
||||||
WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
|
WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
|
||||||
WebRtc_Word16 *encoded,
|
const WebRtc_Word16 *encoded,
|
||||||
WebRtc_Word16 len,
|
WebRtc_Word16 len,
|
||||||
WebRtc_Word16 *decoded,
|
WebRtc_Word16 *decoded,
|
||||||
WebRtc_Word16 *speechType)
|
WebRtc_Word16 *speechType)
|
||||||
@@ -170,7 +170,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
|
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
|
||||||
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
|
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
/* iLBC does not support VAD/CNG yet */
|
/* iLBC does not support VAD/CNG yet */
|
||||||
@@ -179,7 +179,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
|
WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
|
||||||
WebRtc_Word16 *encoded,
|
const WebRtc_Word16 *encoded,
|
||||||
WebRtc_Word16 len,
|
WebRtc_Word16 len,
|
||||||
WebRtc_Word16 *decoded,
|
WebRtc_Word16 *decoded,
|
||||||
WebRtc_Word16 *speechType)
|
WebRtc_Word16 *speechType)
|
||||||
@@ -194,7 +194,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
|
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
|
||||||
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
|
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
/* iLBC does not support VAD/CNG yet */
|
/* iLBC does not support VAD/CNG yet */
|
||||||
@@ -203,7 +203,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
|
WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
|
||||||
WebRtc_Word16 *encoded,
|
const WebRtc_Word16 *encoded,
|
||||||
WebRtc_Word16 len,
|
WebRtc_Word16 len,
|
||||||
WebRtc_Word16 *decoded,
|
WebRtc_Word16 *decoded,
|
||||||
WebRtc_Word16 *speechType)
|
WebRtc_Word16 *speechType)
|
||||||
@@ -218,7 +218,7 @@ WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
|
while ((i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_bytes)<len) {
|
||||||
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
|
WebRtcIlbcfix_DecodeImpl(&decoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->blockl], (const WebRtc_UWord16*) &encoded[i*((iLBC_Dec_Inst_t*)iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t*) iLBCdec_inst, 1);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
/* iLBC does not support VAD/CNG yet */
|
/* iLBC does not support VAD/CNG yet */
|
||||||
|
@@ -182,20 +182,20 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
|
WebRtc_Word16 WebRtcIlbcfix_Decode(iLBC_decinst_t *iLBCdec_inst,
|
||||||
WebRtc_Word16* encoded,
|
const WebRtc_Word16* encoded,
|
||||||
WebRtc_Word16 len,
|
WebRtc_Word16 len,
|
||||||
WebRtc_Word16 *decoded,
|
WebRtc_Word16 *decoded,
|
||||||
WebRtc_Word16 *speechType);
|
WebRtc_Word16 *speechType);
|
||||||
WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
|
WebRtc_Word16 WebRtcIlbcfix_Decode20Ms(iLBC_decinst_t *iLBCdec_inst,
|
||||||
WebRtc_Word16 *encoded,
|
const WebRtc_Word16 *encoded,
|
||||||
WebRtc_Word16 len,
|
WebRtc_Word16 len,
|
||||||
WebRtc_Word16 *decoded,
|
WebRtc_Word16 *decoded,
|
||||||
WebRtc_Word16 *speechType);
|
WebRtc_Word16 *speechType);
|
||||||
WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
|
WebRtc_Word16 WebRtcIlbcfix_Decode30Ms(iLBC_decinst_t *iLBCdec_inst,
|
||||||
WebRtc_Word16 *encoded,
|
const WebRtc_Word16 *encoded,
|
||||||
WebRtc_Word16 len,
|
WebRtc_Word16 len,
|
||||||
WebRtc_Word16 *decoded,
|
WebRtc_Word16 *decoded,
|
||||||
WebRtc_Word16 *speechType);
|
WebRtc_Word16 *speechType);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* WebRtcIlbcfix_DecodePlc(...)
|
* WebRtcIlbcfix_DecodePlc(...)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@@ -23,14 +23,13 @@
|
|||||||
*---------------------------------------------------------------*/
|
*---------------------------------------------------------------*/
|
||||||
|
|
||||||
void WebRtcIlbcfix_SwapBytes(
|
void WebRtcIlbcfix_SwapBytes(
|
||||||
WebRtc_UWord16 *sequence, /* (i/o) the sequence to swap */
|
const WebRtc_UWord16* input, /* (i) the sequence to swap */
|
||||||
WebRtc_Word16 wordLength /* (i) number or WebRtc_UWord16 to swap */
|
WebRtc_Word16 wordLength, /* (i) number or WebRtc_UWord16 to swap */
|
||||||
|
WebRtc_UWord16* output /* (o) the swapped sequence */
|
||||||
) {
|
) {
|
||||||
int k;
|
int k;
|
||||||
WebRtc_UWord16 temp=0;
|
for (k = wordLength; k > 0; k--) {
|
||||||
for( k=wordLength; k>0; k-- ) {
|
*output++ = (*input >> 8)|(*input << 8);
|
||||||
temp = (*sequence >> 8)|(*sequence << 8);
|
input++;
|
||||||
*sequence++ = temp;
|
|
||||||
//*sequence++ = (*sequence >> 8) | (*sequence << 8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@@ -26,8 +26,9 @@
|
|||||||
*---------------------------------------------------------------*/
|
*---------------------------------------------------------------*/
|
||||||
|
|
||||||
void WebRtcIlbcfix_SwapBytes(
|
void WebRtcIlbcfix_SwapBytes(
|
||||||
WebRtc_UWord16 *sequence, /* (i/o) the sequence to swap */
|
const WebRtc_UWord16* input, /* (i) the sequence to swap */
|
||||||
WebRtc_Word16 wordLength /* (i) number or WebRtc_UWord16 to swap */
|
WebRtc_Word16 wordLength, /* (i) number or WebRtc_UWord16 to swap */
|
||||||
|
WebRtc_UWord16* output /* (o) the swapped sequence */
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
*---------------------------------------------------------------*/
|
*---------------------------------------------------------------*/
|
||||||
|
|
||||||
WebRtc_Word16 WebRtcIlbcfix_UnpackBits( /* (o) "Empty" frame indicator */
|
WebRtc_Word16 WebRtcIlbcfix_UnpackBits( /* (o) "Empty" frame indicator */
|
||||||
WebRtc_UWord16 *bitstream, /* (i) The packatized bitstream */
|
const WebRtc_UWord16 *bitstream, /* (i) The packatized bitstream */
|
||||||
iLBC_bits *enc_bits, /* (o) Paramerers from bitstream */
|
iLBC_bits *enc_bits, /* (o) Paramerers from bitstream */
|
||||||
WebRtc_Word16 mode /* (i) Codec mode (20 or 30) */
|
WebRtc_Word16 mode /* (i) Codec mode (20 or 30) */
|
||||||
) {
|
) {
|
||||||
WebRtc_UWord16 *bitstreamPtr;
|
const WebRtc_UWord16 *bitstreamPtr;
|
||||||
int i, k;
|
int i, k;
|
||||||
WebRtc_Word16 *tmpPtr;
|
WebRtc_Word16 *tmpPtr;
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
*---------------------------------------------------------------*/
|
*---------------------------------------------------------------*/
|
||||||
|
|
||||||
WebRtc_Word16 WebRtcIlbcfix_UnpackBits( /* (o) "Empty" frame indicator */
|
WebRtc_Word16 WebRtcIlbcfix_UnpackBits( /* (o) "Empty" frame indicator */
|
||||||
WebRtc_UWord16 *bitstream, /* (i) The packatized bitstream */
|
const WebRtc_UWord16 *bitstream, /* (i) The packatized bitstream */
|
||||||
iLBC_bits *enc_bits, /* (o) Paramerers from bitstream */
|
iLBC_bits *enc_bits, /* (o) Paramerers from bitstream */
|
||||||
WebRtc_Word16 mode /* (i) Codec mode (20 or 30) */
|
WebRtc_Word16 mode /* (i) Codec mode (20 or 30) */
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user