+/* AC3 bit allocation. The algorithm is the one described in the AC3
+ spec. */
+void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
+ int8_t *exp, int start, int end,
+ int snroffset, int fgain, int is_lfe,
+ int deltbae,int deltnseg,
+ uint8_t *deltoffst, uint8_t *deltlen,
+ uint8_t *deltba)
+{
+ int16_t psd[256]; /* scaled exponents */
+ int16_t bndpsd[50]; /* interpolated exponents */
+ int16_t mask[50]; /* masking value */
+
+ ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, bndpsd);
+
+ ff_ac3_bit_alloc_calc_mask(s, bndpsd, start, end, fgain, is_lfe,
+ deltbae, deltnseg, deltoffst, deltlen, deltba,
+ mask);
+
+ ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snroffset, s->floor, bap);
+}
+