Commit Graph

2234 Commits

Author SHA1 Message Date
Alexander Alekhin
eab2b9dc09 core: ensure is_trivially_copyable for simple types 2021-10-06 21:39:53 +00:00
Alexander Alekhin
3e6f27522b pre: OpenCV 4.5.4 (version++) 2021-10-04 22:35:47 +00:00
Vadim Levin
3c89a28a06
Merge pull request #20611 from VadimLevin:dev/vlevin/pure-python-modules
* feat: OpenCV extension with pure Python modules

* feat: cv2 is now a Python package instead of extension module

Python package cv2 now can handle both Python and C extension modules
properly without additional "subfolders" like "_extra_py_code".

* feat: can call native function from its reimplementation in Python
2021-09-18 10:02:55 +03:00
Alexander Alekhin
c3ac834526 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-09-11 21:27:26 +00:00
Alexander Alekhin
5578ad5e14 dnn(ocl): fix automatic globalsize adjusting
- if kernel code doesn't support that
2021-09-06 03:11:29 +00:00
Alexander Alekhin
5aa7435d25 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-09-02 15:24:04 +00:00
Alexander Alekhin
6625810d2a Merge pull request #20618 from VadimLevin:dev/vlevin/fix-vector-conversion 2021-09-01 10:52:37 +00:00
Vadim Levin
16b9514543 feat: update conversion logic for std::vector<T> in Python bindings
`PyObject*` to `std::vector<T>` conversion logic:
- If user passed Numpy Array
  - If array is planar and T is a primitive type (doesn't require
    constructor call) that matches with the element type of array, then
    copy element one by one with the respect of the step between array
    elements. If compiler is lucky (or brave enough) copy loop can be
    vectorized.
    For classes that require constructor calls this path is not
    possible, because we can't begin an object lifetime without hacks.
  - Otherwise fall-back to general case
- Otherwise - execute the general case:
  If PyObject* corresponds to Sequence protocol - iterate over the
  sequence elements and invoke the appropriate `pyopencv_to` function.

`std::vector<T>` to `PyObject*` conversion logic:
- If `std::vector<T>` is empty - return empty tuple.
- If `T` has a corresponding `Mat` `DataType` than return
  Numpy array instance of the matching `dtype` e.g.
  `std::vector<cv::Rect>` is returned as `np.ndarray` of shape `Nx4` and
  `dtype=int`.
  This branch helps to optimize further evaluations in user code.
- Otherwise - execute the general case:
  Construct a tuple of length N = `std::vector::size` and insert
  elements one by one.

Unnecessary functions were removed and code was rearranged to allow
compiler select the appropriate conversion function specialization.
2021-09-01 13:00:21 +03:00
Dale Phurrough
3995deaf76
fix opencv/opencv#20544 nodiscard for msvc/gcc
- includes workaround for preprocessor non-compliance
- enable attribute syntax checking in msvc
2021-08-28 20:22:47 +02:00
HAN Liutong
2f31763335 fix v_reduce_sum 2021-08-24 11:42:19 +08:00
Daniel Playfair Cal
4d63a89fa6
Merge pull request #20536 from hedgepigdaniel:fix/ocl-context-create-ownership
docs(core/ocl): clarify ownership of arguments passed into OpenCL related functions

* docs(core/ocl): clarify ownership in OpenCLExecutionContext::create

Although it is technically true that OpenCLExecutionContext::create
calls `clRetainContext` on its context argument, it is misleading
because it does not increase the reference count overall. Clarify that
the ownership of one reference of the passed context and device is
taken.

* docs(core/ocl): document ownership transfer in ocl::Device::fromHandle
2021-08-11 20:58:08 +03:00
Alexander Alekhin
424eaba4c5 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-08-07 17:25:06 +00:00
Alexander Smorkalov
6a2e559222 Fixed memory access issue in v_rshr_pack_store intrinsic on RISC-V RVV. 2021-08-04 20:04:03 +03:00
Vadim Levin
531ea5b3a2 fix: convert arguments names that are keywords reserved by Python 2021-08-01 12:02:36 +03:00
Zhuo Zhang
bdd3930855
Fix typo in comment, OpenMP => TBB 2021-07-29 09:34:09 +08:00
ZhangYin
acc576658a
Merge pull request #20412 from joy2myself:rvv-0.10
bug fixes for universal intrinsics of RISC-V back-end

* Align universal intrinsic comparator behaviour with other platforms

Set all bits to one for return value of int and fp comparators.

* fix v_pack_triplets, v_pack_store and v_pack_u_store

* Remove redundant CV_DECL_ALIGNED statements

Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2021-07-23 17:08:43 +03:00
Alexander Alekhin
9103837228 Merge pull request #20278 from joy2myself:rvv-0.10 2021-07-09 22:42:29 +00:00
Francesco Petrogalli
b928ebdd53
Merge pull request #19985 from fpetrogalli:disable_threads
* [build][option] Introduce `OPENCV_DISABLE_THREAD_SUPPORT` option.

The option forces the library to build without thread support.

* update handling of OPENCV_DISABLE_THREAD_SUPPORT

- reduce amount of #if conditions

* [to squash] cmake: apply mode vars in toolchains too

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2021-07-08 20:21:21 +00:00
Alexander Alekhin
aaad1791d9 Merge tag '4.5.3' 2021-07-05 21:48:40 +00:00
Alexander Alekhin
ad6e82942b release: OpenCV 4.5.3 2021-07-05 12:03:22 +00:00
Alexander Alekhin
9a9954a036 Merge tag '3.4.15' 2021-07-04 21:32:19 +00:00
Alexander Alekhin
591708903b release: OpenCV 3.4.15 2021-07-04 21:10:13 +00:00
Alexander Alekhin
8fad85edda Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-07-01 10:52:31 +00:00
Alexander Alekhin
94c67faaea Merge pull request #20336 from JoeHowse:refactor-cl_image-float16-conversions 2021-07-01 09:52:19 +00:00
Joe Howse
6a3d925a47 OpenCL: core support for FP16, more channel orders
* Support cl_image conversion for CL_HALF_FLOAT (float16)

* Support cl_image conversion for additional channel orders:
  CL_A, CL_INTENSITY, CL_LUMINANCE, CL_RG, CL_RA

* Comment on why cl_image conversion is unsupported for CL_RGB

* Predict optimal vector width for float16

* ocl::kernelToStr: support float16

* ocl::Device::halfFPConfig: drop artificial requirement for OpenCL
  version >= 1.2. Even OpenCL 1.0 supports the underlying config
  property, CL_DEVICE_HALF_FP_CONFIG.

* dumpOpenCLInformation: provide info on OpenCL half-float support
  and preferred half-float vector width

* randu: support default range [-1.0, 1.0] for float16

* TestBase::warmup: support float16
2021-06-30 14:14:37 -03:00
Dale Phurrough
8be86cbdfd
add usageFlags to UMat static factories
- add abi compatible overloads
- add test case
2021-06-23 18:50:33 +02:00
kikaxa
bb60cb0bf9 Reenable filesystem for ios builds 2021-06-20 16:33:25 +00:00
Zhang Yin
3a15a3821a Update RISC-V back-end to RVV 0.10 2021-06-18 15:44:38 +08:00
Alexander Alekhin
bc1af6227a Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-06-09 10:58:37 +00:00
Alexander Alekhin
5f80f43ff5 core: fix nSize initialization in cvIplImage() 2021-06-09 07:31:38 +00:00
Alexander Alekhin
b57faa41c2 pre: OpenCV 4.5.3 (version++) 2021-06-08 08:52:20 +00:00
JoeHowse
34183237ce
Merge pull request #20203 from JoeHowse:clMath-patches
Fix dynamic loading of clBLAS and clFFT (formerly, clAmdBlas and clAmdFft)

* Fix dynamic loading of clBLAS and clFFT

* Update filenames and function names for clBLAS (formerly, clAmdBlas)

* Update filenames and function names for clFFT (formerly, clAmdFft)

* Uncomment teardown of clFFT; tear down clFFT in same way as clBLAS

* Fix generators for clBLAS and clFFT headers

* Update generators to parse recent clBLAS and clFFT library headers

* Update generators to be compatible with Python 3

* Re-generate OpenCV's clBLAS and clFFT headers

* Update function calls to match names in newly generated headers

* Disable (and comment on) teardown code for clBLAS and clFFT

* Renaming *clamd* files

* Renaming *clamdblas* files to *clblas*

* Renaming *clamdfft* files to *clfft*

* Update generator for CL headers

* Update generator to be compatible with Python 3
2021-06-07 20:24:27 +00:00
Alexander Alekhin
286ec92967 Merge pull request #20027 from diablodale:fix19807-UMat-usageFlags 2021-06-07 20:20:13 +00:00
Alexander Alekhin
43940f7ffc pre: OpenCV 3.4.15 (version++) 2021-06-07 20:10:34 +00:00
Alexander Alekhin
3e513ee6ab Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-06-03 16:23:36 +00:00
Dale Phurrough
c2ce3d927a
UMat usageFlags fixes opencv/opencv#19807
- corrects code to support non- USAGE_DEFAULT settings
- accuracy, regression, perf test cases
- not tested on the 3.x branch
2021-06-03 16:33:03 +02:00
Developer-Ecosystem-Engineering
814550d2a6
Merge pull request #20011 from Developer-Ecosystem-Engineering:3.4
Improve performance on Arm64

* Improve performance on Apple silicon

This patch will
- Enable dot product intrinsics for macOS arm64 builds
- Enable for macOS arm64 builds
- Improve HAL primitives
  - reduction (sum, min, max, sad)
  - signmask
  - mul_expand
  - check_any / check_all

Results on a M1 Macbook Pro

* Updates to #20011 based on feedback

  - Removes Apple Silicon specific workarounds
  - Makes #ifdef sections smaller for v_mul_expand cases
  - Moves dot product optimization to compiler optimization check
  - Adds 4x4 matrix transpose optimization

* Remove dotprod and fix v_transpose

Based on the latest, we've removed dotprod entirely and will revisit in a future PR.

Added explicit cats with v_transpose4x4()

This should resolve all opens with this PR

* Remove commented out lines

Remove two extraneous comments
2021-06-01 09:39:55 +03:00
HAN Liutong
8bd5405228 Fix RVV toolchain conflicts. 2021-05-30 16:00:18 +08:00
Alexander Alekhin
830cb5cad7 Merge pull request #20116 from alalek:highgui_backends 2021-05-26 08:32:14 +00:00
damonyu1989
5f637e5a02
Merge pull request #19778 from damonyu1989:master-riscv-0.7.1
* Add the support for riscv64 vector 0.7.1.

* fixed GCC warnings

* cleaned whitespaces

* Remove the worning by the use of internal API of compiler.

* Update the license header.

* removed trailing whitespaces

Co-authored-by: Vadim Pisarevsky <vadim.pisarevsky@me.com>
Co-authored-by: yulj <linjie.ylj@alibaba-inc.com>
Co-authored-by: Vadim Pisarevsky <vadim.pisarevsky@gmail.com>
2021-05-25 20:15:12 +03:00
Alexander Alekhin
70f69cb265 highgui: backends and plugins 2021-05-24 16:12:02 +00:00
HattrickGenerator
115e471515
Merge pull request #19967 from HattrickGenerator:master
* Adding functions rbegin() and rend() functions to matrix class.
This is important to be more standard compliant with C++ and an ever increasing number of people using standard algorithms for better code readability- and maintainability.

The functions are copy pated from their counterparts (even though they should probably call the counterparts but this gave me some troube).
They return iterators using std::reverse_iterators

Follow up of an open feature request:
https://github.com/opencv/opencv/issues/4641

* Fix rbegin() and rend() and provide tests for them

* Removing unnecessary whitespaces

* Adding rbegin and rend to Mat_ class with the right parameters so we don't need to repeat the template argument.
An instantiating cv::Mat_<int> for example can call it's rbegin() function and doesn't need rbegin<int>() with this convience addition.

Follows what is done for forward iterators

* static cast the vector size (return size_t) to an int (that is required for opencv mat constructor)

Co-authored-by: Stefan <stefan.gerl@tum.de>
2021-05-20 19:21:34 +00:00
Alexander Alekhin
7d66f1e391 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-05-18 18:06:26 +00:00
Mikhail Nikolskii
a604d44d06
Merge pull request #19755 from mikhail-nikolskiy:ffmpeg-umat
cv::UMat output/input in VideoCapture/VideoWriter (data stays in GPU memory)

* FFMPEG with UMat input/output

* OpenCL_D3D* context

* fix Linux build

* cosmetic changes

* fix build if USE_AV_HW_CODECS=0

* simplify how child context pointer stored in parent context

* QSV interop with OpenCL on Windows

* detect_msdk.cmake via pkg-config

* fix av_buffer_ref() usage

* revert windows-decode-mfx whitelisting; remove debug msg

* address review comments

* rename property to HW_ACCELERATION_USE_OPENCL

* fix issue with "cl_khr_d3d11_sharing" extension not reported by OpenCL GPU+CPU platform

* core(ocl): add OpenCL stubs for configurations without OpenCL

* videoio(ffmpeg): update #if guards

* Put OpenCL related code under HAVE_OPENCL; simplify reuse of media context from OpenCL context

* videoio(test): skip unsupported tests

- plugins don't support OpenCL/UMat yet
- change handling of *_USE_OPENCL flag

* videoio(ffmpeg): OpenCL dependency

* videoio(ffmpeg): MediaSDK/oneVPL dependency

* cleanup, logging

* cmake: fix handling of 3rdparty interface targets

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2021-05-14 16:48:50 +00:00
berak
302c2354a3 core: add missing implementation for Mat::ptr(Vec) 2021-05-09 14:15:12 +02:00
Alexander Alekhin
170bf6d7af Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-05-01 09:44:24 +00:00
Zhuo Zhang
bf26050f7e
Fix missing return type for unsafe CV_XADD function 2021-04-26 20:08:45 +08:00
Alexander Alekhin
cfb77091ca Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-04-15 20:50:26 +00:00
Suleyman TURKMEN
ec8b7c933a Update Documentation 2021-04-08 22:29:45 +03:00
Alexander Alekhin
125b9f6057 Merge tag '4.5.2' 2021-04-02 17:30:52 +00:00