Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add RISC-V HAL implementation for cv::dft and cv::dct#26865

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

Merged
asmorkalov merged 12 commits intoopencv:4.xfromamane-ame:dxt_hal_rvv
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
12 commits
Select commitHold shift + click to select a range
0f8e18f
Draft of HAL RVV cv::dft with radix 2/3/4/5, keeping large radix as s…
amane-ameJan 28, 2025
582f68b
Add HAL RVV for dxt large radix.
amane-ameJan 29, 2025
32f36b9
Convert the function into templates.
amane-ameJan 31, 2025
4503b1a
Merge branch '4.x' into dxt_hal_rvv
amane-ameJan 31, 2025
f41fbb7
Fix up about anonymous namespace error.
amane-ameFeb 1, 2025
589ffee
Change dftOcv to dft and add some comments.
amane-ameFeb 3, 2025
e5e1b54
Merge branch '4.x' into dxt_hal_rvv
amane-ameFeb 7, 2025
0d16cdd
Remove indent in namespaces and replaced CV_SWAP.
amane-ameFeb 19, 2025
2d3feab
Move functions into namespaces.
amane-ameFeb 19, 2025
ef84bd6
Remove AutoBuffer.
amane-ameFeb 23, 2025
a6b9071
Use segment load/store instead of strided.
amane-ameFeb 24, 2025
9c598af
Make clang 17 happy.
amane-ameFeb 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Change dftOcv to dft and add some comments.
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
  • Loading branch information
@amane-ame@hanliutong
amane-ame andhanliutong committedFeb 3, 2025
commit589ffee2776298b50dc58e69bb562bc573f65d63
14 changes: 8 additions & 6 deletions3rdparty/hal_rvv/hal_rvv_1p0/dxt.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,8 +8,8 @@

namespace cv { namespace cv_hal_rvv {

#undefcv_hal_dftOcv
#definecv_hal_dftOcv cv::cv_hal_rvv::dftOcv
#undefcv_hal_dft
#definecv_hal_dft cv::cv_hal_rvv::dft

namespace dxt
{
Expand DownExpand Up@@ -40,8 +40,10 @@ namespace dxt
};
}

// the algorithm is copied from core/src/dxt.cpp,
// in the function template static void cv::DFT and cv::DFT_R2, cv::DFT_R3, cv::DFT_R5
template<typename T>
inline intdftOcv(const Complex<T>* src, Complex<T>* dst, int nf, int *factors, T scale, int* itab,
inline intdft(const Complex<T>* src, Complex<T>* dst, int nf, int *factors, T scale, int* itab,
const Complex<T>* wave, int tab_size, int len, bool isInverse, bool noPermute)
{
int n = len;
Expand DownExpand Up@@ -584,7 +586,7 @@ inline int dftOcv(const Complex<T>* src, Complex<T>* dst, int nf, int *factors,
return CV_HAL_ERROR_OK;
}

inline intdftOcv(const uchar* src, uchar* dst, int depth, int nf, int *factors, double scale, int* itab, void* wave,
inline intdft(const uchar* src, uchar* dst, int depth, int nf, int *factors, double scale, int* itab, void* wave,
int tab_size, int n, bool isInverse, bool noPermute)
{
if( n == 0 )
Expand All@@ -593,10 +595,10 @@ inline int dftOcv(const uchar* src, uchar* dst, int depth, int nf, int *factors,
switch( depth )
{
case CV_32F:
returndftOcv(reinterpret_cast<const Complex<float>*>(src), reinterpret_cast<Complex<float>*>(dst), nf, factors, (float)scale,
returndft(reinterpret_cast<const Complex<float>*>(src), reinterpret_cast<Complex<float>*>(dst), nf, factors, (float)scale,
itab, reinterpret_cast<const Complex<float>*>(wave), tab_size, n, isInverse, noPermute);
case CV_64F:
returndftOcv(reinterpret_cast<const Complex<double>*>(src), reinterpret_cast<Complex<double>*>(dst), nf, factors, (double)scale,
returndft(reinterpret_cast<const Complex<double>*>(src), reinterpret_cast<Complex<double>*>(dst), nf, factors, (double)scale,
itab, reinterpret_cast<const Complex<double>*>(wave), tab_size, n, isInverse, noPermute);
}
return CV_HAL_ERROR_NOT_IMPLEMENTED;
Expand Down
4 changes: 2 additions & 2 deletionsmodules/core/src/dxt.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -846,12 +846,12 @@ DFT(const OcvDftOptions & c, const Complex<T>* src, Complex<T>* dst)

if(typeid(T) == typeid(float))
{
CALL_HAL(dftOcv, cv_hal_dftOcv, reinterpret_cast<const uchar*>(src), reinterpret_cast<uchar*>(dst), CV_32F,
CALL_HAL(dft, cv_hal_dft, reinterpret_cast<const uchar*>(src), reinterpret_cast<uchar*>(dst), CV_32F,
c.nf, c.factors, c.scale, c.itab, c.wave, c.tab_size, c.n, c.isInverse, c.noPermute);
}
if(typeid(T) == typeid(double))
{
CALL_HAL(dftOcv, cv_hal_dftOcv, reinterpret_cast<const uchar*>(src), reinterpret_cast<uchar*>(dst), CV_64F,
CALL_HAL(dft, cv_hal_dft, reinterpret_cast<const uchar*>(src), reinterpret_cast<uchar*>(dst), CV_64F,
c.nf, c.factors, c.scale, c.itab, c.wave, c.tab_size, c.n, c.isInverse, c.noPermute);
}

Expand Down
4 changes: 2 additions & 2 deletionsmodules/core/src/hal_replacement.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -710,14 +710,14 @@ inline int hal_ni_dftFree1D(cvhalDFT *context) { return CV_HAL_ERROR_NOT_IMPLEME
@param isInverse OcvDftOptions data
@param noPermute OcvDftOptions data
*/
inline inthal_ni_dftOcv(const uchar* src, uchar* dst, int depth, int nf, int *factors, double scale, int* itab, void* wave,
inline inthal_ni_dft(const uchar* src, uchar* dst, int depth, int nf, int *factors, double scale, int* itab, void* wave,
int tab_size, int n, bool isInverse, bool noPermute) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }

//! @cond IGNORED
#define cv_hal_dftInit1D hal_ni_dftInit1D
#define cv_hal_dft1D hal_ni_dft1D
#define cv_hal_dftFree1D hal_ni_dftFree1D
#definecv_hal_dftOcv hal_ni_dftOcv
#definecv_hal_dft hal_ni_dft
//! @endcond

/**
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp