[FFmpeg-devel] AMR-NB decoder
Diego Biurrun
diego
Thu Aug 6 12:30:18 CEST 2009
On Wed, Aug 05, 2009 at 05:51:36PM +0100, Colin McQuillan wrote:
> Attached is a patch for an AMR-NB decoder.
Build system and documentation part OK.
> --- libavcodec/amrnbdata.h (revision 0)
> +++ libavcodec/amrnbdata.h (revision 0)
A lot of stuff could be aligned for better readability here..
> --- libavcodec/amrnbdec.c (revision 0)
> +++ libavcodec/amrnbdec.c (revision 0)
> @@ -0,0 +1,1157 @@
> +
> + const float *gains =
> + mode >= MODE_67 ? gains_high[amr_subframe->p_gain] :
> + mode >= MODE_515 ? gains_low [amr_subframe->p_gain] :
> + // gain index is only coded in subframes 0,2 for MODE_475
> + gains_MODE_475[(p->frame.info.subframe[subframe & 2].p_gain
> + << 1) +
> + (subframe & 1)];
This sure looks ugly..
> + p->pitch_gain[4] = gains[0];
> + *fixed_gain_factor = gains[1];
align
> + // Eqn 67: gc' = 10^0.05 (predicted dB + mean dB - dB of fixed vector)
> + exp2f(log2f(10.0) * 0.05
> + * (ff_dot_productf(energy_pred_fac,
> + p->prediction_error,
> + 4) + // predicted fixed energy
> + energy_mean[mode])) /
also looks weird
> + const float **filters = p->cur_frame_mode == MODE_795 ?
> + ir_filters_lookup_MODE_795 : ir_filters_lookup;
> + float pitch_factor = (p->cur_frame_mode == MODE_122 ? 0.25 : 0.5)
> + * FFMIN(p->pitch_gain[4],
> + p->cur_frame_mode == MODE_122 ? 1.0 : SHARP_MAX)
> + * p->pitch_gain[4];
ditto
Diego
More information about the ffmpeg-devel
mailing list