diff options
author | Martin Storsjo <martin@martin.st> | 2016-08-25 22:12:15 +0300 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2016-08-25 22:12:15 +0300 |
commit | f9d0f65e6578592149c01d8417197896283a821f (patch) | |
tree | b6293c11023d196ed31b9c6ef765d645d872db49 /libFDK | |
parent | 15b128dd826ba86ee962d86b0b06966a25ed9158 (diff) | |
parent | 00fc1c66d5a524c6961db04d05e1076b18003231 (diff) | |
download | fdk-aac-f9d0f65e6578592149c01d8417197896283a821f.tar.gz fdk-aac-f9d0f65e6578592149c01d8417197896283a821f.tar.bz2 fdk-aac-f9d0f65e6578592149c01d8417197896283a821f.zip |
Merge remote-tracking branch 'aosp/master'
Diffstat (limited to 'libFDK')
-rw-r--r-- | libFDK/include/fixpoint_math.h | 31 | ||||
-rw-r--r-- | libFDK/src/FDK_core.cpp | 4 | ||||
-rw-r--r-- | libFDK/src/FDK_tools_rom.cpp | 212 | ||||
-rw-r--r-- | libFDK/src/arm/qmf_arm.cpp | 78 |
4 files changed, 264 insertions, 61 deletions
diff --git a/libFDK/include/fixpoint_math.h b/libFDK/include/fixpoint_math.h index fcc6b5a..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 - 2014 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 */ 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 cfc0a2e..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 @@ -2039,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 @@ -2249,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, @@ -2260,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, @@ -2303,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 @@ -2418,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) @@ -2430,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; |