The fixed decoder derives the values from floats anyway.
Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -79,56 +79,6 @@ · 78 unmodified lines | ||
| 79 | 79 | #include <math.h> |
| 80 | 80 | #include <string.h> |
| 81 | 81 | |
| 82 | −DECLARE_ALIGNED(32, int, AAC_RENAME2(aac_kbd_long_1024))[1024]; | |
| 83 | −DECLARE_ALIGNED(32, int, AAC_RENAME2(aac_kbd_short_128))[128]; | |
| 84 | −DECLARE_ALIGNED(32, int, AAC_RENAME2(aac_kbd_long_960))[960]; | |
| 85 | −DECLARE_ALIGNED(32, int, AAC_RENAME2(aac_kbd_short_120))[120]; | |
| 86 | − | |
| 87 | −/* @name ltp_coef | |
| 88 | − * Table of the LTP coefficients | |
| 89 | − */ | |
| 90 | −static const int ltp_coef_fixed[8] = { | |
| 91 | − Q30(0.570829), Q30(0.696616), Q30(0.813004), Q30(0.911304), | |
| 92 | − Q30(0.984900), Q30(1.067894), Q30(1.194601), Q30(1.369533), | |
| 93 | −}; | |
| 94 | − | |
| 95 | −/* @name tns_tmp2_map | |
| 96 | − * Tables of the tmp2[] arrays of LPC coefficients used for TNS. | |
| 97 | − * The suffix _M_N[] indicate the values of coef_compress and coef_res | |
| 98 | − * respectively. | |
| 99 | − * @{ | |
| 100 | − */ | |
| 101 | −static const int tns_tmp2_map_1_3[4] = { | |
| 102 | − Q31(0.00000000), Q31(-0.43388373), Q31(0.64278758), Q31(0.34202015), | |
| 103 | −}; | |
| 104 | − | |
| 105 | −static const int tns_tmp2_map_0_3[8] = { | |
| 106 | − Q31(0.00000000), Q31(-0.43388373), Q31(-0.78183150), Q31(-0.97492790), | |
| 107 | − Q31(0.98480773), Q31( 0.86602539), Q31( 0.64278758), Q31( 0.34202015), | |
| 108 | −}; | |
| 109 | − | |
| 110 | −static const int tns_tmp2_map_1_4[8] = { | |
| 111 | − Q31(0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524), | |
| 112 | − Q31(0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951), | |
| 113 | −}; | |
| 114 | − | |
| 115 | −static const int tns_tmp2_map_0_4[16] = { | |
| 116 | − Q31( 0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524), | |
| 117 | − Q31(-0.74314481), Q31(-0.86602539), Q31(-0.95105654), Q31(-0.99452192), | |
| 118 | − Q31( 0.99573416), Q31( 0.96182561), Q31( 0.89516330), Q31( 0.79801720), | |
| 119 | − Q31( 0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951), | |
| 120 | −}; | |
| 121 | − | |
| 122 | −static const int * const tns_tmp2_map_fixed[4] = { | |
| 123 | − tns_tmp2_map_0_3, | |
| 124 | − tns_tmp2_map_0_4, | |
| 125 | − tns_tmp2_map_1_3, | |
| 126 | − tns_tmp2_map_1_4 | |
| 127 | −}; | |
| 128 | −// @} | |
| 129 | − | |
| 130 | −static const int exp2tab[4] = { Q31(1.0000000000/2), Q31(1.1892071150/2), Q31(1.4142135624/2), Q31(1.6817928305/2) }; // 2^0, 2^0.25, 2^0.5, 2^0.75 | |
| 131 | − | |
| 132 | 82 | #include "aacdec_template.c" |
| 133 | 83 | |
| 134 | 84 | const FFCodec ff_aac_fixed_decoder = { |
| @@ -1218,13 +1218,17 @@ static int decode_prediction(AACDecContext *ac, IndividualChannelStream *ics, · 1217 unmodified lines | ||
| 1218 | 1218 | /** |
| 1219 | 1219 | * Decode Long Term Prediction data; reference: table 4.xx. |
| 1220 | 1220 | */ |
| 1221 | −static void decode_ltp(LongTermPrediction *ltp, | |
| 1221 | +static void decode_ltp(AACDecContext *ac, LongTermPrediction *ltp, | |
| 1222 | 1222 | GetBitContext *gb, uint8_t max_sfb) |
| 1223 | 1223 | { |
| 1224 | 1224 | int sfb; |
| 1225 | 1225 | |
| 1226 | 1226 | ltp->lag = get_bits(gb, 11); |
| 1227 | − ltp->AAC_RENAME(coef) = AAC_RENAME2(ltp_coef)[get_bits(gb, 3)]; | |
| 1227 | + if (ac->is_fixed) | |
| 1228 | + ltp->coef_fixed = Q30(ff_ltp_coef[get_bits(gb, 3)]); | |
| 1229 | + else | |
| 1230 | + ltp->coef = ff_ltp_coef[get_bits(gb, 3)]; | |
| 1231 | + | |
| 1228 | 1232 | for (sfb = 0; sfb < FFMIN(max_sfb, MAX_LTP_LONG_SFB); sfb++) |
| 1229 | 1233 | ltp->used[sfb] = get_bits1(gb); |
| 1230 | 1234 | } |
| @@ -1331,7 +1335,7 @@ static int decode_ics_info(AACDecContext *ac, IndividualChannelStream *ics, · 100 unmodified lines | ||
| 1331 | 1335 | goto fail; |
| 1332 | 1336 | } |
| 1333 | 1337 | if ((ics->ltp.present = get_bits(gb, 1))) |
| 1334 | − decode_ltp(&ics->ltp, gb, ics->max_sfb); | |
| 1338 | + decode_ltp(ac, &ics->ltp, gb, ics->max_sfb); | |
| 1335 | 1339 | } |
| 1336 | 1340 | } |
| 1337 | 1341 | } |
| @@ -1531,7 +1535,7 @@ static int decode_tns(AACDecContext *ac, TemporalNoiseShaping *tns, · 193 unmodified lines | ||
| 1531 | 1535 | tmp2_idx = 2 * coef_compress + coef_res; |
| 1532 | 1536 | |
| 1533 | 1537 | for (i = 0; i < tns->order[w][filt]; i++) |
| 1534 | − tns->AAC_RENAME(coef)[w][filt][i] = AAC_RENAME2(tns_tmp2_map)[tmp2_idx][get_bits(gb, coef_len)]; | |
| 1538 | + tns->AAC_RENAME(coef)[w][filt][i] = Q31(ff_tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)]); | |
| 1535 | 1539 | } |
| 1536 | 1540 | } |
| 1537 | 1541 | } |
| @@ -1704,7 +1708,7 @@ static int decode_cpe(AACDecContext *ac, GetBitContext *gb, ChannelElement *cpe) · 166 unmodified lines | ||
| 1704 | 1708 | if (cpe->ch[1].ics.predictor_present && |
| 1705 | 1709 | (ac->oc[1].m4ac.object_type != AOT_AAC_MAIN)) |
| 1706 | 1710 | if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1))) |
| 1707 | − decode_ltp(&cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb); | |
| 1711 | + decode_ltp(ac, &cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb); | |
| 1708 | 1712 | ms_present = get_bits(gb, 2); |
| 1709 | 1713 | if (ms_present == 3) { |
| 1710 | 1714 | av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n"); |