comparison mm7_2.cpp @ 1146:b4ade2580ae3

sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
author Grumpy7
date Sun, 02 Jun 2013 03:10:20 +0200
parents 30d02f00ae29
children 9ba9fd8e6d68
comparison
equal deleted inserted replaced
1145:30d02f00ae29 1146:b4ade2580ae3
2182 signed int v118; // eax@220 2182 signed int v118; // eax@220
2183 int v119; // eax@221 2183 int v119; // eax@221
2184 int v120; // eax@223 2184 int v120; // eax@223
2185 unsigned int v121; // ecx@231 2185 unsigned int v121; // ecx@231
2186 char v122; // al@235 2186 char v122; // al@235
2187 unsigned int v124; // [sp+Ch] [bp-7Ch]@12 2187 unsigned int heightRatioPlusOne; // [sp+Ch] [bp-7Ch]@12
2188 unsigned int v132; // [sp+Ch] [bp-7Ch]@218 2188 unsigned int widthRatio; // [sp+Ch] [bp-7Ch]@218
2189 unsigned int v133; // [sp+14h] [bp-74h]@12 2189 unsigned int heightRatio; // [sp+14h] [bp-74h]@12
2190 unsigned int v141; // [sp+14h] [bp-74h]@218 2190 unsigned int widthRatioPlusOne; // [sp+14h] [bp-74h]@218
2191 unsigned int v142; // [sp+1Ch] [bp-6Ch]@12
2192 unsigned int v150; // [sp+1Ch] [bp-6Ch]@218
2193 unsigned int v151; // [sp+24h] [bp-64h]@12
2194 unsigned int v159; // [sp+24h] [bp-64h]@218
2195 int v160; // [sp+3Ch] [bp-4Ch]@13 2191 int v160; // [sp+3Ch] [bp-4Ch]@13
2196 int v161; // [sp+40h] [bp-48h]@15 2192 int v161; // [sp+40h] [bp-48h]@15
2197 int v169; // [sp+44h] [bp-44h]@219 2193 int v169; // [sp+44h] [bp-44h]@219
2198 unsigned __int16 *v175; // [sp+4Ch] [bp-3Ch]@13 2194 unsigned __int16 *v175; // [sp+4Ch] [bp-3Ch]@13
2199 int *v176; // [sp+50h] [bp-38h]@15 2195 int *v176; // [sp+50h] [bp-38h]@15
2213 float a6bi; // [sp+A0h] [bp+18h]@218 2209 float a6bi; // [sp+A0h] [bp+18h]@218
2214 float a6bj; // [sp+A0h] [bp+18h]@218 2210 float a6bj; // [sp+A0h] [bp+18h]@218
2215 unsigned int a6r; // [sp+A0h] [bp+18h]@218 2211 unsigned int a6r; // [sp+A0h] [bp+18h]@218
2216 int dstdiffmult; 2212 int dstdiffmult;
2217 2213
2218 int field0value = 32; 2214 int field0value = this->field_0.field_C;
2219 int field20value = this->field_20.field_C; 2215 int field20value = this->field_20.field_C;
2220 switch(field20value) 2216 switch(field20value)
2221 { 2217 {
2222 case 8: dstdiffmult = dstPitch - dstWidth; 2218 case 8: dstdiffmult = dstPitch - dstWidth;
2223 break; 2219 break;
2227 break; 2223 break;
2228 default: 2224 default:
2229 return field20value; 2225 return field20value;
2230 } 2226 }
2231 2227
2228 assert(srcWidth >= dstWidth);
2229
2232 result = this->field_0.field_C; 2230 result = this->field_0.field_C;
2233 if ( result == 32 || result == 16) 2231 if ( result == 32 || result == 16)
2234 { 2232 {
2235 result = (int)pDst; 2233 result = (int)pDst;
2236 v193 = pDst; 2234 v193 = pDst;
2238 if ( dstHeight <= 0 ) 2236 if ( dstHeight <= 0 )
2239 return result; 2237 return result;
2240 while ( 1 ) 2238 while ( 1 )
2241 { 2239 {
2242 v14 = 0; 2240 v14 = 0;
2243 if ( dstWidth > 0 ) 2241 if ( dstWidth <= 0 )
2244 break; 2242 goto LABEL_30;
2243 do
2244 {
2245 a6s = (double)v14 / (double)dstWidth * (double)srcWidth;
2246 widthRatio = bankersRounding(a6s);
2247 a6t = (double)(v14 + 1) / (double)dstWidth * (double)srcWidth;
2248 widthRatioPlusOne = bankersRounding(a6t);
2249 v17 = (double)v231 / (double)dstHeight * (double)srcHeight;
2250 heightRatio = bankersRounding(v17);
2251 v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight;
2252 heightRatioPlusOne = bankersRounding(v18);
2253 v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio);
2254 v252 = 0;
2255 a6b = 0;
2256 v240 = 0i64;
2257 if ( heightRatio >= heightRatioPlusOne )
2258 goto LABEL_25;
2259 v160 = heightRatioPlusOne - heightRatio;
2260 if(field0value == 32)
2261 v175 = &pSrc[2 * (widthRatio + srcPitch * heightRatio)];
2262 else
2263 v175 = &pSrc[widthRatio + srcPitch * heightRatio];
2264
2265 while ( widthRatio >= widthRatioPlusOne )
2266 {
2267 LABEL_24:
2268 if(field0value == 32)
2269 v175 += 2 * srcPitch;
2270 else
2271 v175 += srcPitch;
2272 --v160;
2273 if ( !v160 )
2274 goto LABEL_25;
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:
2297 v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio));
2298 if ( v19 )
2299 {
2300 a6b /= v19;
2301 v252 /= v19;
2302 HIDWORD(v240) /= v19;
2303 }
2304 if ( v22 != 255 )
2305 v22 &= 0x7FFFFFFFu;
2306 v23 = _450F55(HIDWORD(v240) | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8));
2307 *(_DWORD *)v193 = v23;
2308 switch(field20value)
2309 {
2310 case 8: v193 = (unsigned __int16 *)((char *)v193 + 1);
2311 break;
2312 case 16: ++v193;
2313 break;
2314 case 32: v193 += 2;
2315 break;
2316 default:
2317 assert(false);
2318 return result;
2319 }
2320 ++v14;
2321 }
2322 while ( v14 < dstWidth );
2245 LABEL_30: 2323 LABEL_30:
2246 v193 = (unsigned __int16 *)((char *)v193 + dstdiffmult); 2324 v193 = (unsigned __int16 *)((char *)v193 + dstdiffmult);
2247 ++v231; 2325 ++v231;
2248 result = v231; 2326 result = v231;
2249 if ( v231 >= dstHeight ) 2327 if ( v231 >= dstHeight )
2250 return result; 2328 return result;
2251 } 2329 }
2252 while ( 1 )
2253 {
2254 a6s = (double)v14 / (double)dstWidth * (double)srcWidth;
2255 v151 = bankersRounding(a6s);
2256 a6t = (double)(v14 + 1) / (double)dstWidth * (double)srcWidth;
2257 v142 = bankersRounding(a6t);
2258 v17 = (double)v231 / (double)dstHeight * (double)srcHeight;
2259 v133 = bankersRounding(v17);
2260 v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight;
2261 v124 = bankersRounding(v18);
2262 v19 = (v124 - v133) * (v142 - v151);
2263 v252 = 0;
2264 a6b = 0;
2265 v240 = 0i64;
2266 if ( v133 < v124 )
2267 break;
2268 LABEL_25:
2269 v22 = (unsigned int)v240 / ((v124 - v133) * (v142 - v151));
2270 if ( v19 )
2271 {
2272 a6b /= v19;
2273 v252 /= v19;
2274 HIDWORD(v240) /= v19;
2275 }
2276 if ( v22 != 255 )
2277 v22 &= 0x7FFFFFFFu;
2278 v23 = _450F55(HIDWORD(v240) | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8));
2279 *(_DWORD *)v193 = v23;
2280 switch(field20value)
2281 {
2282 case 8: v193 = (unsigned __int16 *)((char *)v193 + 1);
2283 break;
2284 case 16: ++v193;
2285 break;
2286 case 32: v193 += 2;
2287 break;
2288 default:
2289 assert(false);
2290 return result;
2291 }
2292 ++v14;
2293 if ( v14 >= dstWidth )
2294 goto LABEL_30;
2295 }
2296 v160 = v124 - v133;
2297 if(field0value == 32)
2298 v175 = &pSrc[2 * (v151 + srcPitch * v133)];
2299 else
2300 v175 = &pSrc[v151 + srcPitch * v133];
2301
2302 while ( v151 >= v142 )
2303 {
2304 LABEL_24:
2305 if(field0value == 32)
2306 v175 += 2 * srcPitch;
2307 else
2308 v175 += srcPitch;
2309 --v160;
2310 if ( !v160 )
2311 goto LABEL_25;
2312 }
2313 v176 = (int *)v175;
2314 v161 = v142 - v151;
2315 while ( 1 )
2316 {
2317 if(field0value == 32)
2318 v21 = _450FB1(*v176);
2319 else
2320 v21 = _450FB1(*(_WORD *)v176);
2321 break;
2322 LABEL_23:
2323 if(field0value == 32)
2324 ++v176;
2325 else
2326 v176 = (int *)((char *)v176 + 2);
2327 --v161;
2328 if ( !v161 )
2329 goto LABEL_24;
2330 }
2331 LODWORD(v240) = ((unsigned int)v21 >> 24) + v240;
2332 a6b += BYTE2(v21);
2333 v252 += BYTE1(v21);
2334 HIDWORD(v240) += (unsigned __int8)v21;
2335 goto LABEL_23;
2336 } 2330 }
2337 2331
2338 else if ( result == 8 ) 2332 else if ( result == 8 )
2339 { 2333 {
2340 result = (int)pDst; 2334 result = (int)pDst;
2348 if ( dstWidth <= 0 ) 2342 if ( dstWidth <= 0 )
2349 goto LABEL_236; 2343 goto LABEL_236;
2350 do 2344 do
2351 { 2345 {
2352 a6bi = (double)v112 / (double)dstWidth * (double)srcWidth; 2346 a6bi = (double)v112 / (double)dstWidth * (double)srcWidth;
2353 v132 = bankersRounding(a6bi); 2347 widthRatio = bankersRounding(a6bi);
2354 a6bj = (double)(v112 + 1) / (double)dstWidth * (double)srcWidth; 2348 a6bj = (double)(v112 + 1) / (double)dstWidth * (double)srcWidth;
2355 v141 = bankersRounding(a6bj); 2349 widthRatioPlusOne = bankersRounding(a6bj);
2356 v115 = (double)v239 / (double)dstHeight * (double)srcHeight; 2350 v115 = (double)v239 / (double)dstHeight * (double)srcHeight;
2357 v150 = bankersRounding(v115); 2351 heightRatio = bankersRounding(v115);
2358 v116 = (double)(v239 + 1) / (double)dstHeight * (double)srcHeight; 2352 v116 = (double)(v239 + 1) / (double)dstHeight * (double)srcHeight;
2359 v159 = bankersRounding(v116); 2353 heightRatioPlusOne = bankersRounding(v116);
2360 v251 = 0; 2354 v251 = 0;
2361 v117 = (v159 - v150) * (v141 - v132); 2355 v117 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio);
2362 v260 = 0; 2356 v260 = 0;
2363 a6r = 0; 2357 a6r = 0;
2364 v248 = 0; 2358 v248 = 0;
2365 if ( v150 >= v159 ) 2359 if ( heightRatio >= heightRatioPlusOne )
2366 goto LABEL_231; 2360 goto LABEL_231;
2367 v169 = v159 - v150; 2361 v169 = heightRatioPlusOne - heightRatio;
2368 v184 = (char *)pSrc + srcPitch * v150; 2362 v184 = (char *)pSrc + srcPitch * heightRatio;
2369 do 2363 do
2370 { 2364 {
2371 v118 = v132; 2365 v118 = widthRatio;
2372 while ( v118 < v141 ) 2366 while ( v118 < widthRatioPlusOne )
2373 { 2367 {
2374 v119 = (unsigned __int8)v184[v118]; 2368 v119 = (unsigned __int8)v184[v118];
2375 v120 = _450FB1(v119); 2369 v120 = _450FB1(v119);
2376 v248 += (unsigned int)v120 >> 24; 2370 v248 += (unsigned int)v120 >> 24;
2377 a6r += BYTE2(v120); 2371 a6r += BYTE2(v120);
2382 v184 += srcPitch; 2376 v184 += srcPitch;
2383 --v169; 2377 --v169;
2384 } 2378 }
2385 while ( v169 ); 2379 while ( v169 );
2386 LABEL_231: 2380 LABEL_231:
2387 v121 = v248 / ((v159 - v150) * (v141 - v132)); 2381 v121 = v248 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio));
2388 if ( v117 ) 2382 if ( v117 )
2389 { 2383 {
2390 a6r /= v117; 2384 a6r /= v117;
2391 v260 /= v117; 2385 v260 /= v117;
2392 v251 /= v117; 2386 v251 /= v117;