Mercurial > mm7
comparison mm7_2.cpp @ 1149:05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
author | Grumpy7 |
---|---|
date | Sun, 02 Jun 2013 05:22:35 +0200 |
parents | ee6bccef32e8 |
children | 354ec6263123 |
comparison
equal
deleted
inserted
replaced
1148:ee6bccef32e8 | 1149:05b30ed00d7c |
---|---|
2166 int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, //changing this to some library function might be a good idea | 2166 int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, //changing this to some library function might be a good idea |
2167 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, | 2167 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, |
2168 int a10, int a11) | 2168 int a10, int a11) |
2169 { | 2169 { |
2170 int result; // eax@1 | 2170 int result; // eax@1 |
2171 int v14; // ecx@10 | |
2172 float v17; // ST3C_4@12 | 2171 float v17; // ST3C_4@12 |
2173 float v18; // ST38_4@12 | 2172 float v18; // ST38_4@12 |
2174 unsigned int v19; // esi@12 | 2173 unsigned int v19; // esi@12 |
2175 int v21; // eax@18 | 2174 int v21; // eax@18 |
2176 unsigned int v22; // ecx@25 | 2175 unsigned int v22; // ecx@25 |
2222 v231 = 0; | 2221 v231 = 0; |
2223 if ( dstHeight <= 0 ) | 2222 if ( dstHeight <= 0 ) |
2224 return result; | 2223 return result; |
2225 do | 2224 do |
2226 { | 2225 { |
2227 v14 = 0; | 2226 for (int counter = 0; counter < dstWidth; counter++) |
2228 if ( dstWidth > 0 ) | 2227 { |
2229 { | 2228 a6s = (double)counter / (double)dstWidth * (double)srcWidth; |
2230 do | 2229 widthRatio = bankersRounding(a6s); |
2231 { | 2230 a6t = (double)(counter + 1) / (double)dstWidth * (double)srcWidth; |
2232 a6s = (double)v14 / (double)dstWidth * (double)srcWidth; | 2231 widthRatioPlusOne = bankersRounding(a6t); |
2233 widthRatio = bankersRounding(a6s); | 2232 v17 = (double)v231 / (double)dstHeight * (double)srcHeight; |
2234 a6t = (double)(v14 + 1) / (double)dstWidth * (double)srcWidth; | 2233 heightRatio = bankersRounding(v17); |
2235 widthRatioPlusOne = bankersRounding(a6t); | 2234 v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; |
2236 v17 = (double)v231 / (double)dstHeight * (double)srcHeight; | 2235 heightRatioPlusOne = bankersRounding(v18); |
2237 heightRatio = bankersRounding(v17); | 2236 v251 = 0; |
2238 v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; | 2237 v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); |
2239 heightRatioPlusOne = bankersRounding(v18); | 2238 v252 = 0; |
2240 v251 = 0; | 2239 a6b = 0; |
2241 v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); | 2240 v240 = 0i64; |
2242 v252 = 0; | 2241 |
2243 a6b = 0; | 2242 v175 = (unsigned short*)((char *)pSrc + field_0_bits * (widthRatio + srcPitch * heightRatio)); |
2244 v240 = 0i64; | 2243 for (int heightDiff = 0; heightDiff < heightRatioPlusOne - heightRatio; heightDiff++) |
2245 if ( heightRatio < heightRatioPlusOne ) | 2244 { |
2246 { | 2245 int ratioDiff = widthRatioPlusOne - widthRatio; |
2247 v160 = heightRatioPlusOne - heightRatio; | 2246 for(int i = 0; i < ratioDiff; i++) |
2248 v175 = (unsigned short*)((char *)pSrc + field_0_bits * (widthRatio + srcPitch * heightRatio)); | 2247 { |
2249 do | 2248 if(field0value == 32) |
2250 { | 2249 v21 = _450FB1((int)v175[i]); |
2251 int ratioDiff = widthRatioPlusOne - widthRatio; | 2250 else if(field0value == 16) |
2252 for(int i = 0; i < ratioDiff; i++) | 2251 v21 = _450FB1((_WORD)v175[i]); |
2253 { | 2252 else |
2254 if(field0value == 32) | 2253 v21 = _450FB1((unsigned __int8)v175[i]); |
2255 v21 = _450FB1((int)v175[i]); | 2254 v240 += ((unsigned int)v21 >> 24); |
2256 else if(field0value == 16) | 2255 a6b += BYTE2(v21); |
2257 v21 = _450FB1((_WORD)v175[i]); | 2256 v252 += BYTE1(v21); |
2258 else | 2257 v251 += (unsigned __int8)v21; |
2259 v21 = _450FB1((unsigned __int8)v175[i]); | 2258 } |
2260 v240 += ((unsigned int)v21 >> 24); | 2259 if(field0value == 32) |
2261 a6b += BYTE2(v21); | 2260 v175 += 2 * srcPitch; |
2262 v252 += BYTE1(v21); | 2261 else if(field0value == 16) |
2263 v251 += (unsigned __int8)v21; | 2262 v175 += srcPitch; |
2264 } | 2263 else |
2265 if(field0value == 32) | 2264 v175 = (unsigned short*)((char *)v175 + 2 * srcPitch); |
2266 v175 += 2 * srcPitch; | 2265 } |
2267 else if(field0value == 16) | 2266 v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); |
2268 v175 += srcPitch; | 2267 assert(v19 < 2); |
2269 else | 2268 if ( v19 ) |
2270 v175 = (unsigned short*)((char *)v175 + 2 * srcPitch); | 2269 { |
2271 --v160; | 2270 a6b /= v19; |
2272 } | 2271 v252 /= v19; |
2273 while ( v160 ); | 2272 v251 /= v19; |
2274 } | 2273 } |
2275 v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); | 2274 if ( v22 != 255 ) |
2276 if ( v19 ) | 2275 v22 &= 0x7FFFFFFFu; |
2277 { | 2276 v23 = _450F55(v251 | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); |
2278 a6b /= v19; | 2277 *(_DWORD *)v193 = v23; |
2279 v252 /= v19; | 2278 v193 = (unsigned __int16 *)((char *)v193 + field_20_bits); |
2280 v251 /= v19; | |
2281 } | |
2282 if ( v22 != 255 ) | |
2283 v22 &= 0x7FFFFFFFu; | |
2284 v23 = _450F55(v251 | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); | |
2285 *(_DWORD *)v193 = v23; | |
2286 v193 = (unsigned __int16 *)((char *)v193 + field_20_bits); | |
2287 ++v14; | |
2288 } | |
2289 while ( v14 < dstWidth ); | |
2290 } | 2279 } |
2291 v193 = (unsigned __int16 *)((char *)v193 + field_20_bits * (dstPitch - dstWidth)); | 2280 v193 = (unsigned __int16 *)((char *)v193 + field_20_bits * (dstPitch - dstWidth)); |
2292 ++v231; | 2281 ++v231; |
2293 result = v231; | 2282 result = v231; |
2294 } | 2283 } |