Mercurial > mm7
comparison mm7_2.cpp @ 1147:9ba9fd8e6d68
sub_451007_scale_image_bicubic cleanup - some more code shuffling
author | Grumpy7 |
---|---|
date | Sun, 02 Jun 2013 03:59:13 +0200 |
parents | b4ade2580ae3 |
children | ee6bccef32e8 |
comparison
equal
deleted
inserted
replaced
1146:b4ade2580ae3 | 1147:9ba9fd8e6d68 |
---|---|
2222 case 32: dstdiffmult = 4 * (dstPitch - dstWidth); | 2222 case 32: dstdiffmult = 4 * (dstPitch - dstWidth); |
2223 break; | 2223 break; |
2224 default: | 2224 default: |
2225 return field20value; | 2225 return field20value; |
2226 } | 2226 } |
2227 | 2227 |
2228 assert(srcWidth >= dstWidth); | |
2229 | |
2230 result = this->field_0.field_C; | 2228 result = this->field_0.field_C; |
2231 if ( result == 32 || result == 16) | 2229 if ( result == 32 || result == 16) |
2232 { | 2230 { |
2233 result = (int)pDst; | 2231 result = (int)pDst; |
2234 v193 = pDst; | 2232 v193 = pDst; |
2248 widthRatioPlusOne = bankersRounding(a6t); | 2246 widthRatioPlusOne = bankersRounding(a6t); |
2249 v17 = (double)v231 / (double)dstHeight * (double)srcHeight; | 2247 v17 = (double)v231 / (double)dstHeight * (double)srcHeight; |
2250 heightRatio = bankersRounding(v17); | 2248 heightRatio = bankersRounding(v17); |
2251 v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; | 2249 v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; |
2252 heightRatioPlusOne = bankersRounding(v18); | 2250 heightRatioPlusOne = bankersRounding(v18); |
2251 v251 = 0; | |
2253 v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); | 2252 v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); |
2254 v252 = 0; | 2253 v252 = 0; |
2255 a6b = 0; | 2254 a6b = 0; |
2256 v240 = 0i64; | 2255 v240 = 0i64; |
2257 if ( heightRatio >= heightRatioPlusOne ) | 2256 if ( heightRatio >= heightRatioPlusOne ) |
2260 if(field0value == 32) | 2259 if(field0value == 32) |
2261 v175 = &pSrc[2 * (widthRatio + srcPitch * heightRatio)]; | 2260 v175 = &pSrc[2 * (widthRatio + srcPitch * heightRatio)]; |
2262 else | 2261 else |
2263 v175 = &pSrc[widthRatio + srcPitch * heightRatio]; | 2262 v175 = &pSrc[widthRatio + srcPitch * heightRatio]; |
2264 | 2263 |
2265 while ( widthRatio >= widthRatioPlusOne ) | 2264 do |
2266 { | 2265 { |
2267 LABEL_24: | 2266 int ratioDiff = widthRatioPlusOne - widthRatio; |
2267 for(int i = 0; i < ratioDiff; i++) | |
2268 { | |
2269 if(field0value == 32) | |
2270 v21 = _450FB1((int)v175[i]); | |
2271 else | |
2272 v21 = _450FB1((_WORD)v175[i]); | |
2273 v240 += ((unsigned int)v21 >> 24); | |
2274 a6b += BYTE2(v21); | |
2275 v252 += BYTE1(v21); | |
2276 v251 += (unsigned __int8)v21; | |
2277 } | |
2268 if(field0value == 32) | 2278 if(field0value == 32) |
2269 v175 += 2 * srcPitch; | 2279 v175 += 2 * srcPitch; |
2270 else | 2280 else |
2271 v175 += srcPitch; | 2281 v175 += srcPitch; |
2272 --v160; | 2282 --v160; |
2273 if ( !v160 ) | 2283 } |
2274 goto LABEL_25; | 2284 while ( v160 ); |
2275 } | |
2276 v176 = (int *)v175; | |
2277 v161 = widthRatioPlusOne - widthRatio; | |
2278 while ( 1 ) | |
2279 { | |
2280 if(field0value == 32) | |
2281 v21 = _450FB1(*v176); | |
2282 else | |
2283 v21 = _450FB1(*(_WORD *)v176); | |
2284 LODWORD(v240) = ((unsigned int)v21 >> 24) + v240; | |
2285 a6b += BYTE2(v21); | |
2286 v252 += BYTE1(v21); | |
2287 HIDWORD(v240) += (unsigned __int8)v21; | |
2288 if(field0value == 32) | |
2289 ++v176; | |
2290 else | |
2291 v176 = (int *)((char *)v176 + 2); | |
2292 --v161; | |
2293 if ( !v161 ) | |
2294 goto LABEL_24; | |
2295 } | |
2296 LABEL_25: | 2285 LABEL_25: |
2297 v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); | 2286 v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); |
2298 if ( v19 ) | 2287 if ( v19 ) |
2299 { | 2288 { |
2300 a6b /= v19; | 2289 a6b /= v19; |
2301 v252 /= v19; | 2290 v252 /= v19; |
2302 HIDWORD(v240) /= v19; | 2291 v251 /= v19; |
2303 } | 2292 } |
2304 if ( v22 != 255 ) | 2293 if ( v22 != 255 ) |
2305 v22 &= 0x7FFFFFFFu; | 2294 v22 &= 0x7FFFFFFFu; |
2306 v23 = _450F55(HIDWORD(v240) | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); | 2295 v23 = _450F55(v251 | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); |
2307 *(_DWORD *)v193 = v23; | 2296 *(_DWORD *)v193 = v23; |
2308 switch(field20value) | 2297 switch(field20value) |
2309 { | 2298 { |
2310 case 8: v193 = (unsigned __int16 *)((char *)v193 + 1); | 2299 case 8: v193 = (unsigned __int16 *)((char *)v193 + 1); |
2311 break; | 2300 break; |
2357 a6r = 0; | 2346 a6r = 0; |
2358 v248 = 0; | 2347 v248 = 0; |
2359 if ( heightRatio >= heightRatioPlusOne ) | 2348 if ( heightRatio >= heightRatioPlusOne ) |
2360 goto LABEL_231; | 2349 goto LABEL_231; |
2361 v169 = heightRatioPlusOne - heightRatio; | 2350 v169 = heightRatioPlusOne - heightRatio; |
2362 v184 = (char *)pSrc + srcPitch * heightRatio; | 2351 v184 = (char *)pSrc + widthRatio + srcPitch * heightRatio; |
2363 do | 2352 do |
2364 { | 2353 { |
2365 v118 = widthRatio; | 2354 int ratioDiff = widthRatioPlusOne - widthRatio; |
2366 while ( v118 < widthRatioPlusOne ) | 2355 for(int i = 0; i < ratioDiff; i++) |
2367 { | 2356 { |
2368 v119 = (unsigned __int8)v184[v118]; | 2357 v120 = _450FB1((unsigned __int8)v184[i]); |
2369 v120 = _450FB1(v119); | |
2370 v248 += (unsigned int)v120 >> 24; | 2358 v248 += (unsigned int)v120 >> 24; |
2371 a6r += BYTE2(v120); | 2359 a6r += BYTE2(v120); |
2372 v260 += BYTE1(v120); | 2360 v260 += BYTE1(v120); |
2373 v251 += (unsigned __int8)v120; | 2361 v251 += (unsigned __int8)v120; |
2374 ++v118; | |
2375 } | 2362 } |
2376 v184 += srcPitch; | 2363 v184 += srcPitch; |
2377 --v169; | 2364 --v169; |
2378 } | 2365 } |
2379 while ( v169 ); | 2366 while ( v169 );; |
2380 LABEL_231: | 2367 LABEL_231: |
2381 v121 = v248 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); | 2368 v121 = v248 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); |
2382 if ( v117 ) | 2369 if ( v117 ) |
2383 { | 2370 { |
2384 a6r /= v117; | 2371 a6r /= v117; |