• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2003 - 2016 Sony Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _FIXP_LDAC_H
18 #define _FIXP_LDAC_H
19 
20 /***************************************************************************************************
21     Macro Definitions
22 ***************************************************************************************************/
23 
24 #define LDAC_MAX_32BIT ((INT32)0x7fffffffL)
25 #define LDAC_MIN_32BIT ((INT32)0x80000000L)
26 
27 #define LDAC_C_BLKFLT   31
28 
29 #define LDAC_Q_SETPCM   15
30 
31 #define LDAC_Q_MDCT_WIN 30
32 #define LDAC_Q_MDCT_COS 31
33 #define LDAC_Q_MDCT_SIN 31
34 
35 #define LDAC_Q_NORM1    15
36 #define LDAC_Q_NORM2    31
37 
38 #define LDAC_Q_QUANT1   47
39 #define LDAC_Q_QUANT2    0
40 #define LDAC_Q_QUANT3   15
41 #define LDAC_Q_QUANT4   47
42 
43 #define LDAC_Q_DEQUANT1  0
44 #define LDAC_Q_DEQUANT2  0
45 #define LDAC_Q_DEQUANT3 31
46 
47 #define LDAC_Q_NORM (15+(LDAC_Q_NORM2-LDAC_Q_NORM1))
48 
49 /***************************************************************************************************
50     Function Declarations
51 ***************************************************************************************************/
52 /* func_fixp_ldac.c */
53 DECLFUNC INT32 sftrnd_ldac(INT32, int);
54 #define lsft_ldac(x, n)    ((x) << (n))
55 #define rsft_ldac(x, n)    ((x) >> (n))
56 #define rsft_ro_ldac(x, n) (((x) + (1 << (n-1))) >> (n))
57 
58 #define lsftrnd_ldac(x, n)        (INT32)((INT64)(x) << (-(n)))
59 #define rsftrnd_ldac(x, n)        (INT32)(((INT64)(x) + ((INT64)1 << ((n)-1))) >> (n))
60 #define mul_lsftrnd_ldac(x, y, n) (INT32)(((INT64)(x) * (INT64)(y)) << (-(n)))
61 #define mul_rsftrnd_ldac(x, y, n) (INT32)((((INT64)(x) * (INT64)(y)) + ((INT64)1 << ((n)-1))) >> (n))
62 
63 DECLFUNC int get_bit_length_ldac(INT32);
64 DECLFUNC INT32 get_absmax_ldac(INT32 *, int);
65 
66 #endif /* _FIXP_LDAC_H */
67 
68