comparison filter_templates.h @ 373:24a610dfbbfd

More altcvt updates from Frank.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 29 Jun 2002 04:08:17 +0000
parents 1b463ef9bcc2
children 44ed8bdeba74
comparison
equal deleted inserted replaced
372:ee0678efd4a3 373:24a610dfbbfd
68 inp -= CH(1); 68 inp -= CH(1);
69 outp -= CH(2); 69 outp -= CH(2);
70 } 70 }
71 return outp; 71 return outp;
72 } 72 }
73 #undef sum_d
73 74
74 /*-------------------------------------------------------------------------*/ 75 /*-------------------------------------------------------------------------*/
75 #define sum_h(v,dx) ((int) v[CH(dx)] + v[CH(-dx)]) 76 #define sum_h(v,dx) ((int) v[CH(dx)] + v[CH(-dx)])
76 static Sint16* Suffix(halfRate)( Sint16 *outp, Sint16 *inp, int length, 77 static Sint16* Suffix(halfRate)( Sint16 *outp, Sint16 *inp, int length,
77 VarFilter* filt, int* cpos ) 78 VarFilter* filt, int* cpos )
107 inp+= CH(2); 108 inp+= CH(2);
108 outp += CH(1); 109 outp += CH(1);
109 } 110 }
110 return outp; 111 return outp;
111 } 112 }
113 #undef sum_h
112 114
113 /*-------------------------------------------------------------------------*/ 115 /*-------------------------------------------------------------------------*/
114 static Sint16* Suffix(increaseRate)( Sint16 *outp, Sint16 *inp, int length, 116 static Sint16* Suffix(increaseRate)( Sint16 *outp, Sint16 *inp, int length,
115 VarFilter* filter, int* cpos ) 117 VarFilter* filter, int* cpos )
116 { 118 {
126 128
127 while( inp > to ) 129 while( inp > to )
128 { 130 {
129 out = 0; 131 out = 0;
130 f = filter->c[pos]; 132 f = filter->c[pos];
131 for( i = _fsize + 1; --i; inp+=CH(4), f+=4 ) 133 for( i = _fsize + 1; --i; inp+=CH(8), f+=4 )
132 { 134 {
133 out+= f[0] * (int)inp[CH(0)]; 135 out+= f[0] * (int)inp[CH(0)];
134 out+= f[1] * (int)inp[CH(1)]; 136 out+= f[1] * (int)inp[CH(2)];
135 out+= f[2] * (int)inp[CH(2)]; 137 out+= f[2] * (int)inp[CH(4)];
136 out+= f[3] * (int)inp[CH(3)]; 138 out+= f[3] * (int)inp[CH(6)];
137 } 139 }
138 outp[0] = out >> 16; 140 outp[0] = out >> 16;
139 141
140 pos = ( pos + filter->denominator - 1 ) % filter->denominator; 142 pos = ( pos + filter->denominator - 1 ) % filter->denominator;
141 inp -= CH( 4 * _fsize ); 143 inp -= CH( 8 * _fsize );
142 inp -= CH( filter->incr[pos] ); 144 inp -= CH( filter->incr[pos] );
143 outp -= CH(1); 145 outp -= CH(1);
144 } 146 }
145 147
146 *cpos = pos; 148 *cpos = pos;
183 *cpos = pos; 185 *cpos = pos;
184 return outp; 186 return outp;
185 } 187 }
186 188
187 /*-------------------------------------------------------------------------*/ 189 /*-------------------------------------------------------------------------*/
188 #undef sum_d
189 #undef sum_h
190 #undef CH 190 #undef CH
191 #endif /* Suffix */ 191 #endif /* Suffix */
192 192