| 1173 | } |
| 1174 | |
| 1175 | static av_cold int init_dsp(AVCodecContext *avctx) |
| 1176 | { |
| 1177 | AACDecContext *ac = avctx->priv_data; |
| 1178 | int is_fixed = ac->is_fixed, ret; |
| 1179 | float scale_fixed, scale_float; |
| 1180 | const float *const scalep = is_fixed ? &scale_fixed : &scale_float; |
| 1181 | enum AVTXType tx_type = is_fixed ? AV_TX_INT32_MDCT : AV_TX_FLOAT_MDCT; |
| 1182 | |
| 1183 | #define MDCT_INIT(s, fn, len, sval) \ |
| 1184 | scale_fixed = (sval) * 128.0f; \ |
| 1185 | scale_float = (sval) / 32768.0f; \ |
| 1186 | ret = av_tx_init(&s, &fn, tx_type, 1, len, scalep, 0); \ |
| 1187 | if (ret < 0) \ |
| 1188 | return ret |
| 1189 | |
| 1190 | MDCT_INIT(ac->mdct96, ac->mdct96_fn, 96, 1.0/96); |
| 1191 | MDCT_INIT(ac->mdct120, ac->mdct120_fn, 120, 1.0/120); |
| 1192 | MDCT_INIT(ac->mdct128, ac->mdct128_fn, 128, 1.0/128); |
| 1193 | MDCT_INIT(ac->mdct480, ac->mdct480_fn, 480, 1.0/480); |
| 1194 | MDCT_INIT(ac->mdct512, ac->mdct512_fn, 512, 1.0/512); |
| 1195 | MDCT_INIT(ac->mdct768, ac->mdct768_fn, 768, 1.0/768); |
| 1196 | MDCT_INIT(ac->mdct960, ac->mdct960_fn, 960, 1.0/960); |
| 1197 | MDCT_INIT(ac->mdct1024, ac->mdct1024_fn, 1024, 1.0/1024); |
| 1198 | #undef MDCT_INIT |
| 1199 | |
| 1200 | /* LTP forward MDCT */ |
| 1201 | scale_fixed = -1.0; |
| 1202 | scale_float = -32786.0*2 + 36; |
| 1203 | ret = av_tx_init(&ac->mdct_ltp, &ac->mdct_ltp_fn, tx_type, 0, 1024, scalep, 0); |
| 1204 | if (ret < 0) |
| 1205 | return ret; |
| 1206 | |
| 1207 | return 0; |
| 1208 | } |
| 1209 | |
| 1210 | av_cold int ff_aac_decode_init(AVCodecContext *avctx) |
| 1211 | { |
no test coverage detected