comparison alt_audio_convert.c @ 403:b1e511c879d1

More altcvt updates and fixes from Frank.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 13 Jul 2002 23:41:08 +0000
parents 44ed8bdeba74
children 5b8a07b5162e
comparison
equal deleted inserted replaced
402:7ced6c44b827 403:b1e511c879d1
48 #define IS_8BIT(x) ((x).format & 0x0008) 48 #define IS_8BIT(x) ((x).format & 0x0008)
49 #define IS_16BIT(x) ((x).format & 0x0010) 49 #define IS_16BIT(x) ((x).format & 0x0010)
50 #define IS_FLOAT(x) ((x).format & 0x0020) 50 #define IS_FLOAT(x) ((x).format & 0x0020)
51 #define IS_SIGNED(x) ((x).format & 0x8000) 51 #define IS_SIGNED(x) ((x).format & 0x8000)
52 #define IS_SYSENDIAN(x) ((~AUDIO_U16SYS ^ (x).format) & 0x1000) 52 #define IS_SYSENDIAN(x) ((~AUDIO_U16SYS ^ (x).format) & 0x1000)
53 #define SDL_MSB_POSITION_IN_SHORT ((0x1000 & AUDIO_U16SYS)>>12)
53 54
54 55
55 /*-------------------------------------------------------------------------*/ 56 /*-------------------------------------------------------------------------*/
56 /* the purpose of the RateConverterBuffer is to provide a continous storage 57 /* the purpose of the RateConverterBuffer is to provide a continous storage
57 for head and tail of the (sample)-buffer. This allows a simple and 58 for head and tail of the (sample)-buffer. This allows a simple and
98 99
99 typedef struct 100 typedef struct
100 { 101 {
101 Sint16 inbuffer[24*_fsize]; 102 Sint16 inbuffer[24*_fsize];
102 Sint16 *finp, *cinp, *linp; 103 Sint16 *finp, *cinp, *linp;
104 int flength, clength, llength;
103 Sint16 *buffer; 105 Sint16 *buffer;
104 int flength, clength, llength; 106 VarFilter *filter;
105 } RateConverterBuffer; 107 } RateConverterBuffer;
108
109 typedef struct
110 {
111 Sint16 carry;
112 Sint16 pos;
113 } RateAux;
106 114
107 115
108 /* Mono (1 channel ) */ 116 /* Mono (1 channel ) */
109 #define Suffix(x) x##1 117 #define Suffix(x) x##1
110 #include "filter_templates.h" 118 #include "filter_templates.h"
123 AdapterC Temp; 131 AdapterC Temp;
124 int i; 132 int i;
125 133
126 /* Make sure there's a converter */ 134 /* Make sure there's a converter */
127 if( Data == NULL ) { 135 if( Data == NULL ) {
128 SDL_SetError("No converter given"); 136 SDL_SetError("altcvt: No converter given");
129 return(-1); 137 return(-1);
130 } 138 }
131 139
132 /* Make sure there's data to convert */ 140 /* Make sure there's data to convert */
133 if( buffer == NULL ) { 141 if( buffer == NULL ) {
134 SDL_SetError("No buffer allocated for conversion"); 142 SDL_SetError("altcvt: No buffer allocated for conversion");
143 return(-1);
144 }
145
146 if( length < 0 ) {
147 SDL_SetError("altcvt: Length < 0");
135 return(-1); 148 return(-1);
136 } 149 }
137 150
138 /* Set up the conversion and go! */ 151 /* Set up the conversion and go! */
139 Temp.buffer = buffer; 152 Temp.buffer = buffer;
148 161
149 int Sound_ConvertAudio( Sound_AudioCVT *Data ) 162 int Sound_ConvertAudio( Sound_AudioCVT *Data )
150 { 163 {
151 int length; 164 int length;
152 /* !!! FIXME: Try the looping stuff under certain circumstances? --ryan. */ 165 /* !!! FIXME: Try the looping stuff under certain circumstances? --ryan. */
153 length = ConvertAudio( Data, Data->buf, Data->len, 12 ); 166 length = ConvertAudio( Data, Data->buf, Data->len, 0 );
154 Data->len_cvt = length; 167 Data->len_cvt = length;
155 return length; 168 return length;
156 } 169 }
157 170
158
159 /*-------------------------------------------------------------------------*/ 171 /*-------------------------------------------------------------------------*/
160 static int expand8BitTo16BitSys( AdapterC Data, int length ) 172 static int expand8BitTo16BitSys( AdapterC Data, int length )
161 { 173 {
162 /* !!! Fixme: get rid of <<8 through pointer manipulation --frank */ 174 int i;
163 int i; 175 Uint8* inp = Data.buffer - 1;
164 Uint8* inp = Data.buffer; 176 Uint16* buffer = (Uint16*)Data.buffer - 1;
165 Uint16* buffer = (Uint16*)Data.buffer; 177 for( i = length + 1; --i; )
166 for( i = length - 1; i >= 0; i-- )
167 buffer[i] = inp[i]<<8; 178 buffer[i] = inp[i]<<8;
168 return 2*length; 179 return 2*length;
169 } 180 }
170 181
171 static int expand8BitTo16BitWrong( AdapterC Data, int length ) 182 static int expand8BitTo16BitWrong( AdapterC Data, int length )
172 { 183 {
173 int i; 184 int i;
174 Uint8* inp = Data.buffer; 185 Uint8* inp = Data.buffer - 1;
175 Uint16* buffer = (Uint16*)Data.buffer; 186 Uint16* buffer = (Uint16*)Data.buffer - 1;
176 for( i = length - 1; i >= 0; i--) 187 for( i = length + 1; --i; )
177 buffer[i] = inp[i]; 188 buffer[i] = inp[i];
178 return 2*length; 189 return 2*length;
179 } 190 }
180 191
181 /*-------------------------------------------------------------------------*/ 192 /*-------------------------------------------------------------------------*/
182 static int expand16BitToFloat( AdapterC Data, int length ) 193 static int expand16BitToFloat( AdapterC Data, int length )
183 { 194 {
184 int i; 195 int i;
185 Sint16* inp = (Sint16*)Data.buffer; 196 Sint16* inp = (Sint16*)Data.buffer - 1;
186 float* buffer = (float*)Data.buffer; 197 float* buffer = (float*)Data.buffer - 1;
187 for( i = length>>1 - 1; i >= 0; i-- ) 198 for( i = length>>1 + 1; --i; )
188 buffer[i] = inp[i]*(1./32767); 199 buffer[i] = inp[i]*(1./32767);
189 return 2*length; 200 return 2*length;
190 } 201 }
191 202
192 /*-------------------------------------------------------------------------*/ 203 /*-------------------------------------------------------------------------*/
200 * - Frank 211 * - Frank
201 */ 212 */
202 213
203 int i; 214 int i;
204 Uint16 a,b; 215 Uint16 a,b;
205 Uint16* buffer = (Uint16*) Data.buffer; 216 Uint16* buffer = (Uint16*) Data.buffer - 1;
206 for( i = length>>1; i >= 0; i-- ) 217 for( i = length>>1 + 1; --i; )
207 { 218 {
208 a = b = buffer[i]; 219 a = b = buffer[i];
209 buffer[i] = ( a << 8 ) | ( b >> 8 ); 220 buffer[i] = ( a << 8 ) | ( b >> 8 );
210 } 221 }
211 return length; 222 return length;
229 } 240 }
230 return 2*length; 241 return 2*length;
231 } 242 }
232 243
233 /*-------------------------------------------------------------------------*/ 244 /*-------------------------------------------------------------------------*/
234 static int cut16BitSysTo8Bit( AdapterC Data, int length ) 245 static int cut16BitTo8Bit( AdapterC Data, int length, int off )
235 { 246 {
236 int i; 247 int i;
237 Uint16* inp = (Uint16*) Data.buffer; 248 Uint8* inp = Data.buffer + off;
238 Uint8* buffer = Data.buffer;
239 length >>= 1;
240 /* !!! FIXME: Get rid of the >>8 */
241 for( i = 0; i < length; i++ )
242 buffer[i] = inp[i]>>8;
243 return length;
244 }
245
246 static int cut16BitWrongTo8Bit( AdapterC Data, int length )
247 {
248 int i;
249 Uint16* inp = (Uint16*) Data.buffer;
250 Uint8* buffer = Data.buffer; 249 Uint8* buffer = Data.buffer;
251 length >>= 1; 250 length >>= 1;
252 for( i = 0; i < length; i++ ) 251 for( i = 0; i < length; i++ )
253 buffer[i] = inp[i]; 252 buffer[i] = inp[2*i];
254 return length; 253 return length;
254 }
255
256 static int cut16BitSysTo8Bit( AdapterC Data, int length )
257 {
258 return cut16BitTo8Bit( Data, length, SDL_MSB_POSITION_IN_SHORT );
259 }
260
261 static int cut16BitWrongTo8Bit( AdapterC Data, int length )
262 {
263 return cut16BitTo8Bit( Data, length, 1-SDL_MSB_POSITION_IN_SHORT );
255 } 264 }
256 265
257 /*-------------------------------------------------------------------------*/ 266 /*-------------------------------------------------------------------------*/
258 /* poor mans mmx :-) */ 267 /* poor mans mmx :-) */
259 static int changeSigned( AdapterC Data, int length, Uint32 XOR ) 268 static int changeSigned( AdapterC Data, int length, Uint32 XOR )
260 { 269 {
261 int i; 270 int i;
262 Uint32* buffer = (Uint32*) Data.buffer; 271 Uint32* buffer = (Uint32*) Data.buffer - 1;
263 for( i = ( length - 1 ) >> 2; i >= 0; i-- ) 272 for( i = ( length + 7 ) >> 2; --i; )
264 buffer[i] ^= XOR; 273 buffer[i] ^= XOR;
265 return length; 274 return length;
266 } 275 }
267 276
268 static int changeSigned16BitSys( AdapterC Data, int length ) 277 static int changeSigned16BitSys( AdapterC Data, int length )
327 336
328 /*-------------------------------------------------------------------------*/ 337 /*-------------------------------------------------------------------------*/
329 static int convertMonoToStereo16Bit( AdapterC Data, int length ) 338 static int convertMonoToStereo16Bit( AdapterC Data, int length )
330 { 339 {
331 int i; 340 int i;
332 Uint16* buffer = (Uint16*) Data.buffer; 341 Uint16* buffer = (Uint16*)Data.buffer - 1;
333 Uint16* dst = (Uint16*)Data.buffer + length - 2; 342 Uint16* dst = (Uint16*)Data.buffer + length - 2;
334 for( i = length>>1 - 1; i >= 0; i--, dst-=2 ) 343 for( i = length>>1 + 1; --i; dst-=2 )
335 dst[0] = dst[1] = buffer[i]; 344 dst[0] = dst[1] = buffer[i];
336 return 2*length; 345 return 2*length;
337 } 346 }
338 347
339 static int convertMonoToStereo8Bit( AdapterC Data, int length ) 348 static int convertMonoToStereo8Bit( AdapterC Data, int length )
340 { 349 {
341 int i; 350 int i;
342 Uint8* buffer = Data.buffer; 351 Uint8* buffer = Data.buffer - 1;
343 Uint8* dst = (Uint8*)Data.buffer + length - 2; 352 Uint8* dst = Data.buffer + length - 2;
344 for( i = length - 1; i >= 0; i--, dst-=2 ) 353 for( i = length + 1; --i; dst-=2 )
345 dst[0] = dst[1] = buffer[i]; 354 dst[0] = dst[1] = buffer[i];
346 return 2*length; 355 return 2*length;
347 } 356 }
348 357
349 /*-------------------------------------------------------------------------*/ 358 /*-------------------------------------------------------------------------*/
350 static int minus5dB( AdapterC Data, int length ) 359 static int minus5dB( AdapterC Data, int length )
351 { 360 {
352 int i; 361 int i;
353 Sint16* buffer = (Sint16*) Data.buffer; 362 Sint16* buffer = (Sint16*) Data.buffer;
354 for(i = length>>1 - 1; i >= 0; i-- ) 363 for(i = length>>1 + 1; --i; )
355 buffer[i]= (38084 * (int)buffer[i]) >> 16; 364 buffer[i] = (38084 * (int)buffer[i]) >> 16;
356 return length; 365 return length;
357 } 366 }
358 367
359 /*-------------------------------------------------------------------------*/ 368 /*-------------------------------------------------------------------------*/
360 enum RateConverterType{
361 dcrsRate = -1,
362 incrsRate = 0,
363 hlfRate = 1,
364 dblRate = 2
365 };
366
367
368 const Fraction Half = {1, 2}; 369 const Fraction Half = {1, 2};
369 const Fraction Double = {2, 1}; 370 const Fraction Double = {2, 1};
370 371
371 static void initStraigthBuffer( RateConverterBuffer *rcb, 372 static void initStraigthBuffer( RateConverterBuffer *rcb,
372 int length, Fraction r, int dir ) 373 int length, Fraction r, int dir )
425 rcb->buffer += r.numerator * ( length + 2 * size ) 426 rcb->buffer += r.numerator * ( length + 2 * size )
426 / r.denominator; 427 / r.denominator;
427 } 428 }
428 429
429 static void initRateConverterBuffer( RateConverterBuffer *rcb, 430 static void initRateConverterBuffer( RateConverterBuffer *rcb,
430 AdapterC* Data, int length, enum RateConverterType typ ) 431 AdapterC* Data, int length, Fraction ratio )
431 { 432 {
432 int size, minsize, dir; 433 int dir;
433 Fraction Ratio[] = { {0,0}, {2,1}, {1,2} }; 434 dir = ratio.numerator < ratio.denominator ? 1 : 0;
434
435 Ratio[incrsRate] = Data->filter->ratio;
436 dir = ~typ&1;
437 length >>= 1; 435 length >>= 1;
438 rcb->buffer = (Sint16*)( Data->buffer ); 436 rcb->buffer = (Sint16*)( Data->buffer );
437 rcb->filter = Data->filter;
439 438
440 if( Data->mode & SDL_SOUND_Loop ) 439 if( Data->mode & SDL_SOUND_Loop )
441 initLoopBuffer( rcb, length, Ratio[typ], dir ); 440 initLoopBuffer( rcb, length, ratio, dir );
442 else 441 else
443 initStraigthBuffer( rcb, length, Ratio[typ], dir ); 442 initStraigthBuffer( rcb, length, ratio, dir );
444 } 443 }
445 444
446 static void nextRateConverterBuffer( RateConverterBuffer *rcb ) 445 static void nextRateConverterBuffer( RateConverterBuffer *rcb )
447 { 446 {
448 rcb->buffer++; 447 rcb->buffer++;
449 rcb->finp++; 448 rcb->finp++;
450 rcb->cinp++; 449 rcb->cinp++;
451 rcb->linp++; 450 rcb->linp++;
452 } 451 }
453 452
454 typedef Sint16* (*RateConverter)( Sint16*, Sint16*, int, VarFilter*, int*); 453 typedef Sint16* (*RateConverter)( Sint16*, Sint16*, int,
455 static int doRateConversion( RateConverterBuffer* rcb, 454 VarFilter*, RateAux* );
456 RateConverter ffp, VarFilter* filter ) 455
457 { 456 static int doRateConversion( RateConverterBuffer* rcb, RateConverter ffp )
458 int pos = 0; 457 {
459 Sint16 *outp; 458 RateAux aux = {0,0};
460 outp = rcb->buffer; 459 Sint16 *outp = rcb->buffer;
461 460 VarFilter* filter = rcb->filter;
462 outp = (*ffp)( outp, rcb->finp, rcb->flength, filter, &pos ); 461
463 outp = (*ffp)( outp, rcb->cinp, rcb->clength, filter, &pos ); 462 outp = (*ffp)( outp, rcb->finp, rcb->flength, filter, &aux );
464 outp = (*ffp)( outp, rcb->linp, rcb->llength, filter, &pos ); 463 outp = (*ffp)( outp, rcb->cinp, rcb->clength, filter, &aux );
464 outp = (*ffp)( outp, rcb->linp, rcb->llength, filter, &aux );
465 return 2 * abs( rcb->buffer - outp ); 465 return 2 * abs( rcb->buffer - outp );
466 } 466 }
467 467
468 468
469 /*-------------------------------------------------------------------------*/ 469 /*-------------------------------------------------------------------------*/
470 /*
471 * !!! FIXME !!!
472 *
473 * The doubleRate filter is half as large as the halfRate one! Frank
474 */
475
476
477 static int doubleRateMono( AdapterC Data, int length ) 470 static int doubleRateMono( AdapterC Data, int length )
478 { 471 {
479 RateConverterBuffer rcb; 472 RateConverterBuffer rcb;
480 initRateConverterBuffer( &rcb, &Data, length, dblRate ); 473 initRateConverterBuffer( &rcb, &Data, length, Double );
481 return doRateConversion( &rcb, doubleRate1, NULL ); 474 return doRateConversion( &rcb, doubleRate1 );
482 } 475 }
483 476
484 static int doubleRateStereo( AdapterC Data, int length ) 477 static int doubleRateStereo( AdapterC Data, int length )
485 { 478 {
486 RateConverterBuffer rcb; 479 RateConverterBuffer rcb;
487 initRateConverterBuffer( &rcb, &Data, length, dblRate ); 480 initRateConverterBuffer( &rcb, &Data, length, Double );
488 doRateConversion( &rcb, doubleRate2, NULL ); 481 doRateConversion( &rcb, doubleRate2 );
489 nextRateConverterBuffer( &rcb ); 482 nextRateConverterBuffer( &rcb );
490 return 2 + doRateConversion( &rcb, doubleRate2, NULL ); 483 return 2 + doRateConversion( &rcb, doubleRate2 );
491 } 484 }
492 485
493 /*-------------------------------------------------------------------------*/ 486 /*-------------------------------------------------------------------------*/
494 static int halfRateMono( AdapterC Data, int length ) 487 static int halfRateMono( AdapterC Data, int length )
495 { 488 {
496 RateConverterBuffer rcb; 489 RateConverterBuffer rcb;
497 initRateConverterBuffer( &rcb, &Data, length, hlfRate ); 490 initRateConverterBuffer( &rcb, &Data, length, Half );
498 return doRateConversion( &rcb, halfRate1, NULL ); 491 return doRateConversion( &rcb, halfRate1 );
499 } 492 }
500 493
501 static int halfRateStereo( AdapterC Data, int length ) 494 static int halfRateStereo( AdapterC Data, int length )
502 { 495 {
503 RateConverterBuffer rcb; 496 RateConverterBuffer rcb;
504 initRateConverterBuffer( &rcb, &Data, length, hlfRate ); 497 initRateConverterBuffer( &rcb, &Data, length, Half );
505 doRateConversion( &rcb, halfRate2, NULL ); 498 doRateConversion( &rcb, halfRate2 );
506 nextRateConverterBuffer( &rcb ); 499 nextRateConverterBuffer( &rcb );
507 return 2 + doRateConversion( &rcb, halfRate2, NULL ); 500 return 2 + doRateConversion( &rcb, halfRate2 );
508 } 501 }
509 502
510 /*-------------------------------------------------------------------------*/ 503 /*-------------------------------------------------------------------------*/
511 static int increaseRateMono( AdapterC Data, int length ) 504 static int increaseRateMono( AdapterC Data, int length )
512 { 505 {
513 RateConverterBuffer rcb; 506 RateConverterBuffer rcb;
514 initRateConverterBuffer( &rcb, &Data, length, incrsRate ); 507 initRateConverterBuffer( &rcb, &Data, length, Data.filter->ratio );
515 return doRateConversion( &rcb, increaseRate1, Data.filter ); 508 return doRateConversion( &rcb, increaseRate1 );
516 } 509 }
517 510
518 static int increaseRateStereo( AdapterC Data, int length ) 511 static int increaseRateStereo( AdapterC Data, int length )
519 { 512 {
520 RateConverterBuffer rcb; 513 RateConverterBuffer rcb;
521 initRateConverterBuffer( &rcb, &Data, length, incrsRate ); 514 initRateConverterBuffer( &rcb, &Data, length, Data.filter->ratio );
522 doRateConversion( &rcb, increaseRate2, Data.filter ); 515 doRateConversion( &rcb, increaseRate2 );
523 nextRateConverterBuffer( &rcb ); 516 nextRateConverterBuffer( &rcb );
524 return 2 + doRateConversion( &rcb, increaseRate2, Data.filter ); 517 return 2 + doRateConversion( &rcb, increaseRate2 );
525 } 518 }
526 519
527 /*-------------------------------------------------------------------------*/ 520 /*-------------------------------------------------------------------------*/
528 static int decreaseRateMono( AdapterC Data, int length ) 521 static int decreaseRateMono( AdapterC Data, int length )
529 { 522 {
530 RateConverterBuffer rcb; 523 RateConverterBuffer rcb;
531 initRateConverterBuffer( &rcb, &Data, length, dcrsRate ); 524 initRateConverterBuffer( &rcb, &Data, length, Data.filter->ratio );
532 return doRateConversion( &rcb, decreaseRate1, Data.filter ); 525 return doRateConversion( &rcb, decreaseRate1 );
533 } 526 }
534 527
535 static int decreaseRateStereo( AdapterC Data, int length ) 528 static int decreaseRateStereo( AdapterC Data, int length )
536 { 529 {
537 RateConverterBuffer rcb; 530 RateConverterBuffer rcb;
538 initRateConverterBuffer( &rcb, &Data, length, dcrsRate ); 531 initRateConverterBuffer( &rcb, &Data, length, Data.filter->ratio );
539 doRateConversion( &rcb, decreaseRate2, Data.filter ); 532 doRateConversion( &rcb, decreaseRate2 );
540 nextRateConverterBuffer( &rcb ); 533 nextRateConverterBuffer( &rcb );
541 return doRateConversion( &rcb, decreaseRate2, Data.filter ); 534 return 2 + doRateConversion( &rcb, decreaseRate2 );
542 } 535 }
543 536
544 /*-------------------------------------------------------------------------*/ 537 /*-------------------------------------------------------------------------*/
545 static int padSilence( AdapterC Data, int length ) 538 static int padSilence( AdapterC Data, int length )
546 { 539 {
695 const Adapter halfRate[2] = { halfRateMono, halfRateStereo }; 688 const Adapter halfRate[2] = { halfRateMono, halfRateStereo };
696 const Adapter increaseRate[2] = { increaseRateMono, increaseRateStereo }; 689 const Adapter increaseRate[2] = { increaseRateMono, increaseRateStereo };
697 const Adapter decreaseRate[2] = { decreaseRateMono, decreaseRateStereo }; 690 const Adapter decreaseRate[2] = { decreaseRateMono, decreaseRateStereo };
698 691
699 static void createRateConverter( Sound_AudioCVT *Data, int* fip, 692 static void createRateConverter( Sound_AudioCVT *Data, int* fip,
700 int SrcRate, int DestRate, int Channel ) 693 int SrcRate, int DestRate, int channel )
701 { 694 {
702 Fraction f; 695 const int c = channel - 1;
696 const int size = 16 * channel * _fsize;
703 int filter_index = *fip; 697 int filter_index = *fip;
704 int VarPos = 0; 698 int VarPos = 0;
705 float Ratio = DestRate; 699 float Ratio = DestRate;
706 int c = Channel - 1; 700 Fraction f;
707 *fip = -1; 701 *fip = -1;
708 702
709 703
710 if( SrcRate < 1 || SrcRate > 1<<18 || 704 if( SrcRate < 1 || SrcRate > 1<<18 ||
711 DestRate < 1 || DestRate > 1<<18 ) return; 705 DestRate < 1 || DestRate > 1<<18 ) return;
718 712
719 while( Ratio > 64./31.) 713 while( Ratio > 64./31.)
720 { 714 {
721 Ratio /= 2.; 715 Ratio /= 2.;
722 Data->adapter[filter_index++] = doubleRate[c]; 716 Data->adapter[filter_index++] = doubleRate[c];
723 adjustSize( Data, _fsize, Double ); 717 adjustSize( Data, size, Double );
724 } 718 }
725 719
726 while( Ratio < 31./64. ) 720 while( Ratio < 31./64. )
727 { 721 {
728 Ratio *= 2; 722 Ratio *= 2;
729 Data->adapter[filter_index++] = halfRate[c]; 723 Data->adapter[filter_index++] = halfRate[c];
730 adjustSize( Data, _fsize, Half ); 724 adjustSize( Data, size, Half );
731 } 725 }
732 726
733 if( Ratio > 1. ) 727 if( Ratio > 1. )
734 { 728 {
735 Data->adapter[VarPos] = increaseRate[c]; 729 Data->adapter[VarPos] = increaseRate[c];
736 f = setupVarFilter( &Data->filter, Ratio ); 730 f = setupVarFilter( &Data->filter, Ratio );
737 adjustSize( Data, _fsize, f ); 731 adjustSize( Data, size, f );
738 } 732 }
739 else 733 else
740 { 734 {
741 Data->adapter[filter_index++] = decreaseRate[c]; 735 Data->adapter[filter_index++] = decreaseRate[c];
742 f = setupVarFilter( &Data->filter, Ratio ); 736 f = setupVarFilter( &Data->filter, Ratio );
743 adjustSize( Data, _fsize, f ); 737 adjustSize( Data, size, f );
744 } 738 }
745 *fip = filter_index; 739 *fip = filter_index;
746 } 740 }
747 741
748 /*-------------------------------------------------------------------------*/ 742 /*-------------------------------------------------------------------------*/