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 
46 DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_long_1024))[1024];
47 DECLARE_ALIGNED(32, static INTFLOAT, AAC_RENAME2(aac_kbd_short_128))[128];
50 
51 static void init_tables_fixed_fn(void)
52 {
54 
55  AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
56  AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
57 
60 
62 
64 }
65 
66 static int init_fixed(AACDecContext *ac)
67 {
68  static AVOnce init_fixed_once = AV_ONCE_INIT;
69  ff_thread_once(&init_fixed_once, init_tables_fixed_fn);
70 
72  if (!ac->fdsp)
73  return AVERROR(ENOMEM);
74 
75  return 0;
76 }
77 
78 static const int cce_scale_fixed[8] = {
79  Q30(1.0), //2^(0/8)
80  Q30(1.0905077327), //2^(1/8)
81  Q30(1.1892071150), //2^(2/8)
82  Q30(1.2968395547), //2^(3/8)
83  Q30(1.4142135624), //2^(4/8)
84  Q30(1.5422108254), //2^(5/8)
85  Q30(1.6817928305), //2^(6/8)
86  Q30(1.8340080864), //2^(7/8)
87 };
88 
89 /** Dequantization-related */
90 #include "aacdec_fixed_dequant.h"
91 
92 #include "aacdec_fixed_coupling.h"
94 #include "aacdec_dsp_template.c"
95 #include "aacdec_proc_template.c"
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
ff_cbrt_tableinit
void ff_cbrt_tableinit(void)
Definition: cbrt_tablegen.h:40
init_fixed
static int init_fixed(AACDecContext *ac)
Definition: aacdec_fixed.c:66
aacdec_fixed_dequant.h
aacsbr.h
aacdec_dsp_template.c
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
kbdwin.h
AAC_RENAME2
static INTFLOAT AAC_RENAME2(aac_kbd_long_1024)[1024]
AACDecContext::fdsp
AVFloatDSPContext * fdsp
Definition: aacdec.h:305
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:203
sinewin_fixed_tablegen.h
ff_aac_sbr_init
FF_VISIBILITY_PUSH_HIDDEN void ff_aac_sbr_init(void)
Initialize SBR.
Definition: aacsbr_template.c:52
aacdec_fixed_coupling.h
aactab.h
AVOnce
#define AVOnce
Definition: thread.h:202
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:109
aac_kbd_long_960
static float aac_kbd_long_960[960]
Definition: aacdec_float.c:49
cbrt_data.h
cce_scale_fixed
static const int cce_scale_fixed[8]
Definition: aacdec_fixed.c:78
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:253
AACDecContext::avctx
struct AVCodecContext * avctx
Definition: aacdec.h:255
AAC_RENAME
static INTFLOAT AAC_RENAME(aac_kbd_long_960)[960]
ff_kbd_window_init
av_cold void ff_kbd_window_init(float *window, float alpha, int n)
Generate a Kaiser-Bessel Derived Window.
Definition: kbdwin.c:54
AV_CODEC_FLAG_BITEXACT
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
Definition: avcodec.h:342
aac_defines.h
INTFLOAT
float INTFLOAT
Definition: aac_defines.h:101
aac_kbd_short_120
static float aac_kbd_short_120[120]
Definition: aacdec_float.c:50
Q30
#define Q30(x)
Definition: aac_defines.h:110