E2P: Hoist assignment of "kernel_scaling" out of the inner loop.
This caused a problem when the inner loop was empty, leaving this variable uninitialized. If you were unluckly, the uninitialized kernel_scaling would have a NaN bit pattern which would inadvertently poison the output with NaNs.