FFmpeg
aacdec_fixed.c
Go to the documentation of this file.
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 "libavutil/thread.h"
35 
36 #include "libavcodec/aac_defines.h"
37 
38 #include "libavcodec/avcodec.h"
39 #include "aacdec.h"
40 #include "libavcodec/aactab.h"
42 #include "libavcodec/kbdwin.h"
43 #include "libavcodec/cbrt_data.h"
44 #include "libavcodec/aacsbr.h"
45 
50 
51 static void init_tables_fixed_fn(void)
52 {
54 
57 
60 
62 
64 }
65 
66 static const int cce_scale_fixed[8] = {
67  Q30(1.0), //2^(0/8)
68  Q30(1.0905077327), //2^(1/8)
69  Q30(1.1892071150), //2^(2/8)
70  Q30(1.2968395547), //2^(3/8)
71  Q30(1.4142135624), //2^(4/8)
72  Q30(1.5422108254), //2^(5/8)
73  Q30(1.6817928305), //2^(6/8)
74  Q30(1.8340080864), //2^(7/8)
75 };
76 
77 /** Dequantization-related */
78 #include "aacdec_fixed_dequant.h"
79 
80 #include "aacdec_fixed_coupling.h"
82 #include "aacdec_dsp_template.c"
83 #include "aacdec_proc_template.c"
84 
86 {
87  static AVOnce init_fixed_once = AV_ONCE_INIT;
88  AACDecContext *ac = avctx->priv_data;
89 
90  ac->is_fixed = 1;
92 
93  aac_dsp_init_fixed(&ac->dsp);
94  aac_proc_init_fixed(&ac->proc);
95 
97  if (!ac->fdsp)
98  return AVERROR(ENOMEM);
99 
100  ff_thread_once(&init_fixed_once, init_tables_fixed_fn);
101 
102  return ff_aac_decode_init(avctx);
103 }
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
thread.h
aac_kbd_long_960_fixed
static int aac_kbd_long_960_fixed[960]
Definition: aacdec_fixed.c:48
ff_kbd_window_init_fixed
av_cold void ff_kbd_window_init_fixed(int32_t *window, float alpha, int n)
Definition: kbdwin.c:59
aacdec_fixed_dequant.h
aacsbr.h
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
aacdec_dsp_template.c
aac_kbd_short_128_fixed
static int aac_kbd_short_128_fixed[128]
Definition: aacdec_fixed.c:47
AACDecContext::proc
AACDecProc proc
Definition: aacdec.h:263
ff_aac_sbr_init_fixed
void ff_aac_sbr_init_fixed(void)
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:502
avpriv_alloc_fixed_dsp
AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact)
Allocate and initialize a fixed DSP context.
Definition: fixed_dsp.c:151
aacdec_proc_template.c
ff_thread_once
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:205
av_cold
#define av_cold
Definition: attributes.h:90
ff_aac_decode_init
av_cold int ff_aac_decode_init(AVCodecContext *avctx)
Definition: aacdec.c:1170
kbdwin.h
AACDecContext::fdsp
AVFloatDSPContext * fdsp
Definition: aacdec.h:310
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:203
sinewin_fixed_tablegen.h
aacdec_fixed_coupling.h
aactab.h
AVOnce
#define AVOnce
Definition: thread.h:202
AACDecContext::dsp
AACDecDSP dsp
Definition: aacdec.h:262
ff_aac_decode_init_fixed
av_cold int ff_aac_decode_init_fixed(AVCodecContext *avctx)
Dequantization-related.
Definition: aacdec_fixed.c:85
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:109
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1057
aac_kbd_short_120_fixed
static int aac_kbd_short_120_fixed[120]
Definition: aacdec_fixed.c:49
cbrt_data.h
cce_scale_fixed
static const int cce_scale_fixed[8]
Definition: aacdec_fixed.c:66
AACDecContext::is_fixed
int is_fixed
Definition: aacdec.h:340
init_sine_windows_fixed
static av_cold void init_sine_windows_fixed(void)
Definition: sinewin_fixed_tablegen.h:63
aacdec_fixed_prediction.h
avcodec.h
init_tables_fixed_fn
static void init_tables_fixed_fn(void)
Definition: aacdec_fixed.c:51
aacdec.h
AACDecContext
main AAC decoding context
Definition: aacdec.h:258
AVCodecContext
main external API structure.
Definition: avcodec.h:445
AV_CODEC_FLAG_BITEXACT
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
Definition: avcodec.h:342
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
aac_defines.h
aac_kbd_long_1024_fixed
static int aac_kbd_long_1024_fixed[1024]
Definition: aacdec_fixed.c:46
Q30
#define Q30(x)
Definition: aac_defines.h:110
ff_cbrt_tableinit_fixed
void ff_cbrt_tableinit_fixed(void)