Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nearest neighbor resize algorithm relies on undefined behavior #502

Closed
tobihan opened this issue Oct 14, 2014 · 2 comments
Closed

Nearest neighbor resize algorithm relies on undefined behavior #502

tobihan opened this issue Oct 14, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@tobihan
Copy link

tobihan commented Oct 14, 2014

The test TEST(ResizeImage, NearestNeighborInterp) fails on Debian on i386 architectures [1].

The image gets resized to this:

000011100
000011100
000011100
111111111
111111111
111111111
000011100
000011100
000011100

instead of the expected

000111000
000111000
000111000
111111111
111111111
111111111
000111000
000111000
000111000

I suspect that's because of the undefined result of floor(3./3.) that is called in resize_image(). Maybe you should add some small shifts to make this well-defined.

Best,
Tobias

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765291

@dacap dacap added the bug label Oct 15, 2014
@dacap dacap added this to the v1.0 milestone Oct 15, 2014
@dacap dacap self-assigned this Oct 15, 2014
@dacap dacap modified the milestones: v1.1, v1.0 Nov 1, 2014
dacap added a commit that referenced this issue Jul 25, 2016
It might be a possible fix for #502
@dacap
Copy link
Member

dacap commented Jul 25, 2016

Hi @tobihan, could you please check if 97d42de fixes this issue.

@tobihan
Copy link
Author

tobihan commented Jul 26, 2016

Hi. Yes, that fixes it, thanks!

On 07/25/2016 04:17 PM, David Capello wrote:

Hi @tobihan https://github.com/tobihan, could you please check if
97d42de
97d42de
fixes this issue.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#502 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABv6bSJggSnwUDDf7reuzXjKVsQhMIgnks5qZNOcgaJpZM4CukJp.

@dacap dacap closed this as completed Jul 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants