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

Very suspicious piece of code #8

Open
axeldavy opened this issue Aug 6, 2018 · 0 comments
Open

Very suspicious piece of code #8

axeldavy opened this issue Aug 6, 2018 · 0 comments

Comments

@axeldavy
Copy link

axeldavy commented Aug 6, 2018

bm3d/bm3d.cpp

Line 1341 in 5c86dfe

//! Threshold distances in order to keep similar patches

            //! Threshold distances in order to keep similar patches
            for (int dj = -(int) nHW; dj <= (int) nHW; dj++)
            {
                for (int di = 0; di <= (int) nHW; di++)
                    if (sum_table[dj + nHW + di * Ns][k_r] < threshold)
                        table_distance.push_back(make_pair(
                                    sum_table[dj + nHW + di * Ns][k_r]
                                  , k_r + di * width + dj));

                for (int di = - (int) nHW; di < 0; di++)
                    if (sum_table[-dj + nHW + (-di) * Ns][k_r] < threshold)
                        table_distance.push_back(make_pair(
                                    sum_table[-dj + nHW + (-di) * Ns][k_r + di * width + dj]
                                  , k_r + di * width + dj));
            }

This is very suspicious. Since dj takes the same negative and positive values, it means the second if test is a duplicate of the first one, however it doesn't insert the same element. Wrong check ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant