Mercurial > mm7
changeset 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 |
files | mm7_2.cpp |
diffstat | 1 files changed, 100 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/mm7_2.cpp Sun Jun 02 01:32:18 2013 +0200 +++ b/mm7_2.cpp Sun Jun 02 03:10:20 2013 +0200 @@ -2184,14 +2184,10 @@ int v120; // eax@223 unsigned int v121; // ecx@231 char v122; // al@235 - unsigned int v124; // [sp+Ch] [bp-7Ch]@12 - unsigned int v132; // [sp+Ch] [bp-7Ch]@218 - unsigned int v133; // [sp+14h] [bp-74h]@12 - unsigned int v141; // [sp+14h] [bp-74h]@218 - unsigned int v142; // [sp+1Ch] [bp-6Ch]@12 - unsigned int v150; // [sp+1Ch] [bp-6Ch]@218 - unsigned int v151; // [sp+24h] [bp-64h]@12 - unsigned int v159; // [sp+24h] [bp-64h]@218 + unsigned int heightRatioPlusOne; // [sp+Ch] [bp-7Ch]@12 + unsigned int widthRatio; // [sp+Ch] [bp-7Ch]@218 + unsigned int heightRatio; // [sp+14h] [bp-74h]@12 + unsigned int widthRatioPlusOne; // [sp+14h] [bp-74h]@218 int v160; // [sp+3Ch] [bp-4Ch]@13 int v161; // [sp+40h] [bp-48h]@15 int v169; // [sp+44h] [bp-44h]@219 @@ -2215,7 +2211,7 @@ unsigned int a6r; // [sp+A0h] [bp+18h]@218 int dstdiffmult; - int field0value = 32; + int field0value = this->field_0.field_C; int field20value = this->field_20.field_C; switch(field20value) { @@ -2229,6 +2225,8 @@ return field20value; } + assert(srcWidth >= dstWidth); + result = this->field_0.field_C; if ( result == 32 || result == 16) { @@ -2240,8 +2238,88 @@ while ( 1 ) { v14 = 0; - if ( dstWidth > 0 ) - break; + if ( dstWidth <= 0 ) + goto LABEL_30; + do + { + a6s = (double)v14 / (double)dstWidth * (double)srcWidth; + widthRatio = bankersRounding(a6s); + a6t = (double)(v14 + 1) / (double)dstWidth * (double)srcWidth; + widthRatioPlusOne = bankersRounding(a6t); + v17 = (double)v231 / (double)dstHeight * (double)srcHeight; + heightRatio = bankersRounding(v17); + v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; + heightRatioPlusOne = bankersRounding(v18); + v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); + v252 = 0; + a6b = 0; + v240 = 0i64; + if ( heightRatio >= heightRatioPlusOne ) + goto LABEL_25; + v160 = heightRatioPlusOne - heightRatio; + if(field0value == 32) + v175 = &pSrc[2 * (widthRatio + srcPitch * heightRatio)]; + else + v175 = &pSrc[widthRatio + srcPitch * heightRatio]; + + while ( widthRatio >= widthRatioPlusOne ) + { +LABEL_24: + if(field0value == 32) + v175 += 2 * srcPitch; + else + v175 += srcPitch; + --v160; + if ( !v160 ) + goto LABEL_25; + } + v176 = (int *)v175; + v161 = widthRatioPlusOne - widthRatio; + while ( 1 ) + { + if(field0value == 32) + v21 = _450FB1(*v176); + else + v21 = _450FB1(*(_WORD *)v176); + LODWORD(v240) = ((unsigned int)v21 >> 24) + v240; + a6b += BYTE2(v21); + v252 += BYTE1(v21); + HIDWORD(v240) += (unsigned __int8)v21; + if(field0value == 32) + ++v176; + else + v176 = (int *)((char *)v176 + 2); + --v161; + if ( !v161 ) + goto LABEL_24; + } +LABEL_25: + v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); + if ( v19 ) + { + a6b /= v19; + v252 /= v19; + HIDWORD(v240) /= v19; + } + if ( v22 != 255 ) + v22 &= 0x7FFFFFFFu; + v23 = _450F55(HIDWORD(v240) | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); + *(_DWORD *)v193 = v23; + switch(field20value) + { + case 8: v193 = (unsigned __int16 *)((char *)v193 + 1); + break; + case 16: ++v193; + break; + case 32: v193 += 2; + break; + default: + assert(false); + return result; + } + ++v14; + } + while ( v14 < dstWidth ); LABEL_30: v193 = (unsigned __int16 *)((char *)v193 + dstdiffmult); ++v231; @@ -2249,90 +2327,6 @@ if ( v231 >= dstHeight ) return result; } - while ( 1 ) - { - a6s = (double)v14 / (double)dstWidth * (double)srcWidth; - v151 = bankersRounding(a6s); - a6t = (double)(v14 + 1) / (double)dstWidth * (double)srcWidth; - v142 = bankersRounding(a6t); - v17 = (double)v231 / (double)dstHeight * (double)srcHeight; - v133 = bankersRounding(v17); - v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; - v124 = bankersRounding(v18); - v19 = (v124 - v133) * (v142 - v151); - v252 = 0; - a6b = 0; - v240 = 0i64; - if ( v133 < v124 ) - break; -LABEL_25: - v22 = (unsigned int)v240 / ((v124 - v133) * (v142 - v151)); - if ( v19 ) - { - a6b /= v19; - v252 /= v19; - HIDWORD(v240) /= v19; - } - if ( v22 != 255 ) - v22 &= 0x7FFFFFFFu; - v23 = _450F55(HIDWORD(v240) | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); - *(_DWORD *)v193 = v23; - switch(field20value) - { - case 8: v193 = (unsigned __int16 *)((char *)v193 + 1); - break; - case 16: ++v193; - break; - case 32: v193 += 2; - break; - default: - assert(false); - return result; - } - ++v14; - if ( v14 >= dstWidth ) - goto LABEL_30; - } - v160 = v124 - v133; - if(field0value == 32) - v175 = &pSrc[2 * (v151 + srcPitch * v133)]; - else - v175 = &pSrc[v151 + srcPitch * v133]; - - while ( v151 >= v142 ) - { -LABEL_24: - if(field0value == 32) - v175 += 2 * srcPitch; - else - v175 += srcPitch; - --v160; - if ( !v160 ) - goto LABEL_25; - } - v176 = (int *)v175; - v161 = v142 - v151; - while ( 1 ) - { - if(field0value == 32) - v21 = _450FB1(*v176); - else - v21 = _450FB1(*(_WORD *)v176); - break; -LABEL_23: - if(field0value == 32) - ++v176; - else - v176 = (int *)((char *)v176 + 2); - --v161; - if ( !v161 ) - goto LABEL_24; - } - LODWORD(v240) = ((unsigned int)v21 >> 24) + v240; - a6b += BYTE2(v21); - v252 += BYTE1(v21); - HIDWORD(v240) += (unsigned __int8)v21; - goto LABEL_23; } else if ( result == 8 ) @@ -2350,26 +2344,26 @@ do { a6bi = (double)v112 / (double)dstWidth * (double)srcWidth; - v132 = bankersRounding(a6bi); + widthRatio = bankersRounding(a6bi); a6bj = (double)(v112 + 1) / (double)dstWidth * (double)srcWidth; - v141 = bankersRounding(a6bj); + widthRatioPlusOne = bankersRounding(a6bj); v115 = (double)v239 / (double)dstHeight * (double)srcHeight; - v150 = bankersRounding(v115); + heightRatio = bankersRounding(v115); v116 = (double)(v239 + 1) / (double)dstHeight * (double)srcHeight; - v159 = bankersRounding(v116); + heightRatioPlusOne = bankersRounding(v116); v251 = 0; - v117 = (v159 - v150) * (v141 - v132); + v117 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); v260 = 0; a6r = 0; v248 = 0; - if ( v150 >= v159 ) + if ( heightRatio >= heightRatioPlusOne ) goto LABEL_231; - v169 = v159 - v150; - v184 = (char *)pSrc + srcPitch * v150; + v169 = heightRatioPlusOne - heightRatio; + v184 = (char *)pSrc + srcPitch * heightRatio; do { - v118 = v132; - while ( v118 < v141 ) + v118 = widthRatio; + while ( v118 < widthRatioPlusOne ) { v119 = (unsigned __int8)v184[v118]; v120 = _450FB1(v119); @@ -2384,7 +2378,7 @@ } while ( v169 ); LABEL_231: - v121 = v248 / ((v159 - v150) * (v141 - v132)); + v121 = v248 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); if ( v117 ) { a6r /= v117;