Unverified Commit 50e5b78b authored by Lynne's avatar Lynne

aac: expose ff_aac_sample_rate_idx() in aac.h

The rate index is a value important to both encoders and decoders.
USAC needs it as well, so put it into the shared main header.
parent 1c3545f0
...@@ -103,4 +103,20 @@ typedef struct Pulse { ...@@ -103,4 +103,20 @@ typedef struct Pulse {
int amp[4]; int amp[4];
} Pulse; } Pulse;
static inline int ff_aac_sample_rate_idx(int rate)
{
if (92017 <= rate) return 0;
else if (75132 <= rate) return 1;
else if (55426 <= rate) return 2;
else if (46009 <= rate) return 3;
else if (37566 <= rate) return 4;
else if (27713 <= rate) return 5;
else if (23004 <= rate) return 6;
else if (18783 <= rate) return 7;
else if (13856 <= rate) return 8;
else if (11502 <= rate) return 9;
else if (9391 <= rate) return 10;
else return 11;
}
#endif /* AVCODEC_AAC_H */ #endif /* AVCODEC_AAC_H */
...@@ -1095,22 +1095,6 @@ static int decode_audio_specific_config(AACDecContext *ac, ...@@ -1095,22 +1095,6 @@ static int decode_audio_specific_config(AACDecContext *ac,
sync_extension); sync_extension);
} }
static int sample_rate_idx (int rate)
{
if (92017 <= rate) return 0;
else if (75132 <= rate) return 1;
else if (55426 <= rate) return 2;
else if (46009 <= rate) return 3;
else if (37566 <= rate) return 4;
else if (27713 <= rate) return 5;
else if (23004 <= rate) return 6;
else if (18783 <= rate) return 7;
else if (13856 <= rate) return 8;
else if (11502 <= rate) return 9;
else if (9391 <= rate) return 10;
else return 11;
}
static av_cold int decode_close(AVCodecContext *avctx) static av_cold int decode_close(AVCodecContext *avctx)
{ {
AACDecContext *ac = avctx->priv_data; AACDecContext *ac = avctx->priv_data;
...@@ -1211,7 +1195,7 @@ av_cold int ff_aac_decode_init(AVCodecContext *avctx) ...@@ -1211,7 +1195,7 @@ av_cold int ff_aac_decode_init(AVCodecContext *avctx)
uint8_t layout_map[MAX_ELEM_ID*4][3]; uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags; int layout_map_tags;
sr = sample_rate_idx(avctx->sample_rate); sr = ff_aac_sample_rate_idx(avctx->sample_rate);
ac->oc[1].m4ac.sampling_index = sr; ac->oc[1].m4ac.sampling_index = sr;
ac->oc[1].m4ac.channels = avctx->ch_layout.nb_channels; ac->oc[1].m4ac.channels = avctx->ch_layout.nb_channels;
ac->oc[1].m4ac.sbr = -1; ac->oc[1].m4ac.sbr = -1;
......
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