[soc]: r4852 - in amr: amrnbdata.h amrnbdec.c
Author: cmcq Date: Fri Jul 31 03:47:27 2009 New Revision: 4852 Log: Adjust the quantized LSFs to comply with ref decoder Modified: amr/amrnbdata.h amr/amrnbdec.c Modified: amr/amrnbdata.h ============================================================================== --- amr/amrnbdata.h Fri Jul 31 03:45:05 2009 (r4851) +++ amr/amrnbdata.h Fri Jul 31 03:47:27 2009 (r4852) @@ -2038,6 +2038,7 @@ static const float pred_fac[LP_FILTER_OR #define PRED_FAC_MODE_122 0.65 #define FREQ_LSP_FAC 2.0*M_PI/8000.0 #define FREQ_LSF 1/8000.0 +#define MIN_LSF_SPACING 50.0488 // pitch tables Modified: amr/amrnbdec.c ============================================================================== --- amr/amrnbdec.c Fri Jul 31 03:45:05 2009 (r4851) +++ amr/amrnbdec.c Fri Jul 31 03:47:27 2009 (r4852) @@ -203,6 +203,20 @@ static void interpolate_lsf(float lsf_q[ } /** + * Adjust the quantized LSFs so they are increasing and not too close. + * + * This step isn't mentioned in the spec but is in the reference C decoder. + * Omitting this step creates audible distortion on the sinusoidal sweep + * test vectors in 3GPP TS 26.074. + */ +void adjust_lsfs(float *m) { + int i; + float tmp=0.0; + for (i = 0; i < LP_FILTER_ORDER; i++) + tmp = m[i] = FFMAX(m[i], tmp + MIN_LSF_SPACING); +} + +/** * Decode a set of 5 split-matrix quantized lsf indexes into an lsp vector. * * @param p the context @@ -237,6 +251,8 @@ static void lsf2lsp_for_mode122(AMRConte for (i = 0; i < LP_FILTER_ORDER; i++) lsf[i] += prev_lsf[i]; + adjust_lsfs(lsf); + // store LSF vector for fixed gain smoothing if (update_prev_lsf_r) interpolate_lsf(p->lsf_q, lsf); @@ -299,6 +315,8 @@ static void lsf2lsp_3(AMRContext *p) for (i = 0; i < LP_FILTER_ORDER; i++) lsf_q[i] = lsf_r[i] + p->prev_lsf_r[i] * pred_fac[i] + lsf_3_mean[i]; + adjust_lsfs(lsf_q); + // store LSF vector for fixed gain smoothing interpolate_lsf(p->lsf_q, lsf_q);
On Fri, Jul 31, 2009 at 03:47:28AM +0200, cmcq wrote:
--- amr/amrnbdec.c Fri Jul 31 03:45:05 2009 (r4851) +++ amr/amrnbdec.c Fri Jul 31 03:47:27 2009 (r4852) @@ -203,6 +203,20 @@ static void interpolate_lsf(float lsf_q[
+void adjust_lsfs(float *m) {
Use K&R style please. This function should be static if it is not used outside amrnbdec.c. Diego
2009/7/31 Diego Biurrun <diego@biurrun.de>:
On Fri, Jul 31, 2009 at 03:47:28AM +0200, cmcq wrote:
--- amr/amrnbdec.c Fri Jul 31 03:45:05 2009 (r4851) +++ amr/amrnbdec.c Fri Jul 31 03:47:27 2009 (r4852) @@ -203,6 +203,20 @@ static void interpolate_lsf(float lsf_q[
+void adjust_lsfs(float *m) {
Use K&R style please.
This function should be static if it is not used outside amrnbdec.c.
Done.
participants (3)
-
cmcq -
Colin McQuillan -
Diego Biurrun