Commit ec5651bc authored by François Grisez's avatar François Grisez

Add a define controling whether a rescaling of the signal should be done...

Add a define controling whether a rescaling of the signal should be done before entering in the G722 decoder

The new define is a private define and is called ENABLE_PCM_RESCALING. Its value can be 0 or 1.
By default, the PCM rescaling is disabled
parent 8d34232d
......@@ -35,6 +35,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "g722.h"
#endif
#define ENABLE_PCM_RESCALING 0
struct EncState {
g722_encode_state_t *state;
uint32_t ts;
......@@ -62,12 +64,15 @@ static void enc_uninit(MSFilter *f)
};
static void scale_down(int16_t *samples, int count){
#if ENABLE_PCM_RESCALING
int i;
for (i=0;i<count;++i)
samples[i]=samples[i]>>1;
#endif
}
static void scale_up(int16_t *samples, int count){
#if ENABLE_PCM_RESCALING
int i;
for (i=0;i<count;++i) {
if (samples[i]>INT16_MAX/2) {
......@@ -78,6 +83,7 @@ static void scale_up(int16_t *samples, int count){
samples[i]=samples[i]<<1;
}
}
#endif
}
static void enc_process(MSFilter *f)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment