Unified · Split
| @@ -1,5 +1,7 @@ | |||
| 1 | clean:: | 1 | clean:: |
| 2 | $(RM) $(CLEANSUFFIXES:%=libavcodec/aac/%) | 2 | $(RM) $(CLEANSUFFIXES:%=libavcodec/aac/%) |
| 3 | 3 | ||
| 4 | OBJS-$(CONFIG_AAC_DECODER) += aac/aacdec.o aac/aacdec_tab.o | 4 | OBJS-$(CONFIG_AAC_DECODER) += aac/aacdec.o aac/aacdec_tab.o \ |
| 5 | OBJS-$(CONFIG_AAC_FIXED_DECODER) += aac/aacdec.o aac/aacdec_tab.o | 5 | aac/aacdec_float.o |
| 6 | OBJS-$(CONFIG_AAC_FIXED_DECODER) += aac/aacdec.o aac/aacdec_tab.o \ | ||
| 7 | aac/aacdec_fixed.o | ||
| @@ -45,6 +45,9 @@ · 44 unmodified lines | |||
| 45 | #include "libavutil/tx.h" | 45 | #include "libavutil/tx.h" |
| 46 | #include "libavutil/version.h" | 46 | #include "libavutil/version.h" |
| 47 | 47 | ||
| 48 | extern const AACDecDSP aac_dsp; | ||
| 49 | extern const AACDecDSP aac_dsp_fixed; | ||
| 50 | |||
| 48 | av_cold int ff_aac_decode_close(AVCodecContext *avctx) | 51 | av_cold int ff_aac_decode_close(AVCodecContext *avctx) |
| 49 | { | 52 | { |
| 50 | AACDecContext *ac = avctx->priv_data; | 53 | AACDecContext *ac = avctx->priv_data; |
| @@ -115,6 +118,8 @@ av_cold int ff_aac_decode_init_common(AVCodecContext *avctx) · 64 unmodified lines | |||
| 115 | if (ret < 0) | 118 | if (ret < 0) |
| 116 | return ret; | 119 | return ret; |
| 117 | 120 | ||
| 121 | ac->dsp = is_fixed ? aac_dsp_fixed : aac_dsp; | ||
| 122 | |||
| 118 | return 0; | 123 | return 0; |
| 119 | } | 124 | } |
| 120 | 125 | ||
| @@ -0,0 +1,93 @@ | |||
| 1 | /* | ||
| 2 | * AAC decoder | ||
| 3 | * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) | ||
| 4 | * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) | ||
| 5 | * Copyright (c) 2008-2013 Alex Converse <alex.converse@gmail.com> | ||
| 6 | * | ||
| 7 | * AAC LATM decoder | ||
| 8 | * Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz> | ||
| 9 | * Copyright (c) 2010 Janne Grunau <janne-libav@jannau.net> | ||
| 10 | * | ||
| 11 | * AAC decoder fixed-point implementation | ||
| 12 | * Copyright (c) 2013 | ||
| 13 | * MIPS Technologies, Inc., California. | ||
| 14 | * | ||
| 15 | * This file is part of FFmpeg. | ||
| 16 | * | ||
| 17 | * FFmpeg is free software; you can redistribute it and/or | ||
| 18 | * modify it under the terms of the GNU Lesser General Public | ||
| 19 | * License as published by the Free Software Foundation; either | ||
| 20 | * version 2.1 of the License, or (at your option) any later version. | ||
| 21 | * | ||
| 22 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 25 | * Lesser General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU Lesser General Public | ||
| 28 | * License along with FFmpeg; if not, write to the Free Software | ||
| 29 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 30 | */ | ||
| 31 | |||
| 32 | #include "libavcodec/aacdec.h" | ||
| 33 | #include "libavcodec/aac_defines.h" | ||
| 34 | |||
| 35 | #include "libavcodec/aactab.h" | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Convert integer scalefactors to the decoder's native expected | ||
| 39 | * scalefactor values. | ||
| 40 | */ | ||
| 41 | static void AAC_RENAME(dequant_scalefactors)(SingleChannelElement *sce) | ||
| 42 | { | ||
| 43 | IndividualChannelStream *ics = &sce->ics; | ||
| 44 | const enum BandType *band_type = sce->band_type; | ||
| 45 | const int *band_type_run_end = sce->band_type_run_end; | ||
| 46 | const int *sfo = sce->sfo; | ||
| 47 | INTFLOAT *sf = sce->AAC_RENAME(sf); | ||
| 48 | |||
| 49 | int g, i, idx = 0; | ||
| 50 | for (g = 0; g < ics->num_window_groups; g++) { | ||
| 51 | for (i = 0; i < ics->max_sfb;) { | ||
| 52 | int run_end = band_type_run_end[idx]; | ||
| 53 | switch (band_type[idx]) { | ||
| 54 | case ZERO_BT: | ||
| 55 | for (; i < run_end; i++, idx++) | ||
| 56 | sf[idx] = FIXR(0.); | ||
| 57 | break; | ||
| 58 | case INTENSITY_BT: /* fallthrough */ | ||
| 59 | case INTENSITY_BT2: | ||
| 60 | for (; i < run_end; i++, idx++) { | ||
| 61 | #if USE_FIXED | ||
| 62 | sf[idx] = 100 - sfo[idx]; | ||
| 63 | #else | ||
| 64 | sf[idx] = ff_aac_pow2sf_tab[-sfo[idx] + POW_SF2_ZERO]; | ||
| 65 | #endif /* USE_FIXED */ | ||
| 66 | } | ||
| 67 | break; | ||
| 68 | case NOISE_BT: | ||
| 69 | for (; i < run_end; i++, idx++) { | ||
| 70 | #if USE_FIXED | ||
| 71 | sf[idx] = -(100 + sfo[idx]); | ||
| 72 | #else | ||
| 73 | sf[idx] = -ff_aac_pow2sf_tab[sfo[idx] + POW_SF2_ZERO]; | ||
| 74 | #endif /* USE_FIXED */ | ||
| 75 | } | ||
| 76 | break; | ||
| 77 | default: | ||
| 78 | for (; i < run_end; i++, idx++) { | ||
| 79 | #if USE_FIXED | ||
| 80 | sf[idx] = -sfo[idx]; | ||
| 81 | #else | ||
| 82 | sf[idx] = -ff_aac_pow2sf_tab[sfo[idx] - 100 + POW_SF2_ZERO]; | ||
| 83 | #endif /* USE_FIXED */ | ||
| 84 | } | ||
| 85 | break; | ||
| 86 | } | ||
| 87 | } | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | const AACDecDSP AAC_RENAME(aac_dsp) = { | ||
| 92 | .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors), | ||
| 93 | }; | ||
| @@ -0,0 +1,34 @@ | |||
| 1 | /* | ||
| 2 | * AAC decoder | ||
| 3 | * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) | ||
| 4 | * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) | ||
| 5 | * Copyright (c) 2008-2013 Alex Converse <alex.converse@gmail.com> | ||
| 6 | * | ||
| 7 | * AAC LATM decoder | ||
| 8 | * Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz> | ||
| 9 | * Copyright (c) 2010 Janne Grunau <janne-libav@jannau.net> | ||
| 10 | * | ||
| 11 | * AAC decoder fixed-point implementation | ||
| 12 | * Copyright (c) 2013 | ||
| 13 | * MIPS Technologies, Inc., California. | ||
| 14 | * | ||
| 15 | * This file is part of FFmpeg. | ||
| 16 | * | ||
| 17 | * FFmpeg is free software; you can redistribute it and/or | ||
| 18 | * modify it under the terms of the GNU Lesser General Public | ||
| 19 | * License as published by the Free Software Foundation; either | ||
| 20 | * version 2.1 of the License, or (at your option) any later version. | ||
| 21 | * | ||
| 22 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 25 | * Lesser General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU Lesser General Public | ||
| 28 | * License along with FFmpeg; if not, write to the Free Software | ||
| 29 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 30 | */ | ||
| 31 | |||
| 32 | #define USE_FIXED 1 | ||
| 33 | |||
| 34 | #include "aacdec_dsp_template.c" | ||
| @@ -0,0 +1,34 @@ | |||
| 1 | /* | ||
| 2 | * AAC decoder | ||
| 3 | * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) | ||
| 4 | * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) | ||
| 5 | * Copyright (c) 2008-2013 Alex Converse <alex.converse@gmail.com> | ||
| 6 | * | ||
| 7 | * AAC LATM decoder | ||
| 8 | * Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz> | ||
| 9 | * Copyright (c) 2010 Janne Grunau <janne-libav@jannau.net> | ||
| 10 | * | ||
| 11 | * AAC decoder fixed-point implementation | ||
| 12 | * Copyright (c) 2013 | ||
| 13 | * MIPS Technologies, Inc., California. | ||
| 14 | * | ||
| 15 | * This file is part of FFmpeg. | ||
| 16 | * | ||
| 17 | * FFmpeg is free software; you can redistribute it and/or | ||
| 18 | * modify it under the terms of the GNU Lesser General Public | ||
| 19 | * License as published by the Free Software Foundation; either | ||
| 20 | * version 2.1 of the License, or (at your option) any later version. | ||
| 21 | * | ||
| 22 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 25 | * Lesser General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU Lesser General Public | ||
| 28 | * License along with FFmpeg; if not, write to the Free Software | ||
| 29 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 30 | */ | ||
| 31 | |||
| 32 | #define USE_FIXED 0 | ||
| 33 | |||
| 34 | #include "aacdec_dsp_template.c" | ||
| @@ -1512,60 +1512,6 @@ static int decode_scalefactors(AACDecContext *ac, int sfo[120], · 1511 unmodified lines | |||
| 1512 | return 0; | 1512 | return 0; |
| 1513 | } | 1513 | } |
| 1514 | 1514 | ||
| 1515 | /** | ||
| 1516 | * Convert integer scalefactors to the decoder's native expected | ||
| 1517 | * scalefactor values. | ||
| 1518 | */ | ||
| 1519 | static void dequant_scalefactors(SingleChannelElement *sce) | ||
| 1520 | { | ||
| 1521 | IndividualChannelStream *ics = &sce->ics; | ||
| 1522 | const enum BandType *band_type = sce->band_type; | ||
| 1523 | const int *band_type_run_end = sce->band_type_run_end; | ||
| 1524 | const int *sfo = sce->sfo; | ||
| 1525 | INTFLOAT *sf = sce->AAC_RENAME(sf); | ||
| 1526 | |||
| 1527 | int g, i, idx = 0; | ||
| 1528 | for (g = 0; g < ics->num_window_groups; g++) { | ||
| 1529 | for (i = 0; i < ics->max_sfb;) { | ||
| 1530 | int run_end = band_type_run_end[idx]; | ||
| 1531 | switch (band_type[idx]) { | ||
| 1532 | case ZERO_BT: | ||
| 1533 | for (; i < run_end; i++, idx++) | ||
| 1534 | sf[idx] = FIXR(0.); | ||
| 1535 | break; | ||
| 1536 | case INTENSITY_BT: /* fallthrough */ | ||
| 1537 | case INTENSITY_BT2: | ||
| 1538 | for (; i < run_end; i++, idx++) { | ||
| 1539 | #if USE_FIXED | ||
| 1540 | sf[idx] = 100 - sfo[idx]; | ||
| 1541 | #else | ||
| 1542 | sf[idx] = ff_aac_pow2sf_tab[-sfo[idx] + POW_SF2_ZERO]; | ||
| 1543 | #endif /* USE_FIXED */ | ||
| 1544 | } | ||
| 1545 | break; | ||
| 1546 | case NOISE_BT: | ||
| 1547 | for (; i < run_end; i++, idx++) { | ||
| 1548 | #if USE_FIXED | ||
| 1549 | sf[idx] = -(100 + sfo[idx]); | ||
| 1550 | #else | ||
| 1551 | sf[idx] = -ff_aac_pow2sf_tab[sfo[idx] + POW_SF2_ZERO]; | ||
| 1552 | #endif /* USE_FIXED */ | ||
| 1553 | } | ||
| 1554 | break; | ||
| 1555 | default: | ||
| 1556 | for (; i < run_end; i++, idx++) { | ||
| 1557 | #if USE_FIXED | ||
| 1558 | sf[idx] = -sfo[idx]; | ||
| 1559 | #else | ||
| 1560 | sf[idx] = -ff_aac_pow2sf_tab[sfo[idx] - 100 + POW_SF2_ZERO]; | ||
| 1561 | #endif /* USE_FIXED */ | ||
| 1562 | } | ||
| 1563 | break; | ||
| 1564 | } | ||
| 1565 | } | ||
| 1566 | } | ||
| 1567 | } | ||
| 1568 | |||
| 1569 | /** | 1515 | /** |
| 1570 | * Decode pulse data; reference: table 4.7. | 1516 | * Decode pulse data; reference: table 4.7. |
| 1571 | */ | 1517 | */ |
| @@ -2061,7 +2007,7 @@ static int decode_ics(AACDecContext *ac, SingleChannelElement *sce, · 489 unmodified lines | |||
| 2061 | sce->band_type, sce->band_type_run_end)) < 0) | 2007 | sce->band_type, sce->band_type_run_end)) < 0) |
| 2062 | goto fail; | 2008 | goto fail; |
| 2063 | 2009 | ||
| 2064 | dequant_scalefactors(sce); | 2010 | ac->dsp.dequant_scalefactors(sce); |
| 2065 | 2011 | ||
| 2066 | pulse_present = 0; | 2012 | pulse_present = 0; |
| 2067 | if (!scale_flag) { | 2013 | if (!scale_flag) { |