#include <string.h>
#include <math.h>
#include "constants.h"
#include "filter.h"
Go to the source code of this file.
|
float | gaindequant (int index, float maxIn, int cblen) |
|
float | gainquant (float in, float maxIn, int cblen, int *index) |
|
◆ gaindequant()
float gaindequant |
( |
int |
index, |
|
|
float |
maxIn, |
|
|
int |
cblen |
|
) |
| |
Definition at line 83 of file gainquant.c.
87 {
88 float scale;
89
90
91
92 scale=(float)fabs(maxIn);
93
94 if (scale<0.1) {
95 scale=(float)0.1;
96 }
97
98
99
100 if (cblen==8) {
102 } else if (cblen==16) {
104 }
105 else if (cblen==32) {
107 }
108
109 return 0.0;
110 }
References gain_sq3Tbl, gain_sq4Tbl, and gain_sq5Tbl.
Referenced by iCBConstruct().
◆ gainquant()
float gainquant |
( |
float |
in, |
|
|
float |
maxIn, |
|
|
int |
cblen, |
|
|
int * |
index |
|
) |
| |
Definition at line 27 of file gainquant.c.
32 {
33 int i, tindex;
34 float minmeasure,measure, *cb, scale;
35
36
37
38 scale=maxIn;
39
40 if (scale<0.1) {
41 scale=(float)0.1;
42 }
43
44
45
46 if (cblen == 8) {
48 } else if (cblen == 16) {
50 } else {
52 }
53
54
55
56 minmeasure=10000000.0;
57 tindex=0;
58 for (i=0; i<cblen; i++) {
59
60
61
62
63
64 measure=(
in-scale*cb[i])*(
in-scale*cb[i]);
65
66 if (measure<minmeasure) {
67 tindex=i;
68 minmeasure=measure;
69 }
70 }
71 *index=tindex;
72
73
74
75 return scale*cb[tindex];
76 }
References gain_sq3Tbl, gain_sq4Tbl, gain_sq5Tbl, and in.
Referenced by iCBSearch().