- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to the documentation of ResizeAntialiasing, when increasing the image size it should behave as ippiResizeLinear, ippiResizeCubic, or ippiResizeLanczos. But I found a small difference:
#define _IPP_SEQUENTIAL_STATIC #include "ippi.h" #include "ippcc.h" #include "ipps.h" #include "ippcore.h" #include <algorithm> #include <iostream> #include <iomanip> #include <cstdint> using namespace std; #include "iw\include\iw++\iw.hpp" void dump(ipp::IwiImage& img) { for (int y = 0; y < img.m_size.height; ++y) { for (int x = 0; x < img.m_size.width; ++x) { cout << setw(3) << (int)(*(uint8_t*)img.ptr(x, y)) << ' '; } cout << endl; } cout << endl; } int main() { ipp::IwiImage src; src.Alloc({ 4, 4 }, ipp8u, ippC1); ipp::IwiImage dst; dst.Alloc({ 12, 12 }, ipp8u, ippC1); for (int y = 0; y < src.m_size.height; ++y) { for (int x = 0; x < src.m_size.width; ++x) { *((uint8_t*)src.ptr(x, y)) = 10 * min(x, y); } } dump(src); for (bool antialiasing : {false, true}) { int specSize = 0, initSize = 0; ippiResizeGetSize_8u({ src.m_size.width, src.m_size.height }, { dst.m_size.width, dst.m_size.height }, ippLinear, antialiasing, &specSize, &initSize); Ipp8u* pInitBuf = ippsMalloc_8u(initSize); //ON_BLOCK_EXIT([&] { ippsFree(pInitBuf); }); IppiResizeSpec_32f* pSpec = (IppiResizeSpec_32f*)ippsMalloc_8u(specSize); //ON_BLOCK_EXIT([&] { ippsFree(pSpec); }); if (antialiasing) ippiResizeAntialiasingLinearInit({ src.m_size.width, src.m_size.height }, { dst.m_size.width, dst.m_size.height }, pSpec, pInitBuf); else ippiResizeLinearInit_8u({ src.m_size.width, src.m_size.height }, { dst.m_size.width, dst.m_size.height }, pSpec); int bufSize = 0; ippiResizeGetBufferSize_8u(pSpec, { dst.m_size.width, dst.m_size.height }, 1, &bufSize); Ipp8u* pBuffer = ippsMalloc_8u(bufSize); //ON_BLOCK_EXIT([&] { ippsFree(pBuffer); }); IppiBorderSize borderSize{}; ippiResizeGetBorderSize_8u(pSpec, &borderSize); if (antialiasing) ippiResizeAntialiasing_8u_C1R((uint8_t*)src.ptr(), src.m_step, (uint8_t*)dst.ptr(), dst.m_step, { 0, 0 }, { dst.m_size.width, dst.m_size.height }, ippBorderRepl, nullptr, pSpec, pBuffer); else ippiResizeLinear_8u_C1R((uint8_t*)src.ptr(), src.m_step, (uint8_t*)dst.ptr(), dst.m_step, { 0, 0 }, { dst.m_size.width, dst.m_size.height }, ippBorderRepl, nullptr, pSpec, pBuffer); dump(dst); } }
I tried 2017 U2 and 2018 beta.
Bruno
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ResizeAntialiasing is also 3x as slow. I sometimes upscale in a dimension and downscale in the other so just calling ResizeAntialiasing/Resize* as required is no workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bruno,
Thank you for the information! We will fix it for next IPP releases.
Best regards,
Valentin
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page