diff options
Diffstat (limited to 'libFDK')
-rw-r--r-- | libFDK/include/fixpoint_math.h | 41 | ||||
-rw-r--r-- | libFDK/src/FDK_core.cpp | 4 | ||||
-rw-r--r-- | libFDK/src/FDK_tools_rom.cpp | 222 | ||||
-rw-r--r-- | libFDK/src/arm/qmf_arm.cpp | 78 |
4 files changed, 277 insertions, 68 deletions
diff --git a/libFDK/include/fixpoint_math.h b/libFDK/include/fixpoint_math.h index df141d3..0d50f0a 100644 --- a/libFDK/include/fixpoint_math.h +++ b/libFDK/include/fixpoint_math.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -94,6 +94,35 @@ amm-info@iis.fraunhofer.de #include "common_fix.h" +#if !defined(FUNCTION_fIsLessThan) +/** + * \brief Compares two fixpoint values incl. scaling. + * \param a_m mantissa of the first input value. + * \param a_e exponent of the first input value. + * \param b_m mantissa of the second input value. + * \param b_e exponent of the second input value. + * \return non-zero if (a_m*2^a_e) < (b_m*2^b_e), 0 otherwise + */ +FDK_INLINE INT fIsLessThan(FIXP_DBL a_m, INT a_e, FIXP_DBL b_m, INT b_e) +{ + if (a_e > b_e) { + return (b_m >> fMin(a_e-b_e, DFRACT_BITS-1) > a_m); + } else { + return (a_m >> fMin(b_e-a_e, DFRACT_BITS-1) < b_m); + } +} + +FDK_INLINE INT fIsLessThan(FIXP_SGL a_m, INT a_e, FIXP_SGL b_m, INT b_e) +{ + if (a_e > b_e) { + return (b_m >> fMin(a_e-b_e, FRACT_BITS-1) > a_m); + } else { + return (a_m >> fMin(b_e-a_e, FRACT_BITS-1) < b_m); + } +} +#endif + + #define LD_DATA_SCALING (64.0f) #define LD_DATA_SHIFT 6 /* pow(2, LD_DATA_SHIFT) = LD_DATA_SCALING */ @@ -438,11 +467,11 @@ inline FIXP_DBL fAddSaturate(const FIXP_DBL a, const FIXP_DBL b) /***************************************************************************** - array for 1/n, n=1..50 + array for 1/n, n=1..80 ****************************************************************************/ - extern const FIXP_DBL invCount[50]; + extern const FIXP_DBL invCount[80]; LNK_SECTION_INITCODE inline void InitInvInt(void) {} @@ -450,14 +479,14 @@ inline FIXP_DBL fAddSaturate(const FIXP_DBL a, const FIXP_DBL b) /** * \brief Calculate the value of 1/i where i is a integer value. It supports - * input values from 1 upto 50. + * input values from 1 upto 80. * \param intValue Integer input value. * \param FIXP_DBL representation of 1/intValue */ inline FIXP_DBL GetInvInt(int intValue) { - FDK_ASSERT((intValue > 0) && (intValue < 50)); - FDK_ASSERT(intValue<50); + FDK_ASSERT((intValue > 0) && (intValue < 80)); + FDK_ASSERT(intValue<80); return invCount[intValue]; } diff --git a/libFDK/src/FDK_core.cpp b/libFDK/src/FDK_core.cpp index a706eb0..1d8ac7b 100644 --- a/libFDK/src/FDK_core.cpp +++ b/libFDK/src/FDK_core.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -93,7 +93,7 @@ amm-info@iis.fraunhofer.de /* FDK tools library info */ #define FDK_TOOLS_LIB_VL0 2 #define FDK_TOOLS_LIB_VL1 3 -#define FDK_TOOLS_LIB_VL2 2 +#define FDK_TOOLS_LIB_VL2 6 #define FDK_TOOLS_LIB_TITLE "FDK Tools" #ifdef __ANDROID__ #define FDK_TOOLS_LIB_BUILD_DATE "" diff --git a/libFDK/src/FDK_tools_rom.cpp b/libFDK/src/FDK_tools_rom.cpp index c6e517e..29e37f2 100644 --- a/libFDK/src/FDK_tools_rom.cpp +++ b/libFDK/src/FDK_tools_rom.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -1902,7 +1902,7 @@ const USHORT sqrt_tab[49]={ 0xb504}; LNK_SECTION_CONSTDATA_L1 -const FIXP_DBL invCount[50]= /* This could be 16-bit wide */ +const FIXP_DBL invCount[80]= /* This could be 16-bit wide */ { 0x00000000, 0x7fffffff, 0x40000000, 0x2aaaaaab, 0x20000000, 0x1999999a, 0x15555555, 0x12492492, 0x10000000, 0x0e38e38e, @@ -1913,7 +1913,13 @@ const FIXP_DBL invCount[50]= /* This could be 16-bit wide */ 0x04444444, 0x04210842, 0x04000000, 0x03e0f83e, 0x03c3c3c4, 0x03a83a84, 0x038e38e4, 0x03759f23, 0x035e50d8, 0x03483483, 0x03333333, 0x031f3832, 0x030c30c3, 0x02fa0be8, 0x02e8ba2f, - 0x02d82d83, 0x02c8590b, 0x02b93105, 0x02aaaaab, 0x029cbc15 + 0x02d82d83, 0x02c8590b, 0x02b93105, 0x02aaaaab, 0x029cbc15, + 0x028f5c29, 0x02828283, 0x02762762, 0x026a439f, 0x025ed098, + 0x0253c825, 0x02492492, 0x023ee090, 0x0234f72c, 0x022b63cc, + 0x02222222, 0x02192e2a, 0x02108421, 0x02082082, 0x02000000, + 0x01f81f82, 0x01f07c1f, 0x01e9131b, 0x01e1e1e2, 0x01dae607, + 0x01d41d42, 0x01cd8569, 0x01c71c72, 0x01c0e070, 0x01bacf91, + 0x01b4e81b, 0x01af286c, 0x01a98ef6, 0x01a41a42, 0x019ec8e9 }; @@ -2033,19 +2039,6 @@ static const element_list_t node_aac_cpe = { { &node_aac_cpe0, &node_aac_cpe1 } }; -#define el_mpegsres_sce &el_aac_sce[2] - -static const element_list_t node_mpegsres_sce = { - el_mpegsres_sce, - { NULL, NULL } -}; - -static const element_list_t node_mpegsres_cpe = { - el_aac_cpe1, - { NULL, NULL } -}; - - /* * AOT C- {17,23} * epConfig = 0,1 @@ -2243,7 +2236,7 @@ static const rbd_id_t el_aac_cpe1_epc1[] = { ics_info, ms, ltp_data_present, - ltp_data, + /* ltp_data, */ global_gain, section_data, scale_factor_data, @@ -2254,7 +2247,7 @@ static const rbd_id_t el_aac_cpe1_epc1[] = { next_channel, ltp_data_present, - ltp_data, + /* ltp_data, */ global_gain, section_data, scale_factor_data, @@ -2297,7 +2290,178 @@ static const element_list_t node_aac_cpe_epc1 = { { &node_aac_cpe0_epc1, &node_aac_cpe1_epc1 } }; +/* + * AOT = 20 + * epConfig = 0 + */ +static const rbd_id_t el_scal_sce_epc0[] = { + ics_info, /* ESC 1 */ + tns_data_present, + ltp_data_present, + /* ltp_data, */ + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + esc2_rvlc, /* ESC 2 */ + tns_data, /* ESC 3 */ + spectral_data, /* ESC 4 */ + end_of_sequence +}; + +static const struct element_list node_scal_sce_epc0 = { + el_scal_sce_epc0, + { NULL, NULL } +}; + +static const rbd_id_t el_scal_cpe_epc0[] = { + ics_info, /* ESC 0 */ + ms, + tns_data_present, /* ESC 1 (ch 0) */ + ltp_data_present, + /* ltp_data, */ + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + esc2_rvlc, /* ESC 2 (ch 0) */ + tns_data, /* ESC 3 (ch 0) */ + spectral_data, /* ESC 4 (ch 0) */ + next_channel, + tns_data_present, /* ESC 1 (ch 1) */ + ltp_data_present, + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + esc2_rvlc, /* ESC 2 (ch 1) */ + tns_data, /* ESC 3 (ch 1) */ + spectral_data, /* ESC 4 (ch 1) */ + end_of_sequence +}; + +static const struct element_list node_scal_cpe_epc0 = { + el_scal_cpe_epc0, + { NULL, NULL } +}; + +/* + * AOT = 20 + * epConfig = 1 + */ +static const rbd_id_t el_scal_sce_epc1[] = { + ics_info, + tns_data_present, + ltp_data_present, + /* ltp_data, */ + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + tns_data, + spectral_data, + end_of_sequence +}; + +static const struct element_list node_scal_sce_epc1 = { + el_scal_sce_epc1, + { NULL, NULL } +}; + +static const rbd_id_t el_scal_cpe_epc1[] = { + ics_info, + ms, + tns_data_present, + ltp_data_present, + /* ltp_data, */ + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + next_channel, + tns_data_present, + ltp_data_present, + /* ltp_data, */ + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + next_channel, + tns_data, + next_channel, + tns_data, + next_channel, + spectral_data, + next_channel, + spectral_data, + end_of_sequence +}; + +static const struct element_list node_scal_cpe_epc1 = { + el_scal_cpe_epc1, + { NULL, NULL } +}; + +/* + * Pseudo AOT for DRM/DRM+ (similar to AOT 20) + * Derived from epConfig = 1 + */ +static const rbd_id_t el_drm_sce[] = { + drmcrc_start_reg, + ics_info, + tns_data_present, + ltp_data_present, + /* ltp_data, */ + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + tns_data, + drmcrc_end_reg, + spectral_data, + end_of_sequence +}; + +static const struct element_list node_drm_sce = { + el_drm_sce, + { NULL, NULL } +}; + +static const rbd_id_t el_drm_cpe[] = { + drmcrc_start_reg, + ics_info, + ms, + tns_data_present, + ltp_data_present, + /* ltp_data, */ + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + next_channel, + tns_data_present, + ltp_data_present, + /* ltp_data, */ + global_gain, + section_data, + scale_factor_data, + esc1_hcr, + next_channel, + tns_data, + next_channel, + tns_data, + drmcrc_end_reg, + next_channel, + spectral_data, + next_channel, + spectral_data, + end_of_sequence +}; +static const struct element_list node_drm_cpe = { + el_drm_cpe, + { NULL, NULL } +}; /* * AOT = 39 @@ -2412,6 +2576,19 @@ const element_list_t * getBitstreamElementList(AUDIO_OBJECT_TYPE aot, SCHAR epCo return &node_aac_cpe_epc1; } break; + case AOT_ER_AAC_SCAL: + if (nChannels == 1) { + if (epConfig <= 0) + return &node_scal_sce_epc0; + else + return &node_scal_sce_epc1; + } else { + if (epConfig <= 0) + return &node_scal_cpe_epc0; + else + return &node_scal_cpe_epc1; + } + break; case AOT_ER_AAC_ELD: if (nChannels == 1) { if (epConfig <= 0) @@ -2424,11 +2601,14 @@ const element_list_t * getBitstreamElementList(AUDIO_OBJECT_TYPE aot, SCHAR epCo else return &node_eld_cpe_epc1; } - case AOT_MPEGS_RESIDUALS: + case AOT_DRM_AAC: + case AOT_DRM_SBR: + case AOT_DRM_MPEG_PS: + FDK_ASSERT(epConfig == 1); if (nChannels == 1) { - return &node_mpegsres_sce; + return &node_drm_sce; } else { - return &node_mpegsres_cpe; + return &node_drm_cpe; } break; default: diff --git a/libFDK/src/arm/qmf_arm.cpp b/libFDK/src/arm/qmf_arm.cpp index 0c0ce80..fbeebfb 100644 --- a/libFDK/src/arm/qmf_arm.cpp +++ b/libFDK/src/arm/qmf_arm.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -482,42 +482,42 @@ static void qmfSynPrototypeFirSlot1_filter(FIXP_QMF *RESTRICT realSlot, B = p_flt[4]; /* Bottom=[8] Top=[9] */ A = p_fltm[3]; /* Bottom=[316] Top=[317] */ sta0 = sta[0]; /* save state[0] */ - *sta++ = SMLAWT( sta[1], imag, B ); /* index=9...........319 */ - *sta++ = SMLAWB( sta[1], real, A ); /* index=316...........6 */ - *sta++ = SMLAWB( sta[1], imag, B ); /* index=8,18, ...318 */ + sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=9...........319 */ + sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=316...........6 */ + sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=8,18, ...318 */ B = p_flt[3]; /* Bottom=[6] Top=[7] */ - *sta++ = SMLAWT( sta[1], real, A ); /* index=317...........7 */ + sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=317...........7 */ A = p_fltm[4]; /* Bottom=[318] Top=[319] */ - *sta++ = SMLAWT( sta[1], imag, B ); /* index=7...........317 */ - *sta++ = SMLAWB( sta[1], real, A ); /* index=318...........8 */ - *sta++ = SMLAWB( sta[1], imag, B ); /* index=6...........316 */ + sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=7...........317 */ + sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=318...........8 */ + sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=6...........316 */ B = p_flt[2]; /* Bottom=[X] Top=[5] */ - *sta++ = SMLAWT( sta[1], real, A ); /* index=9...........319 */ + sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=9...........319 */ A = p_fltm[2]; /* Bottom=[X] Top=[315] */ - *sta++ = SMULWT( imag, B ); /* index=5,15, ... 315 */ + sta[0] = SMULWT( imag, B ); sta++; /* index=5,15, ... 315 */ result = SMLAWT( sta0, real, A ); /* index=315...........5 */ - *pMyTimeOut++ = result; + pMyTimeOut[0] = result; pMyTimeOut++; real = *--realSlot; imag = *--imagSlot; A = p_fltm[0]; /* Bottom=[310] Top=[311] */ B = p_flt[7]; /* Bottom=[14] Top=[15] */ result = SMLAWB( sta[0], real, A ); /* index=310...........0 */ - *sta++ = SMLAWB( sta[1], imag, B ); /* index=14..........324 */ - *pMyTimeOut++ = result; + sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=14..........324 */ + pMyTimeOut[0] = result; pMyTimeOut++; B = p_flt[6]; /* Bottom=[12] Top=[13] */ - *sta++ = SMLAWT( sta[1], real, A ); /* index=311...........1 */ + sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=311...........1 */ A = p_fltm[1]; /* Bottom=[312] Top=[313] */ - *sta++ = SMLAWT( sta[1], imag, B ); /* index=13..........323 */ - *sta++ = SMLAWB( sta[1], real, A ); /* index=312...........2 */ - *sta++ = SMLAWB( sta[1], imag, B ); /* index=12..........322 */ - *sta++ = SMLAWT( sta[1], real, A ); /* index=313...........3 */ + sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=13..........323 */ + sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=312...........2 */ + sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=12..........322 */ + sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=313...........3 */ A = p_fltm[2]; /* Bottom=[314] Top=[315] */ B = p_flt[5]; /* Bottom=[10] Top=[11] */ - *sta++ = SMLAWT( sta[1], imag, B ); /* index=11..........321 */ - *sta++ = SMLAWB( sta[1], real, A ); /* index=314...........4 */ - *sta++ = SMULWB( imag, B ); /* index=10..........320 */ + sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=11..........321 */ + sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=314...........4 */ + sta[0] = SMULWB( imag, B ); sta++; /* index=10..........320 */ p_flt += 5; @@ -566,21 +566,21 @@ INT qmfSynPrototypeFirSlot2( A = p_fltm[0]; /* Bottom=[310] Top=[311] */ B = p_flt[7]; /* Bottom=[14] Top=[15] */ result = SMLAWB( sta[0], real, A ); /* index=310...........0 */ - *sta++ = SMLAWB( sta[1], imag, B ); /* index=14..........324 */ + sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=14..........324 */ B = p_flt[6]; /* Bottom=[12] Top=[13] */ - *sta++ = SMLAWT( sta[1], real, A ); /* index=311...........1 */ + sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=311...........1 */ A = p_fltm[1]; /* Bottom=[312] Top=[313] */ - *sta++ = SMLAWT( sta[1], imag, B ); /* index=13..........323 */ - *sta++ = SMLAWB( sta[1], real, A ); /* index=312...........2 */ - *sta++ = SMLAWB( sta[1], imag, B ); /* index=12..........322 */ - *sta++ = SMLAWT( sta[1], real, A ); /* index=313...........3 */ + sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=13..........323 */ + sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=312...........2 */ + sta[0] = SMLAWB( sta[1], imag, B ); sta++; /* index=12..........322 */ + sta[0] = SMLAWT( sta[1], real, A ); sta++; /* index=313...........3 */ A = p_fltm[2]; /* Bottom=[314] Top=[315] */ B = p_flt[5]; /* Bottom=[10] Top=[11] */ - *sta++ = SMLAWT( sta[1], imag, B ); /* index=11..........321 */ - *sta++ = SMLAWB( sta[1], real, A ); /* index=314...........4 */ - *sta++ = SMULWB( imag, B ); /* index=10..........320 */ + sta[0] = SMLAWT( sta[1], imag, B ); sta++; /* index=11..........321 */ + sta[0] = SMLAWB( sta[1], real, A ); sta++; /* index=314...........4 */ + sta[0] = SMULWB( imag, B ); sta++; /* index=10..........320 */ - *pMyTimeOut++ = result; + pMyTimeOut[0] = result; pMyTimeOut++; p_fltm -= 5; p_flt += 5; @@ -610,8 +610,8 @@ INT qmfSynPrototypeFirSlot2( { FIXP_DBL result1, result2; - result1 = *pMyTimeOut++; - result2 = *pMyTimeOut++; + result1 = pMyTimeOut[0]; pMyTimeOut++; + result2 = pMyTimeOut[0]; pMyTimeOut++; result1 = fMult(result1,gain); timeOut -= stride; @@ -635,8 +635,8 @@ INT qmfSynPrototypeFirSlot2( timeOut[0] = result2 << scale; #endif - result1 = *pMyTimeOut++; - result2 = *pMyTimeOut++; + result1 = pMyTimeOut[0]; pMyTimeOut++; + result2 = pMyTimeOut[0]; pMyTimeOut++; result1 = fMult(result1,gain); timeOut -= stride; @@ -666,8 +666,8 @@ INT qmfSynPrototypeFirSlot2( for (no_channels>>=2; no_channels--;) { FIXP_DBL result1, result2; - result1 = *pMyTimeOut++; - result2 = *pMyTimeOut++; + result1 = pMyTimeOut[0]; pMyTimeOut++; + result2 = pMyTimeOut[0]; pMyTimeOut++; timeOut -= stride; if (result1 < 0) result1 += add_neg; if (result1 < max_neg) result1 = max_neg; @@ -688,8 +688,8 @@ INT qmfSynPrototypeFirSlot2( timeOut[0] = result2 << scale; #endif - result1 = *pMyTimeOut++; - result2 = *pMyTimeOut++; + result1 = pMyTimeOut[0]; pMyTimeOut++; + result2 = pMyTimeOut[0]; pMyTimeOut++; timeOut -= stride; if (result1 < 0) result1 += add_neg; if (result1 < max_neg) result1 = max_neg; |