[FFmpeg-soc] [soc]: r4942 - in amr: amrnbdata.h amrnbdec.c
cmcq
subversion at mplayerhq.hu
Wed Aug 5 14:03:39 CEST 2009
Author: cmcq
Date: Wed Aug 5 14:03:39 2009
New Revision: 4942
Log:
Include upscaling factor in AMR_SAMPLE_SCALE
This should be more physically meaningful so easier to understand. Upscaling
is only useful for fixed-point so not pertinent to a floating-point decoder.
Modified:
amr/amrnbdata.h
amr/amrnbdec.c
Modified: amr/amrnbdata.h
==============================================================================
--- amr/amrnbdata.h Wed Aug 5 00:53:53 2009 (r4941)
+++ amr/amrnbdata.h Wed Aug 5 14:03:39 2009 (r4942)
@@ -37,7 +37,17 @@
#define AMR_BLOCK_SIZE 160 ///< Samples per frame
#define AMR_SUBFRAME_SIZE 40 ///< Samples per subframe
#define AMR_SAMPLE_BOUND 32768.0 ///< Threshold for synthesis overflow
-#define AMR_SAMPLE_SCALE (1.0/32768.0) ///< AMR is designed to produce 16-bit PCM samples (3GPP TS 26.090 4.2)
+
+/**
+ * Scale from constructed speech to [-1,1]
+ *
+ * AMR is designed to produce 16-bit PCM samples (3GPP TS 26.090 4.2) but
+ * upscales by two (section 6.2.2).
+ *
+ * Fundamentally, this scale is determined by energy_mean through
+ * the fixed vector contribution to the excitation vector.
+ */
+#define AMR_SAMPLE_SCALE (2.0/32768.0)
/** Frame type (Table 1a in 3GPP TS 26.101) */
Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c Wed Aug 5 00:53:53 2009 (r4941)
+++ amr/amrnbdec.c Wed Aug 5 14:03:39 2009 (r4942)
@@ -1158,10 +1158,8 @@ static int amrnb_decode_frame(AVCodecCon
ff_acelp_high_pass_filterf(buf_out, p->high_pass_mem, AMR_BLOCK_SIZE);
for (i = 0; i < AMR_BLOCK_SIZE; i++)
- // Post-processing up-scales by 2. It's convenient to
- // scale from PCM values to [-1,1) here too.
// FIXME: merge with qcelpdec.c
- buf_out[i] = av_clipf(buf_out[i] * 2.0 * AMR_SAMPLE_SCALE,
+ buf_out[i] = av_clipf(buf_out[i] * AMR_SAMPLE_SCALE,
-1.0, 32767.0 / 32768.0);
/* Update averaged lsf vector (used for fixed gain smoothing).
More information about the FFmpeg-soc
mailing list