Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Fixed several accuracy bugs with image resampling#30184
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Changes fromall commits
23656e8
a0902fe
717a221
1de3e2e
90bd95f
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -20,6 +20,8 @@ | ||
#ifndef AGG_IMAGE_FILTERS_INCLUDED | ||
#define AGG_IMAGE_FILTERS_INCLUDED | ||
#define MPL_FIX_IMAGE_FILTER_LUT_BUGS | ||
#include "agg_array.h" | ||
#include "agg_math.h" | ||
@@ -53,6 +55,7 @@ namespace agg | ||
double r = filter.radius(); | ||
realloc_lut(r); | ||
unsigned i; | ||
#ifndef MPL_FIX_IMAGE_FILTER_LUT_BUGS | ||
unsigned pivot = diameter() << (image_subpixel_shift - 1); | ||
for(i = 0; i < pivot; i++) | ||
{ | ||
@@ -63,6 +66,17 @@ namespace agg | ||
} | ||
unsigned end = (diameter() << image_subpixel_shift) - 1; | ||
m_weight_array[0] = m_weight_array[end]; | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This line is one of the bugs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Please put the new version under a macro guard, as was done in#28122, so that we keep a track of what's the original Agg and what we changed on top of it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Makes sense, done ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It turns out that I can't add a preprocessor definition in | ||
#else | ||
unsigned pivot = (diameter() << (image_subpixel_shift - 1)) - 1; | ||
for(i = 0; i <= pivot + 1; i++) | ||
{ | ||
double x = double(i) / double(image_subpixel_scale); | ||
double y = filter.calc_weight(x); | ||
int16 value = iround(y * image_filter_scale); | ||
m_weight_array[pivot + i] = value; | ||
if(i <= pivot) m_weight_array[pivot - i] = value; | ||
} | ||
#endif | ||
if(normalization) | ||
{ | ||
normalize(); | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -88,6 +88,7 @@ namespace agg | ||
} | ||
} | ||
#ifndef MPL_FIX_IMAGE_FILTER_LUT_BUGS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The following code block is removed because it not only has the same bugs as the code in | ||
unsigned pivot = m_diameter << (image_subpixel_shift - 1); | ||
for(i = 0; i < pivot; i++) | ||
@@ -96,6 +97,7 @@ namespace agg | ||
} | ||
unsigned end = (diameter() << image_subpixel_shift) - 1; | ||
m_weight_array[0] = m_weight_array[end]; | ||
#endif | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.