CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/ext/at3_standalone/atrac.h
Views: 1401
1
/*
2
* common functions for the ATRAC family of decoders
3
*
4
* Copyright (c) 2009-2013 Maxim Poliakovski
5
* Copyright (c) 2009 Benjamin Larsson
6
*
7
* This file is part of FFmpeg.
8
*
9
* FFmpeg is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Lesser General Public
11
* License as published by the Free Software Foundation; either
12
* version 2.1 of the License, or (at your option) any later version.
13
*
14
* FFmpeg is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Lesser General Public License for more details.
18
*
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with FFmpeg; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
*/
23
24
/**
25
* @file
26
* ATRAC common header
27
*/
28
29
#include "compat.h"
30
31
#ifndef AVCODEC_ATRAC_H
32
#define AVCODEC_ATRAC_H
33
34
/**
35
* Gain control parameters for one subband.
36
*/
37
typedef struct AtracGainInfo {
38
int num_points; ///< number of gain control points
39
int lev_code[7]; ///< level at corresponding control point
40
int loc_code[7]; ///< location of gain control points
41
} AtracGainInfo;
42
43
/**
44
* Gain compensation context structure.
45
*/
46
typedef struct AtracGCContext {
47
float gain_tab1[16]; ///< gain compensation level table
48
float gain_tab2[31]; ///< gain compensation interpolation table
49
int id2exp_offset; ///< offset for converting level index into level exponent
50
int loc_scale; ///< scale of location code = 2^loc_scale samples
51
int loc_size; ///< size of location code in samples
52
} AtracGCContext;
53
54
extern float av_atrac_sf_table[64];
55
56
/**
57
* Generate common tables.
58
*/
59
void ff_atrac_generate_tables(void);
60
61
/**
62
* Initialize gain compensation context.
63
*
64
* @param gctx pointer to gain compensation context to initialize
65
* @param id2exp_offset offset for converting level index into level exponent
66
* @param loc_scale location size factor
67
*/
68
void ff_atrac_init_gain_compensation(AtracGCContext *gctx, int id2exp_offset,
69
int loc_scale);
70
71
/**
72
* Apply gain compensation and perform the MDCT overlapping part.
73
*
74
* @param gctx pointer to gain compensation context
75
* @param in input buffer
76
* @param prev previous buffer to perform overlap against
77
* @param gc_now gain control information for current frame
78
* @param gc_next gain control information for next frame
79
* @param num_samples number of samples to process
80
* @param out output data goes here
81
*/
82
void ff_atrac_gain_compensation(AtracGCContext *gctx, float *in, float *prev,
83
AtracGainInfo *gc_now, AtracGainInfo *gc_next,
84
int num_samples, float *out);
85
86
/**
87
* Quadrature mirror synthesis filter.
88
*
89
* @param inlo lower part of spectrum
90
* @param inhi higher part of spectrum
91
* @param nIn size of spectrum buffer
92
* @param pOut out buffer
93
* @param delayBuf delayBuf buffer
94
* @param temp temp buffer
95
*/
96
void ff_atrac_iqmf(float *inlo, float *inhi, unsigned int nIn, float *pOut,
97
float *delayBuf, float *temp);
98
99
#endif /* AVCODEC_ATRAC_H */
100
101