Commit 31684eb0 authored by jbr's avatar jbr

pass bap table to ff_ac3_bit_alloc_calc_bap()


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13694 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 23fe321f
...@@ -173,7 +173,8 @@ void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, ...@@ -173,7 +173,8 @@ void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
} }
void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
int snr_offset, int floor, uint8_t *bap) int snr_offset, int floor,
const uint8_t *bap_tab, uint8_t *bap)
{ {
int i, j, k, end1, v, address; int i, j, k, end1, v, address;
...@@ -190,7 +191,7 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, ...@@ -190,7 +191,7 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end); end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end);
for (k = i; k < end1; k++) { for (k = i; k < end1; k++) {
address = av_clip((psd[i] - v) >> 5, 0, 63); address = av_clip((psd[i] - v) >> 5, 0, 63);
bap[i] = ff_ac3_bap_tab[address]; bap[i] = bap_tab[address];
i++; i++;
} }
} while (end > band_start_tab[j++]); } while (end > band_start_tab[j++]);
...@@ -215,7 +216,8 @@ void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, ...@@ -215,7 +216,8 @@ void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
dba_mode, dba_nsegs, dba_offsets, dba_lengths, dba_values, dba_mode, dba_nsegs, dba_offsets, dba_lengths, dba_values,
mask); mask);
ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor, bap); ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor,
ff_ac3_bap_tab, bap);
} }
/** /**
......
...@@ -168,10 +168,12 @@ void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, ...@@ -168,10 +168,12 @@ void ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
* @param[in] end ending bin location * @param[in] end ending bin location
* @param[in] snr_offset SNR adjustment * @param[in] snr_offset SNR adjustment
* @param[in] floor noise floor * @param[in] floor noise floor
* @param[in] bap_tab look-up table for bit allocation pointers
* @param[out] bap bit allocation pointers * @param[out] bap bit allocation pointers
*/ */
void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
int snr_offset, int floor, uint8_t *bap); int snr_offset, int floor,
const uint8_t *bap_tab, uint8_t *bap);
void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
int8_t *exp, int start, int end, int8_t *exp, int start, int end,
......
...@@ -1047,7 +1047,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk) ...@@ -1047,7 +1047,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk)
s->start_freq[ch], s->end_freq[ch], s->start_freq[ch], s->end_freq[ch],
s->snr_offset[ch], s->snr_offset[ch],
s->bit_alloc_params.floor, s->bit_alloc_params.floor,
s->bap[ch]); ff_ac3_bap_tab, s->bap[ch]);
} }
} }
......
...@@ -463,7 +463,8 @@ static int bit_alloc(AC3EncodeContext *s, ...@@ -463,7 +463,8 @@ static int bit_alloc(AC3EncodeContext *s,
for(ch=0;ch<s->nb_all_channels;ch++) { for(ch=0;ch<s->nb_all_channels;ch++) {
ff_ac3_bit_alloc_calc_bap(mask[i][ch], psd[i][ch], 0, ff_ac3_bit_alloc_calc_bap(mask[i][ch], psd[i][ch], 0,
s->nb_coefs[ch], snr_offset, s->nb_coefs[ch], snr_offset,
s->bit_alloc.floor, bap[i][ch]); s->bit_alloc.floor, ff_ac3_bap_tab,
bap[i][ch]);
frame_bits += compute_mantissa_size(s, bap[i][ch], frame_bits += compute_mantissa_size(s, bap[i][ch],
s->nb_coefs[ch]); s->nb_coefs[ch]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment