File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -240,12 +240,13 @@ SmartCrop.prototype = {
240
240
} ,
241
241
options = this . options ,
242
242
od = output . data ,
243
- downSample = options . scoreDownSample ,
244
- invDownSample = 1 / downSample ;
245
- for ( var y = 0 ; y < output . height * downSample ; y += downSample ) {
246
- for ( var x = 0 ; x < output . width * downSample ; x += downSample ) {
247
- var p = ( ~ ~ ( y * invDownSample ) * output . width + ~ ~ ( x * invDownSample ) ) * 4 ,
248
- importance = this . importance ( crop , x , y ) ;
243
+ downSample = options . scoreDownSample ;
244
+ for ( var y = 0 ; y < output . height ; y ++ ) {
245
+ var yoffset = y * output . width ;
246
+ var ydownSample = y * downSample ;
247
+ for ( var x = 0 ; x < output . width ; x ++ ) {
248
+ var p = yoffset + x * 4 ,
249
+ importance = this . importance ( crop , x * downSample , ydownSample ) ;
249
250
score . skin += od [ p ] / 255 * ( od [ p + 1 ] / 255 + options . skinBias ) * importance ;
250
251
score . detail += od [ p + 1 ] / 255 * importance ;
251
252
score . saturation += od [ p + 2 ] / 255 * ( od [ p + 1 ] / 255 * 1.0 + options . saturationBias ) * importance ;
You can’t perform that action at this time.
0 commit comments