Skip to content

Commit

Permalink
*fix bug: Compiler error in function Simd::ResizeArea.
Browse files Browse the repository at this point in the history
  • Loading branch information
ermig1979 committed Aug 10, 2023
1 parent 50983c7 commit 1bec93c
Show file tree
Hide file tree
Showing 12 changed files with 371 additions and 243 deletions.
7 changes: 7 additions & 0 deletions docs/2023.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ <h5>New features</h5>
<li>The mark of function SimdBgraToYuv422p as deprecated.</li>
<li>The mark of function SimdBgraToYuv444p as deprecated.</li>
<li>The mark of function SimdBgraToYuva420p as deprecated.</li>
<li>The mark of function SimdResizeBilinear as deprecated.</li>
<li>The mark of function Simd::ResizeBilinear as deprecated.</li>
<li>The mark of function Simd::ResizeAreaGray as deprecated.</li>
<li>The mark of function Simd::ResizeArea as deprecated.</li>
</ul>
<h5>Bug fixing</h5>
<ul>
Expand All @@ -72,6 +76,7 @@ <h5>Bug fixing</h5>
<li>The memory reading outside border of input array in Base implementation, SSE4.1, AVX2 optimizations of function DescrIntCosineDistancesMxNp.</li>
<li>Error in AVX-512BW optimizations of function DescrIntEncode32f.</li>
<li>Error in AVX-512BW optimizations of function DescrIntEncode16f.</li>
<li>Compiler error in function Simd::ResizeArea.</li>
</ul>

<h4>Test framework</h4>
Expand All @@ -81,6 +86,8 @@ <h5>New features</h5>
<li>Tests for verifying functionality of function Yuv422pToBgrV2.</li>
<li>Tests for verifying functionality of function Yuv444pToBgrV2.</li>
<li>Tests for verifying functionality of function Yuv422pToBgraV2.</li>
<li>Special test for verifying functionality of function Simd::ResizeAreaGray.</li>
<li>Special test for verifying functionality of function Simd::ResizeArea.</li>
</ul>

<a href="#HOME">Home</a>
Expand Down
225 changes: 7 additions & 218 deletions docs/help/group__resizing.html

Large diffs are not rendered by default.

289 changes: 289 additions & 0 deletions docs/help/group__resizing__old.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/help/modules.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions docs/help/namespace_simd.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/help/namespacemembers_func_r.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/help/namespacemembers_r.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions prj/txt/DoxygenGroups.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@
@defgroup resizing Resizing
\short Functions for image resizing.
*/
/*! @ingroup resizing
@defgroup resizing_old Old API
\short Old deprecated functions for image resizing.
*/

/*! @ingroup functions
@defgroup shifting Shifting
Expand Down
6 changes: 4 additions & 2 deletions src/Simd/SimdLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -5716,7 +5716,7 @@ extern "C"
*/
SIMD_API void SimdReorder64bit(const uint8_t * src, size_t size, uint8_t * dst);

/*! @ingroup resizing
/*! @ingroup resizing_old

\fn void SimdResizeBilinear(const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride, size_t channelCount);

Expand All @@ -5726,6 +5726,8 @@ extern "C"

\note This function has a C++ wrappers: Simd::ResizeBilinear(const View<A>& src, View<A>& dst).

\warning This function is deprecated and can be removed in the future. Use functions ::SimdResizerInit, ::SimdResizerRun, ::SimdRelease instead this one.

\param [in] src - a pointer to pixels data of the original input image.
\param [in] srcWidth - a width of the input image.
\param [in] srcHeight - a height of the input image.
Expand All @@ -5736,7 +5738,7 @@ extern "C"
\param [in] dstStride - a row size of the output image.
\param [in] channelCount - a channel count.
*/
SIMD_API void SimdResizeBilinear(const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride,
SIMD_API SIMD_DEPRECATED void SimdResizeBilinear(const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride,
uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride, size_t channelCount);

/*! @ingroup resizing
Expand Down
26 changes: 16 additions & 10 deletions src/Simd/SimdLib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3256,7 +3256,7 @@ namespace Simd
SimdReduceColor2x2(src.data, src.width, src.height, src.stride, dst.data, dst.width, dst.height, dst.stride, src.ChannelCount());
}

/*! @ingroup resizing
/*! @ingroup resizing_old
\fn void ResizeBilinear(const View<A>& src, View<A>& dst)
Expand All @@ -3266,10 +3266,12 @@ namespace Simd
\note This function is a C++ wrapper for function ::SimdResizeBilinear.
\warning This function is deprecated and can be removed in the future. Use function Simd::Resize instead this one.
\param [in] src - an original input image.
\param [out] dst - a resized output image.
*/
template<template<class> class A> SIMD_INLINE void ResizeBilinear(const View<A> & src, View<A> & dst)
template<template<class> class A> SIMD_INLINE SIMD_DEPRECATED void ResizeBilinear(const View<A> & src, View<A> & dst)
{
assert(src.format == dst.format && src.ChannelSize() == 1);

Expand All @@ -3284,18 +3286,20 @@ namespace Simd
}
}

/*! @ingroup resizing
/*! @ingroup resizing_old
\fn void ResizeAreaGray(const View<A> & src, View<A> & dst)
\short Performs resizing of input image with using area interpolation.
All images must have the same format (8-bit gray).
\warning This function is deprecated and can be removed in the future. Use function Simd::Resize instead this one.
\param [in] src - an original input image.
\param [out] dst - a resized output image.
*/
template<template<class> class A> SIMD_INLINE void ResizeAreaGray(const View<A> & src, View<A> & dst)
template<template<class> class A> SIMD_INLINE SIMD_DEPRECATED void ResizeAreaGray(const View<A> & src, View<A> & dst)
{
assert(src.format == dst.format && src.format == View<A>::Gray8);

Expand All @@ -3321,18 +3325,20 @@ namespace Simd
}
}

/*! @ingroup resizing
/*! @ingroup resizing_old
\fn void ResizeArea(const View<A> & src, View<A> & dst)
\short Performs resizing of input image with using area interpolation.
All images must have the same format.
\warning This function is deprecated and can be removed in the future. Use function Simd::Resize instead this one.
\param [in] src - an original input image.
\param [out] dst - a resized output image.
*/
template<template<class> class A> SIMD_INLINE void ResizeArea(const View<A> & src, View<A> & dst)
template<template<class> class A> SIMD_INLINE SIMD_DEPRECATED void ResizeArea(const View<A> & src, View<A> & dst)
{
assert(src.format == dst.format);

Expand All @@ -3348,15 +3354,15 @@ namespace Simd
if (level)
{
std::vector<View<A> > pyramid(level);
pyramid[0].Resize(size, src.format);
pyramid[0].Recreate(size, src.format);
Simd::ResizeBilinear(src, pyramid[0]);
for (size_t i = 1; i < level; ++i)
{
size = Simd::Scale(size);
pyramid[i].Resize(size, src.format);
Simd::Reduce2x2(pyramid.At(i - 1), pyramid.At(i));
pyramid[i].Recreate(size, src.format);
Simd::Reduce2x2(pyramid[i - 1], pyramid[i]);
}
Simd::Reduce2x2(pyramid.At(level - 1), dst);
Simd::Reduce2x2(pyramid[level - 1], dst);
}
else
Simd::ResizeBilinear(src, dst);
Expand Down
2 changes: 2 additions & 0 deletions src/Test/Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ namespace Test
TEST_ADD_GROUP_AS(ResizeBilinear);
TEST_ADD_GROUP_A0(Resizer);
TEST_ADD_GROUP_0S(ResizeYuv420p);
TEST_ADD_GROUP_0S(ResizeAreaGray);
TEST_ADD_GROUP_0S(ResizeArea);

TEST_ADD_GROUP_A0(SegmentationShrinkRegion);
TEST_ADD_GROUP_A0(SegmentationFillSingleHoles);
Expand Down
28 changes: 28 additions & 0 deletions src/Test/TestResize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,4 +568,32 @@ namespace Test

return result;
}

bool ResizeAreaGraySpecialTest()
{
bool result = true;

View src(W, H, View::Gray8);
FillRandom(src);

View dst(W / 7, H / 7, View::Gray8);

ResizeAreaGray(src, dst);

return result;
}

bool ResizeAreaSpecialTest()
{
bool result = true;

View src(W, H, View::Bgr24);
FillRandom(src);

View dst(W / 7, H / 7, View::Bgr24);

ResizeArea(src, dst);

return result;
}
}

0 comments on commit 1bec93c

Please sign in to comment.