Skip to content

Commit

Permalink
Merge pull request #3785 from asmorkalov:as/cartToPolar_no_tuple
Browse files Browse the repository at this point in the history
Workaround for CUDA 12.6 tuple_size issue #3773.
  • Loading branch information
asmorkalov authored Sep 9, 2024
2 parents 6c47c00 + 09eb618 commit 0377a6a
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions modules/cudaarithm/src/cuda/polar_cart.cu
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,15 @@ void cv::cuda::cartToPolar(InputArray _xy, OutputArray _mag, OutputArray _angle,
GpuMat_<float> magc(mag);
GpuMat_<float> anglec(angle);

gridTransformUnary(globPtr<float2>(xy), globPtr<float>(magc), magnitude_interleaved_func<float2>(), stream);

if (angleInDegrees)
{
auto f1 = magnitude_interleaved_func<float2>();
auto f2 = direction_interleaved_func<float2, true>();
cv::cudev::tuple<decltype(f1), decltype(f2)> f12 = cv::cudev::make_tuple(f1, f2);
gridTransformTuple(globPtr<float2>(xy),
tie(magc, anglec),
f12,
stream);
gridTransformUnary(globPtr<float2>(xy), globPtr<float>(anglec), direction_interleaved_func<float2, true>(), stream);
}
else
{
auto f1 = magnitude_interleaved_func<float2>();
auto f2 = direction_interleaved_func<float2, false>();
cv::cudev::tuple<decltype(f1), decltype(f2)> f12 = cv::cudev::make_tuple(f1, f2);
gridTransformTuple(globPtr<float2>(xy),
tie(magc, anglec),
f12,
stream);
gridTransformUnary(globPtr<float2>(xy), globPtr<float>(anglec), direction_interleaved_func<float2, false>(), stream);
}

syncOutput(mag, _mag, stream);
Expand All @@ -191,7 +181,7 @@ void cv::cuda::cartToPolar(InputArray _xy, OutputArray _magAngle, bool angleInDe
CV_Assert( xy.type() == CV_32FC2 );

GpuMat magAngle = getOutputMat(_magAngle, xy.size(), CV_32FC2, stream);

if (angleInDegrees)
{
gridTransformUnary(globPtr<float2>(xy),
Expand Down

0 comments on commit 0377a6a

Please sign in to comment.