FFmpeg
Loading...
Searching...
No Matches
aacdec_float_coupling.h
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#ifndef AVCODEC_AAC_AACDEC_FLOAT_COUPLING_H
33#define AVCODEC_AAC_AACDEC_FLOAT_COUPLING_H
34
35#include "aacdec.h"
36
37/**
38 * Apply dependent channel coupling (applied before IMDCT).
39 *
40 * @param index index into coupling gain array
41 */
44 ChannelElement *cce, int index)
45{
46 IndividualChannelStream *ics = &cce->ch[0].ics;
47 const uint16_t *offsets = ics->swb_offset;
48 float *dest = target->coeffs;
49 const float *src = cce->ch[0].coeffs;
50 int g, i, group, k, idx = 0;
51 if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) {
52 av_log(ac->avctx, AV_LOG_ERROR,
53 "Dependent coupling is not supported together with LTP\n");
54 return;
55 }
56 for (g = 0; g < ics->num_window_groups; g++) {
57 for (i = 0; i < ics->max_sfb; i++, idx++) {
58 if (cce->ch[0].band_type[idx] != ZERO_BT) {
59 const float gain = cce->coup.gain[index][idx];
60 for (group = 0; group < ics->group_len[g]; group++) {
61 for (k = offsets[i]; k < offsets[i + 1]; k++) {
62 // FIXME: SIMDify
63 dest[group * 128 + k] += gain * src[group * 128 + k];
64 }
65 }
66 }
67 }
68 dest += ics->group_len[g] * 128;
69 src += ics->group_len[g] * 128;
70 }
71}
72
73/**
74 * Apply independent channel coupling (applied after IMDCT).
75 *
76 * @param index index into coupling gain array
77 */
80 ChannelElement *cce, int index)
81{
82 const float gain = cce->coup.gain[index][0];
83 const float *src = cce->ch[0].output;
84 float *dest = target->output;
85 const int len = 1024 << (ac->oc[1].m4ac.sbr == 1);
86
87 ac->fdsp->vector_fmac_scalar(dest, src, gain, len);
88}
89
90#endif /* AVCODEC_AAC_AACDEC_FLOAT_COUPLING_H */
@ ZERO_BT
Scalefactors and spectral data are all zero.
Definition aac.h:71
#define AAC_RENAME(x)
Definition aac_defines.h:99
AAC decoder definitions and structures.
static void AAC_RENAME apply_dependent_coupling(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply dependent channel coupling (applied before IMDCT).
static void AAC_RENAME apply_independent_coupling(AACDecContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)
Apply independent channel coupling (applied after IMDCT).
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
int index
Definition gxfenc.c:90
static const int offsets[]
Definition hevc_pel.c:34
@ AOT_AAC_LTP
Y Long Term Prediction.
Definition mpeg4audio.h:77
main AAC decoding context
Definition aacdec.h:500
channel element - generic struct for SCE/CPE/CCE/LFE
Definition aacdec.h:296
Individual Channel Stream.
Definition aacdec.h:169
uint8_t max_sfb
number of scalefactor bands per group
Definition aacdec.h:170
uint8_t group_len[8]
Definition aacdec.h:175
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
Definition aacdec.h:177
Single Channel Element - used for both SCE and LFE elements.
Definition aacdec.h:217
#define av_log(a,...)
#define src
Definition vp8dsp.c:248
const char * g
Definition vf_curves.c:128
int len