19 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: plugin_fixed.c,v 1.1.2.1 2003-03-23 04:03:01 suxen_drol Exp $ |
* $Id: plugin_fixed.c,v 1.1.2.2 2003-03-25 22:31:45 edgomez Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
64 |
int low, high; |
int low, high; |
65 |
int q, r; |
int q, r; |
66 |
int a,b,min, max; |
int a,b,min, max; |
67 |
|
int m, M; |
68 |
int *dist; |
int *dist; |
69 |
|
|
70 |
/* Low quant */ |
/* Low quant */ |
172 |
/* How much packets of (q)M quantizers + 1m quantizer */ |
/* How much packets of (q)M quantizers + 1m quantizer */ |
173 |
b = min - r; |
b = min - r; |
174 |
|
|
175 |
|
/* First we set M */ |
176 |
|
M = (max==nhigh)?high:low; |
177 |
|
|
178 |
|
/* |
179 |
|
* Then as we can't guarantee that max != min, we are forced to set |
180 |
|
* the other one according to the first value. We can't use the first |
181 |
|
* formula with s/max/min/ |
182 |
|
*/ |
183 |
|
m = (M==high)?low:high; |
184 |
|
|
185 |
/* |
/* |
186 |
* Ok now we know everything we have to know to distribute those funny |
* Ok now we know everything we have to know to distribute those funny |
187 |
* quantizers. What about just doing it ? |
* quantizers. What about just doing it ? |
195 |
int j; |
int j; |
196 |
|
|
197 |
/* Repeat q+1 times the M quantizer */ |
/* Repeat q+1 times the M quantizer */ |
198 |
for(j=0; j<(q+1); j++) *(dist++) = (max==nhigh)?high:low; |
for(j=0; j<(q+1); j++) *(dist++) = M; |
199 |
|
|
200 |
/* Put a m quantizer */ |
/* Put a m quantizer */ |
201 |
*(dist++) = (min==nhigh)?high:low; |
*(dist++) = m; |
202 |
|
|
203 |
} |
} |
204 |
|
|
208 |
int j; |
int j; |
209 |
|
|
210 |
/* Repeat q times the M quantizer */ |
/* Repeat q times the M quantizer */ |
211 |
for(j=0; j<q; j++) *(dist++) = (max==nhigh)?high:low; |
for(j=0; j<q; j++) *(dist++) = M; |
212 |
|
|
213 |
/* Put a m quantizer */ |
/* Put a m quantizer */ |
214 |
*(dist++) = (min==nhigh)?high:low; |
*(dist++) = m; |
215 |
|
|
216 |
} |
} |
217 |
|
|