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