opencv/3rdparty
GenshinImpactStarts 2a8d4b8e43
Merge pull request #27000 from GenshinImpactStarts:cart_to_polar
[HAL RVV] reuse atan | impl cart_to_polar | add perf test #27000

Implement through the existing `cv_hal_cartToPolar32f` and `cv_hal_cartToPolar64f` interfaces.

Add `cartToPolar` performance tests.

cv_hal_rvv::fast_atan is modified to make it more reusable because it's needed in cartToPolar.

**UPDATE**: UI enabled. Since the vec type of RVV can't be stored in struct. UI implementation of `v_atan_f32` is modified. Both `fastAtan` and `cartToPolar` are affected so the test result for `atan` is also appended. I have tested the modified UI on RVV and AVX2 and no regressions appears.

Perf test done on MUSE-PI. AVX2 test done on Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz.

```sh
$ opencv_test_core --gtest_filter="*CartToPolar*:*Core_CartPolar_reverse*:*Phase*" 
$ opencv_perf_core --gtest_filter="*CartToPolar*:*phase*" --perf_min_samples=300 --perf_force_samples=300
```

Test result between enabled UI and HAL:
```
                   Name of Test                       ui    rvv      rvv    
                                                                      vs    
                                                                      ui    
                                                                  (x-factor)
CartToPolar::CartToPolarFixture::(127x61, 32FC1)    0.106  0.059     1.80   
CartToPolar::CartToPolarFixture::(127x61, 64FC1)    0.155  0.070     2.20   
CartToPolar::CartToPolarFixture::(640x480, 32FC1)   4.188  2.317     1.81   
CartToPolar::CartToPolarFixture::(640x480, 64FC1)   6.593  2.889     2.28   
CartToPolar::CartToPolarFixture::(1280x720, 32FC1)  12.600 7.057     1.79   
CartToPolar::CartToPolarFixture::(1280x720, 64FC1)  19.860 8.797     2.26   
CartToPolar::CartToPolarFixture::(1920x1080, 32FC1) 28.295 15.809    1.79   
CartToPolar::CartToPolarFixture::(1920x1080, 64FC1) 44.573 19.398    2.30   
phase32f::VectorLength::128                         0.002  0.002     1.20   
phase32f::VectorLength::1000                        0.008  0.006     1.32   
phase32f::VectorLength::131072                      1.061  0.731     1.45   
phase32f::VectorLength::524288                      3.997  2.976     1.34   
phase32f::VectorLength::1048576                     8.001  5.959     1.34   
phase64f::VectorLength::128                         0.002  0.002     1.33   
phase64f::VectorLength::1000                        0.012  0.008     1.58   
phase64f::VectorLength::131072                      1.648  0.931     1.77   
phase64f::VectorLength::524288                      6.836  3.837     1.78   
phase64f::VectorLength::1048576                     14.060 7.540     1.86   
```

Test result before and after enabling UI on RVV:
```
                   Name of Test                      perf   perf     perf   
                                                      ui     ui       ui    
                                                     orig    pr       pr    
                                                                      vs    
                                                                     perf   
                                                                      ui    
                                                                     orig   
                                                                  (x-factor)
CartToPolar::CartToPolarFixture::(127x61, 32FC1)    0.141  0.106     1.33   
CartToPolar::CartToPolarFixture::(127x61, 64FC1)    0.187  0.155     1.20   
CartToPolar::CartToPolarFixture::(640x480, 32FC1)   5.990  4.188     1.43   
CartToPolar::CartToPolarFixture::(640x480, 64FC1)   8.370  6.593     1.27   
CartToPolar::CartToPolarFixture::(1280x720, 32FC1)  18.214 12.600    1.45   
CartToPolar::CartToPolarFixture::(1280x720, 64FC1)  25.365 19.860    1.28   
CartToPolar::CartToPolarFixture::(1920x1080, 32FC1) 40.437 28.295    1.43   
CartToPolar::CartToPolarFixture::(1920x1080, 64FC1) 56.699 44.573    1.27   
phase32f::VectorLength::128                         0.003  0.002     1.54   
phase32f::VectorLength::1000                        0.016  0.008     1.90   
phase32f::VectorLength::131072                      2.048  1.061     1.93   
phase32f::VectorLength::524288                      8.219  3.997     2.06   
phase32f::VectorLength::1048576                     16.426 8.001     2.05   
phase64f::VectorLength::128                         0.003  0.002     1.44   
phase64f::VectorLength::1000                        0.020  0.012     1.60   
phase64f::VectorLength::131072                      2.621  1.648     1.59   
phase64f::VectorLength::524288                      10.780 6.836     1.58   
phase64f::VectorLength::1048576                     22.723 14.060    1.62   
```

Test result before and after modifying UI on AVX2:
```
                   Name of Test                     perf  perf     perf   
                                                    avx2  avx2     avx2   
                                                    orig   pr       pr    
                                                                    vs    
                                                                   perf   
                                                                   avx2   
                                                                   orig   
                                                                (x-factor)
CartToPolar::CartToPolarFixture::(127x61, 32FC1)    0.006 0.005    1.14   
CartToPolar::CartToPolarFixture::(127x61, 64FC1)    0.010 0.009    1.08   
CartToPolar::CartToPolarFixture::(640x480, 32FC1)   0.273 0.264    1.03   
CartToPolar::CartToPolarFixture::(640x480, 64FC1)   0.511 0.487    1.05   
CartToPolar::CartToPolarFixture::(1280x720, 32FC1)  0.760 0.723    1.05   
CartToPolar::CartToPolarFixture::(1280x720, 64FC1)  2.009 1.937    1.04   
CartToPolar::CartToPolarFixture::(1920x1080, 32FC1) 1.996 1.923    1.04   
CartToPolar::CartToPolarFixture::(1920x1080, 64FC1) 5.721 5.509    1.04   
phase32f::VectorLength::128                         0.000 0.000    0.98   
phase32f::VectorLength::1000                        0.001 0.001    0.97   
phase32f::VectorLength::131072                      0.105 0.111    0.95   
phase32f::VectorLength::524288                      0.402 0.402    1.00   
phase32f::VectorLength::1048576                     0.775 0.767    1.01   
phase64f::VectorLength::128                         0.000 0.000    1.00   
phase64f::VectorLength::1000                        0.001 0.001    1.01   
phase64f::VectorLength::131072                      0.163 0.162    1.01   
phase64f::VectorLength::524288                      0.669 0.653    1.02   
phase64f::VectorLength::1048576                     1.660 1.634    1.02   
```

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-03-13 15:56:56 +03:00
..
carotene Do not rely on cv namespace in HAL. 2025-02-06 10:00:28 +03:00
cpufeatures Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-10-28 14:41:08 +00:00
fastcv Fix gaussianBlur5x5 performance regression 2025-03-10 16:16:56 +05:30
ffmpeg ffmpeg/4.x: update FFmpeg wrapper 2024.12 2024-12-26 12:30:48 +00:00
flatbuffers Update FlatBuffers source code to 23.5.9 2023-05-10 14:39:36 +03:00
hal_rvv Merge pull request #27000 from GenshinImpactStarts:cart_to_polar 2025-03-13 15:56:56 +03:00
include speed up vulkan dnn, and support ios and apple m1 chip. (#23349) 2023-05-18 20:02:27 +03:00
ippicv Merge pull request #26463 from eplankin:icv_update_2022.0.0 2025-01-27 17:02:36 +03:00
ittnotify Merge pull request #26802 from Kumataro:fix26801 2025-01-20 10:54:13 +03:00
kleidicv Update KleidiCV to version 0.3. 2024-12-16 15:32:44 +03:00
libjasper Fixed typo. 2024-02-24 18:03:18 +09:00
libjpeg Merge pull request #25092 from klatism:libjpeg-upgrade 2024-03-28 17:03:05 +03:00
libjpeg-turbo Update libjpeg-turbo version:3.1.0 2025-03-09 00:02:20 +03:00
libpng Merge pull request #25631 from asmorkalov:as/png_build_fix 2024-05-23 17:14:01 +03:00
libspng Update 3rdparty libspng to 0.7.4 2023-12-12 23:05:02 +08:00
libtiff Merge pull request #25257 from Kumataro:fix25256 2024-03-25 08:58:30 +03:00
libtim-vx Merge pull request #21036 from fengyuentau:timvx_backend_support 2022-03-31 21:42:11 +00:00
libwebp Bump libwebp to v1.4.0 2024-04-17 14:36:44 +02:00
ndsrvp feat: medianBlur & bilateralFilter 2024-10-28 17:54:45 +08:00
openexr fix warning in Clang 10 2023-12-07 21:35:44 +09:00
openjpeg Bump openjp2 to v2.5.3 2025-02-20 10:46:33 +03:00
openvx Move OpenVX integrations to imgproc to OpenVX HAL 2025-02-15 09:55:37 +03:00
orbbecsdk fix download file hash value mismatch issue 2024-04-01 10:32:37 +08:00
protobuf Merge pull request #23109 from seanm:misc-warnings 2023-10-06 13:33:21 +03:00
quirc fix_warnings_quirc 2023-04-12 11:38:53 +03:00
tbb Fixed lcense and readme filenames after TBB update 2024-02-27 12:06:55 +03:00
zlib Merge pull request #25123 from klatism:zlib-upgrade 2024-03-05 12:40:21 +03:00
zlib-ng Merge pull request #26113 from FantasqueX:zlib-ng-2-2-1 2024-09-12 16:05:24 +03:00
.gitattributes Disabled whitespace checking for 3rdparty. 2013-08-21 18:59:24 +04:00
readme.txt Add zlib-ng as an alternative zlib implementation 2024-01-14 14:58:47 +08:00

This folder contains libraries and headers of a few very popular still image codecs
used by imgcodecs module.
The libraries and headers are preferably to build Win32 and Win64 versions of OpenCV.
On UNIX systems all the libraries are automatically detected by configure script.
In order to use these versions of libraries instead of system ones on UNIX systems you
should use BUILD_<library_name> CMake flags (for example, BUILD_PNG for the libpng library).

------------------------------------------------------------------------------------
libjpeg (deprecated)  The Independent JPEG Group's JPEG software.
                      Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
                      See IGJ home page http://www.ijg.org
                      for details and links to the source code

libjpeg-turbo         libjpeg-turbo is covered by three compatible BSD-style open source licenses.
                      Refer to [LICENSE.md](libjpeg-turbo/LICENSE.md) for a roll-up of license terms.

                      Site: https://github.com/libjpeg-turbo/libjpeg-turbo
                      API is compatible with original libjpeg.

                      WITH_JPEG CMake option must be ON to add libjpeg or libjpeg-turbo support to imgcodecs.
                      BUILD_JPEG=ON selects libjpeg-turbo by default (since OpenCV 3.4.2).
                      Enable BUILD_JPEG_TURBO_DISABLE=ON to force using of libjpeg (this option is removed in OpenCV 4.0).
                      SIMD instructions are enabled by default. Use ENABLE_LIBJPEG_TURBO_SIMD to control SIMD instructions.
------------------------------------------------------------------------------------
libpng                Portable Network Graphics library.
                      The license and copyright notes can be found in libpng/LICENSE.
                      See libpng home page http://www.libpng.org
                      for details and links to the source code

                      WITH_PNG CMake option must be ON to add libpng support to imgcodecs.
                      
libspng               Portable Network Graphics library.
                      The license and copyright notes can be found in libspng/LICENSE.
                      See libspng home page https://libspng.org
                      for details and links to the source code
                      
                      WITH_SPNG CMake option must be ON to add libspng support to imgcodecs
------------------------------------------------------------------------------------
libtiff               Tag Image File Format (TIFF) Software
                      Copyright (c) 1988-1997 Sam Leffler
                      Copyright (c) 1991-1997 Silicon Graphics, Inc.
                      See libtiff home page #1 http://www.simplesystems.org/libtiff/
                                            #2 https://libtiff.gitlab.io/libtiff/
                      for details and links to the source code

                      WITH_TIFF CMake option must be ON to add libtiff & zlib support to imgcodecs.
------------------------------------------------------------------------------------
zlib                  General purpose LZ77 compression library
                      Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler.
                      See zlib home page http://www.zlib.net
                      for details and links to the source code

zlib-ng               zlib data compression library for the next generation systems
                      (C) 1995-2013 Jean-loup Gailly and Mark Adler
                      See zlib-ng official GitHub repository
                      https://github.com/zlib-ng/zlib-ng.git
                      for details and links to source code

                      WITH_ZLIB_NG CMake option must be ON to use zlib-ng as the zlib implementation.
------------------------------------------------------------------------------------
jasper                JasPer is a collection of software
                      (i.e., a library and application programs) for the coding
                      and manipulation of images.  This software can handle image data in a
                      variety of formats.  One such format supported by JasPer is the JPEG-2000
                      format defined in ISO/IEC 15444-1.

                      Copyright (c) 1999-2000 Image Power, Inc.
                      Copyright (c) 1999-2000 The University of British Columbia
                      Copyright (c) 2001-2003 Michael David Adams

                      See JasPer official GitHub repository
                      https://github.com/jasper-software/jasper.git
                      for details and links to source code
------------------------------------------------------------------------------------
openexr               OpenEXR is a high dynamic-range (HDR) image file format developed
                      by Industrial Light & Magic for use in computer imaging applications.

                      Copyright (c) 2006, Industrial Light & Magic, a division of Lucasfilm
                      Entertainment Company Ltd. Portions contributed and copyright held by
                      others as indicated. All rights reserved.

                      The project homepage: http://www.openexr.com
------------------------------------------------------------------------------------
ffmpeg                FFmpeg is a complete, cross-platform solution to record,
                      convert and stream audio and video. It includes libavcodec -
                      the leading audio/video codec library, and also libavformat, libavutils and
                      other helper libraries that are used by OpenCV (in videoio module) to
                      read and write video files.

                      Copyright (c) 2001 Fabrice Bellard

                      The project homepage: http://ffmpeg.org/.
                      
                      * On Linux/OSX we link user-installed ffmpeg (or ffmpeg fork libav).
                      * On Windows we use pre-built ffmpeg binaries,
                        see opencv/3rdparty/ffmpeg/readme.txt for details and licensing information
------------------------------------------------------------------------------------