Commit 6ceb51f0 authored by François Grisez's avatar François Grisez

G722: rescale PCM samples to 14-bit before encoding and do invers after decoding

parent 7053d54e
......@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "g722.h"
#endif
#define ENABLE_PCM_RESCALING 0
#define ENABLE_PCM_RESCALING 1
struct EncState {
g722_encode_state_t *state;
......@@ -67,7 +67,7 @@ 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;
samples[i]=samples[i]>>2;
#endif
}
......@@ -75,12 +75,12 @@ 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) {
if (samples[i]>INT16_MAX/4) {
samples[i] = INT16_MAX;
} else if (samples[i]<INT16_MIN/2) {
} else if (samples[i]<INT16_MIN/4) {
samples[i] = INT16_MIN;
} else {
samples[i]=samples[i]<<1;
samples[i]=samples[i]<<2;
}
}
#endif
......
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