fixed difference between SSE2 and C branches of StereoBM

thanks to @KonstantinMatskevich for the tests (#2369); I did not put them in here to avoid further merge conflicts, just fixed the code itself.