This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "AMR-WB decoder".
The branch, master has been updated via 0df8ecfa7ac2ac271f0ceb67bc1f5d1ddafcf3af (commit) via eaae7fce7962d7f77a6b40cc6e79654d8a751be2 (commit) via 276a401628b57729108a3d1b933615f14bae12b9 (commit) via cea139e25cd421a3de4370670ca1b6d8b9e5542f (commit) via 74da10c018a038577644160b873b0a2720e46656 (commit) from 98f6e7534f557e9800395ab0fa6c39bdc4a1f907 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0df8ecfa7ac2ac271f0ceb67bc1f5d1ddafcf3af Author: Marcelo Povoa <marspeoples...@gmail.com> Date: Sat Aug 14 21:05:36 2010 -0300 Modify past pitch_lag decoding to be compliant with the reference code rather than the spec diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 30fc262..d289b70 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -402,7 +402,7 @@ static void decode_pitch_lag_high(int *lag_int, int *lag_frac, int pitch_index, *lag_frac = 0; } /* minimum lag for next subframe */ - *base_lag_int = av_clip(*lag_int - 8, AMRWB_P_DELAY_MIN, + *base_lag_int = av_clip(*lag_int - 8 - (*lag_frac < 0 ? 1 : 0), AMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15); /* XXX: the spec states clearly that *base_lag_int should be * the nearest integer to *lag_int (minus 8), but the ref code @@ -432,7 +432,8 @@ static void decode_pitch_lag_low(int *lag_int, int *lag_frac, int pitch_index, *lag_int = pitch_index - 24; *lag_frac = 0; } - *base_lag_int = av_clip(*lag_int - 8, AMRWB_P_DELAY_MIN, + /* XXX: same problem as before */ + *base_lag_int = av_clip(*lag_int - 8 - (*lag_frac < 0 ? 1 : 0), AMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15); } else { *lag_int = (pitch_index + 1) >> 1; commit eaae7fce7962d7f77a6b40cc6e79654d8a751be2 Author: Marcelo Povoa <marspeoples...@gmail.com> Date: Sat Aug 14 21:02:48 2010 -0300 Scaling and size bugfixes for extrapolate_isf (6K60 only) diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index a0e7457..30fc262 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -1129,7 +1129,7 @@ static void extrapolate_isf(float out[LP_ORDER_16k], float isf[LP_ORDER]) float est, scale; int i, i_max_corr; - memcpy(out, isf, LP_ORDER - 1); + memcpy(out, isf, (LP_ORDER - 1) * sizeof(float)); out[LP_ORDER_16k - 1] = isf[LP_ORDER - 1]; /* Calculate the difference vector */ @@ -1154,8 +1154,8 @@ static void extrapolate_isf(float out[LP_ORDER_16k], float isf[LP_ORDER]) - isf[i - 2 - i_max_corr]; /* Calculate an estimate for ISF(18) and scale ISF based on the error */ - est = 79.65 + (out[2] - out[3] - out[4]) / 6.0; - scale = (FFMIN(est, 76.0) - out[LP_ORDER - 2]) / + est = 7965 + (out[2] - out[3] - out[4]) / 6.0; + scale = 0.5 * (FFMIN(est, 7600) - out[LP_ORDER - 2]) / (out[LP_ORDER_16k - 2] - out[LP_ORDER - 2]); // XXX: should divide numerator by 2.0? @@ -1172,12 +1172,11 @@ static void extrapolate_isf(float out[LP_ORDER_16k], float isf[LP_ORDER]) } for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++) - out[i] = out[i - 1] + diff_hi[i]; + out[i] = out[i - 1] + diff_hi[i] / (float) (1 << 15); - /* XXX: Don't know why this 26214 coefficient, maybe it is not Q8 */ /* Scale the ISF vector for 16000 Hz */ for (i = 0; i < LP_ORDER_16k - 1; i++) - out[i] *= 26214 / (float) (1 << 8); + out[i] *= 0.8; } /** commit 276a401628b57729108a3d1b933615f14bae12b9 Author: Marcelo Povoa <marspeoples...@gmail.com> Date: Sat Aug 14 21:00:03 2010 -0300 Create a slightly modified version of ff_lsp2polyf to use with 16kHz ISPs at the higher band part diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 1cfa13e..a0e7457 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -313,6 +313,26 @@ static void interpolate_isp(double isp_q[4][LP_ORDER], const double *isp4_past) } /** + * 16kHz version of ff_lsp2polyf + */ +static void lsp2polyf_16k(const double *lsp, double *f, int lp_half_order) +{ + int i, j; + + f[0] = 0.25; + f[1] = -0.5 * lsp[0]; + lsp -= 2; + for(i = 2; i <= lp_half_order; i++) + { + double val = -2 * lsp[2 * i]; + f[i] = val * f[i - 1] + 2 * f[i - 2]; + for(j = i - 1; j > 1; j--) + f[j] += f[j - 1] * val + f[j - 2]; + f[1] += 0.25 * val; + } +} + +/** * Convert a ISP vector to LP coefficient domain {a_k} * Equations from TS 26.190 section 5.2.4 * @@ -321,20 +341,23 @@ static void interpolate_isp(double isp_q[4][LP_ORDER], const double *isp4_past) * @param[in] lp_half_order Half the number of LPs to construct */ static void isp2lp(const double *isp, float *lp, int lp_half_order) { - double pa[MAX_LP_HALF_ORDER + 1], qa[MAX_LP_HALF_ORDER + 1]; + double pa[10 + 1], qa[10 + 1]; float *lp2 = lp + (lp_half_order << 1); double last_isp = isp[2 * lp_half_order - 1]; double qa_old = 0.0; int i; - ff_lsp2polyf(isp, pa, lp_half_order); - ff_lsp2polyf(isp + 1, qa, lp_half_order - 1); - if (lp_half_order > 8) { // high-band specific + lsp2polyf_16k(isp, pa, lp_half_order); + lsp2polyf_16k(isp + 1, qa, lp_half_order - 1); + for (i = 0; i <= lp_half_order; i++) pa[i] *= 4.0; for (i = 0; i < lp_half_order; i++) qa[i] *= 4.0; + } else { + ff_lsp2polyf(isp, pa, lp_half_order); + ff_lsp2polyf(isp + 1, qa, lp_half_order - 1); } for (i = 1; i < lp_half_order; i++) { commit cea139e25cd421a3de4370670ca1b6d8b9e5542f Author: Marcelo Povoa <marspeoples...@gmail.com> Date: Sat Aug 14 20:57:13 2010 -0300 Modify isf2isp to work with every ISP length diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 12bf531..1cfa13e 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -175,15 +175,16 @@ static enum Mode unpack_bitstream(AMRWBContext *ctx, const uint8_t *buf, * * @param[in] isf isf vector * @param[out] isp output isp vector + * @param[in] size isf/isp size */ -static void isf2isp(const float *isf, double *isp) +static void isf2isp(const float *isf, double *isp, int size) { int i; - for (i = 0; i < LP_ORDER - 1; i++) + for (i = 0; i < size - 1; i++) isp[i] = cos(2.0 * M_PI * isf[i]); - isp[LP_ORDER - 1] = cos(4.0 * M_PI * isf[LP_ORDER - 1]); + isp[size - 1] = cos(4.0 * M_PI * isf[size - 1]); } /** @@ -1201,7 +1202,7 @@ static void hb_synthesis(AMRWBContext *ctx, int subframe, float *samples, 1.0 - isfp_inter[subframe], LP_ORDER); extrapolate_isf(e_isf, e_isf); - isf2isp(e_isf, e_isp); + isf2isp(e_isf, e_isp, LP_ORDER_16k); isp2lp(e_isp, hb_lpc, LP_ORDER_16k / 2); lpc_weighting(hb_lpc, hb_lpc, 0.9, LP_ORDER_16k + 1); @@ -1309,7 +1310,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, stab_fac = stability_factor(ctx->isf_cur, ctx->isf_past_final); - isf2isp(ctx->isf_cur, ctx->isp[3]); + isf2isp(ctx->isf_cur, ctx->isp[3], LP_ORDER); /* Generate a ISP vector for each subframe */ if (ctx->first_frame) { ctx->first_frame = 0; commit 74da10c018a038577644160b873b0a2720e46656 Author: Marcelo Povoa <marspeoples...@gmail.com> Date: Sat Aug 14 20:53:37 2010 -0300 Fix a major bug at the oversampled data memory update which was compromising output quality diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 228617d..12bf531 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -1373,8 +1373,6 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, synthesis(ctx, ctx->lp_coef[sub], synth_exc, synth_fixed_gain, synth_fixed_vector, &ctx->samples_az[LP_ORDER]); - /* XXX: Tested against the ref code until here, it "succeeds" at least - * for cases in which the "opencore bug" don't interfere */ /* Synthesis speech post-processing */ de_emphasis(&ctx->samples_up[UPS_MEM_SIZE], @@ -1383,17 +1381,14 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, high_pass_filter(&ctx->samples_up[UPS_MEM_SIZE], hpf_31_coef, ctx->hpf_31_mem, &ctx->samples_up[UPS_MEM_SIZE]); - /*for (i = 0; i < AMRWB_SUBFRAME_SIZE; i++) - ctx->samples_up[UPS_MEM_SIZE+i] = rint(ctx->samples_up[UPS_MEM_SIZE+i]);*/ - upsample_5_4(sub_buf, &ctx->samples_up[UPS_FIR_SIZE], AMRWB_SFR_SIZE_OUT); - /* High frequency band generation */ - high_pass_filter(&ctx->samples_up[UPS_MEM_SIZE], hpf_400_coef, - ctx->hpf_400_mem, &ctx->samples_up[UPS_MEM_SIZE]); + /* High frequency band generation part */ + high_pass_filter(hb_samples, hpf_400_coef, ctx->hpf_400_mem, + &ctx->samples_up[UPS_MEM_SIZE]); - hb_gain = find_hb_gain(ctx, &ctx->samples_up[UPS_MEM_SIZE], + hb_gain = find_hb_gain(ctx, hb_samples, cur_subframe->hb_gain, cf->vad); scaled_hb_excitation(ctx, hb_exc, synth_exc, hb_gain); @@ -1412,7 +1407,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, /* Add low frequency and high frequency bands */ for (i = 0; i < AMRWB_SFR_SIZE_OUT; i++) { // XXX: the lower band should really be upscaled by 2.0? - sub_buf[i] = (sub_buf[i] * 2.0 + hb_samples[i]) / 32768.0; + sub_buf[i] = (sub_buf[i] * 1.0 + hb_samples[i]) / 32768.0; } /* Update buffers and history */ ----------------------------------------------------------------------- Summary of changes: libavcodec/amrwbdec.c | 73 +++++++++++++++++++++++++++++++------------------ 1 files changed, 46 insertions(+), 27 deletions(-) hooks/post-receive -- AMR-WB decoder _______________________________________________ FFmpeg-soc mailing list FFmpeg-soc@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc