Compare commits

...
Sign in to create a new pull request.

275 commits

Author SHA1 Message Date
Nicolas Chauvet
ce6c184c9e Apply patch18 2025-12-10 15:13:37 +01:00
Nicolas Chauvet
781cdc0ccb Fix build with Eigen3 > 3 2025-12-10 15:13:00 +01:00
Nicolas Chauvet
7c6a57d532 Update to 4.12.0 2025-11-28 14:51:08 +01:00
Sandro Mani
e4430f2027 Rebuild (gdal) 2025-11-23 22:38:24 +01:00
Cristian Le
fb65d41d94 Allow to build with CMake 4.0 (rhbz#2381337) 2025-11-12 18:28:03 +01:00
Dominik 'Rathann' Mierzejewski
97b0aa4a26 Rebuilt for FFmpeg 8 2025-11-05 10:08:20 +01:00
Nicolas Chauvet
d3835e3b0b Merge #43 Fix importing of Python module 2025-10-31 19:08:57 +00:00
Federico Pellegrin
1aebdc2c48 Fix importing of Python module (#2406800) 2025-10-30 20:26:11 +01:00
Yaakov Selkowitz
e035a958ac Enable C++17 on RHEL 11
While this was originally intended for the future inclusion of Protobuf v4,
rawhide and ELN now include Eigen 5.0 which requires a newer C++ standard.
2025-10-29 17:53:07 -04:00
Nicolas Chauvet
6bc8b75d58 Drop eigen2 condition 2025-10-21 17:57:23 +02:00
Nicolas Chauvet
63f9fb5af3 Set without eigen off 2025-10-21 17:56:41 +02:00
Dominik 'Rathann' Mierzejewski
544ff83f8c fix build without eigen 2025-10-21 12:48:21 +02:00
Nicolas Chauvet
50e2f38acd Add changelog 2025-10-20 20:52:35 +02:00
Nicolas Chauvet
ef49f5c10a Workaround fix build for i686 with eigen 5
Disabling AVX for i686 fixes build with eigen-5.0.0

https://gitlab.com/libeigen/eigen/-/issues/2991
2025-10-20 20:51:38 +02:00
Nicolas Chauvet
c610b9652a Add flatbuffers 2025-10-20 20:50:26 +02:00
Iñaki Úcar
84191fa7b9 https://fedoraproject.org/wiki/Changes/FlexiBLAS_as_BLAS/LAPACK_manager 2025-10-20 17:00:57 +02:00
Dominik 'Rathann' Mierzejewski
81d1bbe53c Fixed build with FFmpeg 8 2025-10-20 16:29:01 +02:00
Miro Hrončok
9db5b7b826 Conversion to %pyproject macros followup 2025-10-20 15:22:00 +02:00
Nicolas Chauvet
6e87dd17af Reduce optimization on i686
This avoid the case where some AVX code is used while not been available
for x86_64 like with eigen3
2025-10-17 20:08:41 +02:00
Nicolas Chauvet
a3c6808be9 Revert disabling eigen3 on i686
This disable some modules, so fix it another way instead
2025-10-17 20:08:33 +02:00
Nicolas Chauvet
f5faab5a89 Hack for pyprojects with opencv 2025-10-17 11:45:12 +02:00
Nicolas Chauvet
f7ff54a581 Add missing br python3-pip 2025-10-17 11:45:12 +02:00
Nicolas Chauvet
566a1c2362 Fixup disable eigen3 on i686 2025-10-17 10:19:52 +02:00
Nicolas Chauvet
a4104bd492 Add missing pyproject_wheel 2025-10-16 19:41:03 +02:00
Nicolas Chauvet
b5b2dac5f4 Disable eigen3 on f44 i686 for now 2025-10-16 19:40:34 +02:00
Nicolas Chauvet
16a14b4b00 Enable IMGCODEC_GIF 2025-10-16 15:27:19 +02:00
Nicolas Chauvet
9b977f4e00 Add missing option 2025-10-16 15:27:17 +02:00
Nicolas Chauvet
a3caee55c6 Update changelog 2025-10-16 14:54:32 +02:00
Nicolas Chauvet
ddca32a934 Use pyprojectize - thanks Miro ! 2025-10-16 14:52:54 +02:00
Nicolas Chauvet
ec4ea19d19 Drop openni-primesense 2025-09-30 20:40:45 +02:00
Python Maint
896754e411 Rebuilt for Python 3.14.0rc3 bytecode 2025-09-19 12:34:33 +02:00
Orion Poplawski
7a756537a3 Rebuild for VTK 9.5 2025-08-24 08:02:13 -06:00
Jerry James
06d07a9e3b Rebuild for tbb 2022.2.0 2025-08-20 13:47:37 -06:00
Python Maint
fbe317b035 Rebuilt for Python 3.14.0rc2 bytecode 2025-08-15 13:03:59 +02:00
Adam Williamson
1477217e3d Rebuild for new gdal 2025-07-31 23:41:40 -07:00
Nicolas Chauvet
709fa3cec9 Update changelog 2025-07-29 10:27:41 +02:00
Nicolas Chauvet
974e024962 Add missing BR libavif 2025-07-29 10:24:17 +02:00
Nicolas Chauvet
56d06cb4b7 Drop undefine cmake in source build 2025-07-29 10:24:17 +02:00
Fedora Release Engineering
0e27e77c73 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 23:34:35 +00:00
Adam Williamson
6086565bcb Correct qt patch application (d'oh) 2025-07-08 16:15:05 -07:00
Adam Williamson
f516d8688f Add patch from Atri Bhattacharya to fix build with Qt 6.9 2025-07-08 16:13:13 -07:00
Python Maint
a3627e6bbb Rebuilt for Python 3.14 2025-06-04 08:17:42 +02:00
Yaakov Selkowitz
12c310ffa4 Use Qt6 in highgui and cvv
Qt5 is deprecated, and kstars (the only package which uses both
opencv-highgui and Qt) is now using Qt6 in F42+.  Other dependents of
highgui are not using Qt directly otherwise, and cvv has no dependents.
2025-03-11 08:30:54 -04:00
Adam Williamson
9a00dd9072 Backport all post-4.11.0 PNG fixes, including big-endian fix
This backports all changes to the PNG reading code since 4.11.0,
mainly to get the fix for #2345306, PNG read fails on big-endian.
It's difficult to backport just that fix to 4.11.0 as it's built
on all the earlier changes, and the earlier changes look like
useful fixes too in any case.

See upstream https://github.com/opencv/opencv/issues/26913 and
https://github.com/opencv/opencv/pull/26915 .

Resolves: rhbz#2345306

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2025-02-18 12:16:02 -08:00
Sérgio M. Basto
3219158b47 Add upstream patch to fix build on PPC64LE
https://github.com/opencv/opencv/pull/26750
core: fixed VSX intrinsics implementation
2025-02-03 00:45:54 +00:00
Packit
74ecc5eff2 Update to 4.11.0 upstream release
- Resolves: rhbz#2336422
2025-02-03 00:43:48 +00:00
Sérgio M. Basto
234dd7bc9f Rename condition va to libva because is not easy search by va only 2025-02-03 00:39:43 +00:00
Sérgio M. Basto
392683e0c6 Add upstream patch to fix build on PPC64LE with GCC 15 2025-01-18 00:19:28 +00:00
Fedora Release Engineering
687d848338 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 21:38:40 +00:00
Sérgio M. Basto
08442e3b73 Rollback and use files_to_sync as packit team suggested 2025-01-09 14:39:59 +00:00
Sérgio M. Basto
7ac87dc3ab [packit] back to create-archive and in last step print the files generated 2025-01-09 13:16:25 +00:00
Sérgio M. Basto
30cfb1b655 [packit] try to use prepare-files instead 2025-01-09 01:01:38 +00:00
Sérgio M. Basto
6b02736ca1 [packit] use action create-archive instead pre-sync 2025-01-09 00:42:18 +00:00
Sérgio M. Basto
cdde9111a9 Try to fix packit automation 2025-01-09 00:10:16 +00:00
Orion Poplawski
0b8a44ecd0 Rebuild with numpy 2.x (rhbz#2333781) 2024-12-22 18:08:16 -07:00
Sérgio M. Basto
630c79d7df epel10 now have ffmpeg and xine 2024-11-12 14:11:04 +00:00
Sandro Mani
2c623cae48 Rebuild (tesseract) 2024-11-12 09:18:26 +01:00
Sérgio M. Basto
3de81f0356 Adjust bconds for epel10 initial build 2024-11-09 18:38:03 +00:00
Sérgio M. Basto
b6c11e05aa Avoid src.rpm have more 500 Megas with extra (tests) that we don't use 2024-11-09 18:34:03 +00:00
Sandro Mani
8f568893e6 BR: oneVPL-devel -> libvpl-devel 2024-11-09 10:59:22 +01:00
Sandro Mani
a3c44bd8be Rebuild (gdal) 2024-11-09 08:48:16 +01:00
Orion Poplawski
6a5043ef18 Rebuild for hdf5 1.14.5 2024-10-25 17:29:19 -06:00
Michel Lind
9ef0ab81a9 Rebuild for tesseract-5.4.1-3 (soversion change from 5.4.1 to just 5.4)
Signed-off-by: Michel Lind <salimma@fedoraproject.org>
2024-09-25 17:49:06 -05:00
Fabio Valentini
a579e5a20d
Rebuild for ffmpeg 7 2024-09-23 16:58:05 +02:00
Sérgio M. Basto
852bab1df9 Rebuild for opencv 4.10.0 2024-07-25 23:45:49 +01:00
Packit
f24d288f01 Update to 4.10.0 upstream release
- Resolves: rhbz#2290312

Upstream tag: 4.10.0
Upstream commit: 71d3237a

Commit authored by Packit automation (https://packit.dev/)
2024-07-25 01:39:57 +01:00
Laura Barcziova
d2149476c2 Configure Packit for release automation
See details in https://packit.dev/docs/fedora-releases-guide/dist-git-onboarding
2024-07-24 12:05:41 +00:00
Fedora Release Engineering
25d0047924 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 20:49:40 +00:00
Sérgio M. Basto
1d07ea89c2 Revert "Reduce debuginfo level on i386 to avoid memory exhaustion"
This reverts commit b645eac1f1.
2024-06-17 00:30:23 +01:00
Sérgio M. Basto
7853992681 Fix changelog 2024-06-17 00:30:23 +01:00
Sandro Mani
1aa91ebd24 Rebuild for tesseract-5.4.1 2024-06-13 22:39:54 +02:00
Python Maint
2d768a9399 Rebuilt for Python 3.13 2024-06-09 12:52:58 +02:00
Sandro Mani
f847cf88b6 Rebuild (gdal) 2024-05-14 15:34:02 +02:00
Josef Řídký
2a70c4efc0 Rebuild for openexr
Signed-off-by: Josef Řídký <jridky@redhat.com>
2024-04-23 18:05:09 +02:00
Jerry James
b645eac1f1 Reduce debuginfo level on i386 to avoid memory exhaustion 2024-02-24 16:38:02 -07:00
Jerry James
de40c5d708 Rebuild (coin-or-Clp)
- Use uppercase connectives in SPDX expression
2024-02-23 20:11:46 -07:00
Sérgio M. Basto
8b83a73771 pkgconfig(opencv) instead pkgconfig(opencv4) still is use by packages
revert drop compat symlink to opencv.pc
2024-02-05 23:31:07 +00:00
Sérgio M. Basto
7cdfc99aae Disable openexr on epel 9 2024-02-05 11:38:21 +00:00
Sérgio M. Basto
0aedf9d836 rhbz#2058802 is fixed, reverting commit d9eb86c 2024-02-05 11:38:21 +00:00
Sérgio M. Basto
5bfb0d052e Update opencv to 4.9.0
Enable ffmpeg and xine (now they are available on Fedora)
Really drop compat symlink for includes - rhbz#1830266
  Note: conditional builds with underscrore don't have _without option
  https://github.com/rpm-software-management/rpm/issues/1929
2024-02-05 11:38:06 +00:00
Sérgio M. Basto
c09c027f31 Remove unused patch 2024-02-05 11:36:21 +00:00
Sandro Mani
56850342e3 Rebuild (tesseract) 2024-01-28 11:33:36 +01:00
Fedora Release Engineering
057fbf10b8 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-25 11:14:46 +00:00
Fedora Release Engineering
53aa1a34a4 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 11:10:08 +00:00
Jonathan Wakely
8a7b907353 Rebuilt for TBB 2021.11 2024-01-17 23:45:11 +00:00
Benjamin A. Beasley
f547902cbb Backport support for protobuf v22 and later from opencv 4.9.0 2024-01-11 10:58:50 -05:00
Sandro Mani
98cbcd26f4 Rebuild (gdal) 2023-11-16 09:18:20 +01:00
Sandro Mani
45ae591b34 Rebuild (tesseract) 2023-10-07 23:54:32 +02:00
Sérgio M. Basto
fb84438736 Update opencv to 4.8.1 2023-09-30 05:19:56 +01:00
Yaakov Selkowitz
ef2f6e9368 Fix upgradability issues 2023-09-29 10:44:39 -04:00
Yaakov Selkowitz
b2d277d847 Separate per-module subpackages (#1878320) 2023-09-22 15:15:23 -04:00
Sérgio M. Basto
cdd8f4a19e Upgrade C++ standard to C++17 for protobuf v4 (23.x etc.) 2023-08-07 01:42:39 +01:00
Sérgio M. Basto
06c4df6d4f add WeChat QRCode
CNN models for wechat_qrcode module, including the detector model and the super scale model.

https://github.com/WeChatCV/opencv_3rdparty

the WeChatCV project added code in opencv_contrib
2023-08-07 01:35:26 +01:00
Sérgio M. Basto
193d86a5be Update opencv to 4.8.0
Use bundle flatbuffers, tried build with flatbuffers from system but doesn't build
Use oneVPL instead libmfx
2023-08-07 01:33:58 +01:00
Fedora Release Engineering
464361d6d8 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 18:01:40 +00:00
Josef Řídký
7765b04b32 Migrate to SPDX license format 2023-07-19 08:47:19 +02:00
Sandro Mani
2076a686c0 Rebuild (tesseract) 2023-07-14 12:46:49 +02:00
Mamoru TASAKA
305eb44cc9 bump release 2023-07-07 20:27:08 +09:00
Mamoru TASAKA
05aad33f58 Drop openni support on i686 as it is no longer available 2023-07-07 20:26:27 +09:00
Python Maint
025de760b3 Rebuilt for Python 3.12 2023-07-03 13:58:12 +02:00
Nicolas Chauvet
69d8bc93aa Rebuilt 2023-06-12 21:52:13 +02:00
Nicolas Chauvet
964c2286f1 Upstream commit to fix rhbz#2190013 2023-06-12 19:51:02 +02:00
Sérgio M. Basto
0a1c546e48 Reverts things that were accidentally committed and not yet completed 2023-05-15 00:33:17 +01:00
Sérgio M. Basto
753e8836e0 Install egg-info in python3_sitearch to stay in same location as the rest of python 2023-05-14 17:12:55 +01:00
Sérgio M. Basto
6b8b992f8e The %ldconfig_scriptlets macro can be removed on all Fedoras.
Possibly also on EPEL 8. But it is required on EPEL 7.
2023-05-14 15:49:13 +01:00
Sérgio M. Basto
95f94bb5f4 Obsolete python2 only < %{version} 2023-05-13 06:42:18 +01:00
Sérgio M. Basto
6b1e0637b2 Fix patch warning 2023-05-13 06:31:35 +01:00
Sérgio M. Basto
4a71091ffe Install python egg-info 2023-05-13 06:30:55 +01:00
Sérgio M. Basto
b23a2b4828 Update changelog 2023-05-11 22:57:11 +01:00
Sérgio M. Basto
8c68605e1d Disable tests, even only tests, fail to build
and generate build.log with millions of logs lines saying:

*** stack smashing detected ***: terminated

cat build.log | grep smashing | wc -l
118308609
2023-05-11 22:36:12 +01:00
Sérgio M. Basto
9c945dfe13 disable extra tests on builds 2023-05-11 22:29:53 +01:00
Sandro Mani
5be2c955a7 Rebuild (gdal) 2023-05-11 14:40:55 +02:00
Sérgio M. Basto
74127b74f8 if without tests also disable 500MB of extra tests 2023-04-14 16:59:44 +01:00
Sandro Mani
f34e95b282 Re-enable tests 2023-04-06 12:34:18 +02:00
Sandro Mani
6c1185b511 Temporarily disable hanging tests to get a build through 2023-04-06 09:53:41 +02:00
Sandro Mani
d6447a1e41 Rebuild (tesseract) 2023-04-03 13:23:16 +02:00
Fedora Release Engineering
befc826336 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 22:47:33 +00:00
Orion Poplawski
763c00715c Rebuild for vtk 9.2.5 2023-01-14 19:30:30 -07:00
Sérgio M. Basto
ac7a4a346f autosetup not handle multiple "-a<num>" parameters 2023-01-14 22:59:24 +00:00
Sérgio M. Basto
7a0bd6ebe2 Update opencv to 4.7.0 (#2157121) 2023-01-14 21:04:10 +00:00
Sandro Mani
3533c9622f Rebuild (tesseract) 2022-12-23 22:00:14 +01:00
Nicolas Chauvet
968dad82b9 Rebuilt for tesseract 2022-12-23 18:25:20 +01:00
Sandro Mani
80223d8933 Rebuild (gdal) 2022-11-12 19:00:48 +01:00
Sérgio M. Basto
bae9829c7f Fix test and extra build, export make the diference with %ctest , also
fix cmake macros changes arround 2020-07-29
2022-10-09 20:38:26 +01:00
Sérgio M. Basto
c2e1ca1d31 opencv support for epel9 2022-10-08 01:47:46 +01:00
Sérgio M. Basto
bc3e3bc266 Set linters as optional, adaptation of Diego Herrera PR
https://src.fedoraproject.org/rpms/opencv/pull-request/17#
2022-10-01 15:19:55 +01:00
Tom Rix
07e2572dcb Remove unicap
Upstream removed unicap support around 4.0 with this change

commit 5869415a57524cf2dfb5eaba5aafa86ceb395d15 (HEAD)
Author: Alexander Alekhin <alexander.alekhin@intel.com>
Date:   Wed Nov 7 19:49:09 2018 +0300

    videoio: drop obsolete backends

    - VFW
    - QuickTime/QtKit
    - Unicap - GPL, no active support: https://github.com/unicap/unicap
    - DC1394 (1st version) / CMU1394

So remove the configury and build requires for unicap.

Reported-by: Robert Scheck <redhat-bugzilla@linuxnetz.de>
Signed-off-by: Tom Rix <trix@redhat.com>
2022-09-28 18:05:30 -07:00
Mamoru TASAKA
a81f14f90a BR vte-java only on %java_arches 2022-07-29 01:01:49 +09:00
Fedora Release Engineering
d120efa9ea Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-22 02:03:29 +00:00
Sandro Mani
e1ab0faa41 Rebuild (tesseract) 2022-07-08 10:50:24 +02:00
Sérgio M. Basto
4b9a0658c8 (#2104082) only build Java sub package on arches that java is supported 2022-07-06 14:51:36 +01:00
Sérgio M. Basto
e8bdd3b6ca remove unused patch 2022-06-20 20:15:36 +01:00
Sérgio M. Basto
2eb243a8da Rebuilt for Python 3.11 (is just arrived to rawhide) 2022-06-20 15:52:24 +01:00
Sérgio M. Basto
8d3790a855 Update opencv to 4.6.0 (#2094603)
Remove hack to keep old so version
Adapt spec to new so version ${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR_2DIGITS}
  and drop OPENCV_VERSION_PATCH
2022-06-18 05:01:43 +01:00
Sérgio M. Basto
69ea132829 remove hack to keep old so version 2022-06-18 00:43:45 +01:00
Python Maint
6b89fb12ba Rebuilt for Python 3.11 2022-06-14 09:33:06 +02:00
Sérgio M. Basto
95176bb413 Disable PRECOMPILED_HEADERS is not needed anymore 2022-05-29 18:06:42 +01:00
Sandro Mani
9e8ea0958f Make doc package arched 2022-05-21 22:44:08 +02:00
Sandro Mani
478358c96b Rebuild for gdal-3.5.0 and/or openjpeg-2.5.0 2022-05-21 18:00:12 +02:00
Sérgio M. Basto
feee2b1ca8 Switch to new Python loader, doesn't fix rhbz #2054951 but can be a step 2022-04-14 15:56:55 +01:00
Nicolas Chauvet
d9eb86cc34 On RHEL libva is x86_64 only
Done also in fedora to simplify
see also rhbz#2058802
2022-03-30 17:26:02 +02:00
Nicolas Chauvet
8b91b9f51f Drop 1394 on rhel 2022-03-30 17:23:45 +02:00
Sérgio M. Basto
27e100e162 allow not include extras with his 500 MB 2022-03-20 04:11:08 +00:00
Sérgio M. Basto
6eab18dcc3 opencv package dont need setup_vars
we may turn OFF setup_vars_opencv
2022-03-20 04:07:40 +00:00
Sandro Mani
30d51f5a61 Rebuild for tesseract-5.1.0 2022-03-10 00:16:09 +01:00
Sérgio M. Basto
f873fc3d71 The upstream fix https://github.com/opencv/opencv/pull/21614
and remove the previous workaround
2022-02-15 14:39:37 +00:00
Sérgio M. Basto
a17785dfcd add comment with more information about the workaround on ppc64le 2022-02-13 20:06:05 +00:00
Mamoru TASAKA
10a0fa3a19 Disable some altivec vectorization optimization on ppc64le (bug 2051193) 2022-02-13 22:42:00 +09:00
Jiri
9211c6b534 Rebuilt for java-17-openjdk as system jdk
https://fedoraproject.org/wiki/Changes/Java17
2022-02-05 23:13:22 +01:00
Fedora Release Engineering
6bf54b5d27 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 22:20:26 +00:00
Sérgio M. Basto
7a7944b9e7 Update opencv to 4.5.5 (#2035628) 2021-12-28 17:19:57 +00:00
Sandro Mani
c0ffc90083 Rebuild (tesseract) 2021-12-19 18:58:21 +01:00
Sandro Mani
7fcdce3f44 Rebuild (tesseract) 2021-12-14 14:57:44 +01:00
Orion Poplawski
606e86c6b1 Rebuild for hdf5 1.12.1 2021-11-22 12:13:46 -07:00
Sandro Mani
65130b65fb Rebuild (gdal) 2021-11-11 12:08:28 +01:00
Adrian Reber
b3d22ee509
Rebuilt for protobuf 3.19.0 2021-11-06 12:59:56 +01:00
Adrian Reber
e52407b01d
Rebuilt for protobuf 3.19.0 2021-11-05 23:22:33 +01:00
Adrian Reber
9e9a395ba3
Rebuilt for protobuf 3.18.1 2021-10-25 08:57:11 +02:00
Sérgio M. Basto
9d58856c22 Update to 4.5.4 2021-10-10 23:54:27 +01:00
Sérgio M. Basto
c810b39bfb Use %py_provides and remove srcname variable 2021-10-10 14:30:22 +01:00
Richard Shaw
37d3d10b19 Rebuild for OpenEXR/Imath 3.1. 2021-08-20 18:30:27 -05:00
Orion Poplawski
0ecf696d0e Rebuild for hdf5 1.10.7 2021-08-09 20:10:28 -06:00
Richard Shaw
fe7fb71bd8 Rebuild for OpenEXR/Imath 3. 2021-07-31 11:08:14 -05:00
Fedora Release Engineering
0deaaace01 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 17:12:21 +00:00
Richard Shaw
720ac91eaa Rebuild for openexr 3. 2021-07-20 07:12:58 -05:00
Sérgio M. Basto
6b1661459f Update to 4.5.3 2021-07-17 01:24:53 +01:00
Python Maint
23acf4b4a3 Rebuilt for Python 3.10 2021-06-04 20:13:48 +02:00
Sandro Mani
3e129d6efd Rebuild (gdal) 2021-05-21 20:28:17 +02:00
Richard Shaw
9b14a65750 Rebuild for gdal 3.3.0. 2021-05-20 10:56:13 -05:00
Sandro Mani
16450b4634 Rebuild (gdal) 2021-05-07 12:13:31 +02:00
Sérgio M. Basto
9f66169420 Upstream fixed GCC11 issues, so we can re-enable the tests 2021-04-30 10:20:46 +01:00
Nicolas Chauvet
6b9379fedf Update to 4.5.2 2021-04-03 11:07:46 +02:00
Nicolas Chauvet
05673093bb Fixup 2021-03-31 17:16:34 +02:00
Nicolas Chauvet
6a41b2a532 Update changelog 2021-03-31 15:12:55 +02:00
Nicolas Chauvet
add0af2a88 Disable tests for now 2021-03-31 15:12:29 +02:00
Nicolas Chauvet
311f2f5e30 Attempt to fix build 2021-03-31 12:01:50 +02:00
Jonathan Wakely
c181e0be61 Rebuilt for removed libstdc++ symbol (#1937698) 2021-03-31 09:09:08 +02:00
Nicolas Chauvet
8b199e9c33 Add cuda_dnn option 2021-03-12 17:31:24 +01:00
Nicolas Chauvet
e2830d3e00 Update with_cuda options
Initial patch from "Eric Sandeen <esandeen@redhat.com>"
See rhbz#1938054
2021-03-12 17:31:17 +01:00
Jiri Kucera
0a5887a0d1 Fix file lists
Based on comparison of `opencv-4.5.1/modules/` and
`opencv-4.5.1/opencv_contrib-4.5.1/modules/`, move
some *.so's between core and contrib rpms.
2021-02-10 15:54:49 +01:00
Orion Poplawski
6052aa5107 Rebuild for VTK 9 2021-01-31 09:11:02 -07:00
Tomas Popela
1f613a5952 Drop unused BR on SFML and disable VTK support on RHEL 8+ 2021-01-28 08:05:17 +01:00
Fedora Release Engineering
33789082e3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 22:29:00 +00:00
Adrian Reber
4054376b36
Rebuilt for protobuf 3.14 2021-01-12 14:20:58 +01:00
Nicolas Chauvet
64e493f1d2 Disable lto on all arches #1910121 2021-01-11 20:16:08 +01:00
Sérgio M. Basto
f3284ced7d Update to 4.5.1 2021-01-03 23:34:09 +00:00
Sérgio M. Basto
076923ec6d remove old defines that aren't in use 2021-01-02 20:21:38 +00:00
Richard Shaw
ea40db6e60 Rebuild for OpenEXR 2.5.3. 2021-01-01 16:21:33 -06:00
Jeff Law
8d08ab7e12 Fix missing #include for gcc-11 2020-12-05 16:35:23 -07:00
Sandro Mani
7b959abfa3 Rebuild (proj, gdal) 2020-11-12 13:11:00 +01:00
Sérgio M. Basto
dfdbb6495c Update 4.5.0 2020-10-20 23:11:52 +01:00
Adrian Reber
f4647943a4
Rebuilt for protobuf 3.13 2020-09-24 07:36:56 +02:00
Sérgio M. Basto
d8ec2071a8 Disable LTO on ppc64le, add undefine __cmake_in_source_build to allow build on Fedora < 33 2020-08-02 01:30:04 +01:00
Sérgio M. Basto
5f489979f2 Fix cmake build 2020-07-29 01:04:56 +01:00
Sérgio M. Basto
fb2c54e4ff Fix cmake build 2020-07-28 23:40:37 +01:00
Nicolas Chauvet
9e86c663f2 fixup 2020-07-28 09:03:47 +02:00
Nicolas Chauvet
f75af83ce7 Fix cmake_install 2020-07-28 08:59:16 +02:00
Nicolas Chauvet
bceb48cb64 Switch to cmake_build,install 2020-07-28 08:15:32 +02:00
Nicolas Chauvet
663cf5c0ba CV_TRACE OFF 2020-07-27 09:46:41 +02:00
Nicolas Chauvet
02774e9201 Install face_landmark_model 2020-07-27 09:46:17 +02:00
Nicolas Chauvet
89f9da9d18 Rebuilt 2020-07-24 12:24:48 +02:00
Jiri
eeabf8bd1c Rebuilt for JDK-11 2020-07-11 03:42:02 +02:00
Orion Poplawski
1c5682e5aa Rebuild for hdf5 1.10.6 2020-06-25 20:07:59 -06:00
Adrian Reber
a1de500a5d
Rebuilt for protobuf 3.12 2020-06-23 14:26:37 +02:00
Sérgio M. Basto
394be8c0da Readd flake8 build requirement
Fix build because pangox has been retired for F33 so we need remove the BR
  gtkglext
Also remove all gtk stuff (we have to choose between gtk or qt when build opencv)
  https://answers.opencv.org/question/215066/gtk-or-qt-when-build-opencv/
Doxygen requires gtk2, disabling for now
2020-06-22 01:08:53 +01:00
Adrian Reber
edc24a2596
Rebuilt for protobuf 3.12 2020-06-21 17:23:51 +02:00
Sérgio M. Basto
38c46099f0 Revert "Add full path to ade location"
Because we need copy file with the name
b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip copy with name v0.1.1f.zip doesn't work

Reference:
install -pm 0644 /builddir/build/SOURCES/b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip .cache/ade/
2020-06-06 07:34:00 +01:00
Nicolas Chauvet
7f1071138a fixup opencv_extra-clean 2020-06-04 17:31:17 +02:00
Nicolas Chauvet
90a9444123 fixup_date 2020-06-04 17:25:00 +02:00
Sérgio M. Basto
e838799268 Add full path to ade location 2020-06-04 17:22:17 +02:00
Sérgio M. Basto
41bf1081fa Generates the variable javaver instead of setting it manually 2020-06-04 17:20:06 +02:00
Sérgio M. Basto
9506b6566a Delete old patches 2020-06-04 17:17:49 +02:00
Orion Poplawski
66ce8244e8 - Run tests 2020-06-02 21:39:12 -06:00
Orion Poplawski
656fd9bcc5 Add upstream patches for VTK 9.0 support (bz#1840977) 2020-06-02 20:32:22 -06:00
Nicolas Chauvet
99add5aa1c Disable vtk for now - rhbz#45140228 2020-05-29 15:30:04 +02:00
Nicolas Chauvet
b0c14a21fb Fixup date 2020-05-29 14:48:37 +02:00
Nicolas Chauvet
17d4b123ba Update to 4.3.0 2020-05-28 17:11:38 +02:00
Charalampos Stratakis
940542629b Remove flake8 build requirement 2020-05-28 16:34:44 +02:00
Miro Hrončok
e3a5a2c2f5 Rebuilt for Python 3.9 2020-05-26 02:54:55 +02:00
Sandro Mani
6f9cc15be1 Add opencv_vulkan.patch 2020-05-21 21:35:52 +02:00
Sandro Mani
f981fcc611 Rebuild (gdal) 2020-05-21 12:00:17 +02:00
Nicolas Chauvet
f5498f0349 Drop compat symlink for includes 2020-05-08 12:15:06 +02:00
Nicolas Chauvet
d4fbc923e1 Update changelog 2020-03-26 09:11:45 +01:00
Nicolas Chauvet
bc40108ce3 Add without_compat_opencv_pc with conditional 2020-03-26 09:10:36 +01:00
Sandro Mani
4971907f32 Rebuild (gdal) 2020-03-03 17:24:28 +01:00
Fedora Release Engineering
6a28689f2c - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-29 20:15:14 +00:00
Nicolas Chauvet
17b29490a6 Apply patch 2020-01-29 08:49:46 +01:00
Nicolas Chauvet
cf9c4d33e8 Add changelog 2020-01-29 08:34:31 +01:00
Nicolas Chauvet
cbd19933e6 Backport patch for ppc64le 2020-01-29 08:33:29 +01:00
Nicolas Chauvet
78aebdcfef Revert "Disable intrinsincs for ppc64le"
This reverts commit dcd968ae99.
2020-01-29 08:32:36 +01:00
Nicolas Chauvet
dcd968ae99 Disable intrinsincs for ppc64le
Upstream report
https://github.com/opencv/opencv/issues/16448
2020-01-28 08:49:11 +01:00
Nicolas Chauvet
635cf81c73 Backport patch for OpenEXR 2020-01-28 08:13:25 +01:00
Nicolas Chauvet
b10a4597d0 Update sources 2020-01-28 00:28:38 +01:00
Nicolas Chauvet
c1b0305054 Enable GAPI 2020-01-27 20:03:40 +01:00
kwizart
72cfdb0d6b Update to 4.2.0 2020-01-27 20:03:40 +01:00
Sandro Mani
e5c39757ef Rebuild (tesseract) 2019-12-28 20:19:49 +01:00
kwizart
ee1708bbb5 Drop libmfx from i686 - rhbz#1785079 2019-12-19 09:14:25 +01:00
Nicolas Chauvet
51372b96b3 Update changelog 2019-12-19 09:13:00 +01:00
Nicolas Chauvet
1553529958 Restore deprecated headers 2019-12-19 09:13:00 +01:00
Nicolas Chauvet
63414db18c Update changelog 2019-12-19 09:13:00 +01:00
Nicolas Chauvet
159a977bbd Add compat symlinks 2019-12-19 09:13:00 +01:00
Nicolas Chauvet
e8eab8a9ac Fix includes for opencv2 2019-12-19 09:13:00 +01:00
Nicolas Chauvet
ed49812c44 Lower CPU_BASELINE from SSE3 to SSE2 2019-12-19 09:13:00 +01:00
Nicolas Chauvet
9fd3a5e294 Add missing directory ownership 2019-12-19 09:13:00 +01:00
Nicolas Chauvet
c56d1e400a Update to 4.1.2 2019-12-19 09:13:00 +01:00
Orion Poplawski
4bae675be5 Rebuild for protobuf 3.11 2019-12-18 20:19:45 -07:00
Sérgio M. Basto
fef2a5b4be Fix sources file 2019-10-14 00:35:04 +01:00
Sérgio M. Basto
9f377b8d9d Update sources file 2019-10-14 00:28:41 +01:00
Sérgio M. Basto
d6b2548b11 Update to 4.1.2 2019-10-13 23:57:58 +01:00
Nicolas Chauvet
79b7475e7a Fixed gdcm in f32 2019-10-08 12:02:45 +02:00
Nicolas Chauvet
854a97fb82 Fix Summary not C 2019-10-08 10:19:28 +02:00
Sérgio M. Basto
6e473cb511 Fix cmake files location, apply patch0 and add data/opencv4/quality
files into package
2019-09-14 19:06:39 +01:00
Nicolas Chauvet
0b310fe8cd clean-up 2019-09-14 09:18:17 +02:00
Nicolas Chauvet
4be4395d12 Apply old patch 2019-09-14 09:18:03 +02:00
Nicolas Chauvet
2f290e9073 Remove unused sources 2019-09-14 09:16:01 +02:00
Nicolas Chauvet
d887b09f69 Revert "Remove old patch"
This reverts commit 6d86e3fb86.
2019-09-14 09:01:53 +02:00
Christopher N. Hesse
6376b30194 Add vulkan 2019-09-13 23:58:06 +02:00
Sérgio Basto
a7f630433d Update to 4.1.0 2019-09-13 23:57:36 +02:00
Nicolas Chauvet
6d86e3fb86 Remove old patch 2019-09-13 23:56:47 +02:00
Nicolas Chauvet
d289fced97 Switch to libGL-devel 2019-09-13 23:56:47 +02:00
Nicolas Chauvet
428f643a93 Update to 4.1.1 2019-09-13 23:56:47 +02:00
Nicolas Chauvet
8e36afc541 Switch to https 2019-09-13 23:55:59 +02:00
Nicolas Chauvet
3227082292 Add cuda dependencies 2019-09-13 23:55:59 +02:00
Nicolas Chauvet
8ea0db1b86 Switch to use _cuda_prefix 2019-09-13 23:55:59 +02:00
Sérgio M. Basto
6b88360f44 Reenable pylint and vtk, they are working now. 2019-09-13 22:45:58 +01:00
Mamoru TASAKA
319098a209 F-32: remove vtk gcdm dependency for now because they have broken dependency
(bug 1751406)
2019-09-12 07:42:01 +09:00
Miro Hrončok
1c92cba903 Drop the broken dependency on pylint 2019-08-22 20:43:52 +02:00
Miro Hrončok
f380cb6e0c Rebuilt for Python 3.8 2019-08-19 10:21:18 +02:00
Fedora Release Engineering
7ceebee30f - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 23:24:55 +00:00
Jerry James
eefb8f5021 Rebuild for coin-or package updates. 2019-06-27 20:48:18 -06:00
Sérgio M. Basto
f1638db7ab cmake: use relative PATH on OPENCV_CONFIG_INSTALL_PATH, fixes rhbz #1721876
cmake: don't set ENABLE_PKG_CONFIG
2019-06-26 22:08:14 +01:00
Sérgio M. Basto
44a97246a9 Remove Obsoletes/Provides libopencv_java.so and use OPENCV_JAR_INSTALL_PATH 2019-06-12 20:11:30 +01:00
Sérgio M. Basto
dd2b657bf3 Fix cmakes location 2019-06-10 20:52:37 +01:00
Sérgio M. Basto
2cdf5ee9b5 Fixed uploaded sources 2019-06-08 02:56:24 +01:00
Sérgio M. Basto
35e6529cd2 Update to 3.4.6 2019-06-08 02:23:51 +01:00
28 changed files with 3094 additions and 424 deletions

40
.gitignore vendored
View file

@ -1,32 +1,8 @@
OpenCV-2.1.0.tar.bz2
/OpenCV-2.2.0.tar.bz2
/OpenCV-2.3.1.tar.bz2
/OpenCV-2.3.1a.tar.bz2
/OpenCV-2.4.1.tar.bz2
/OpenCV-2.4.2.tar.bz2
/OpenCV-2.4.3.tar.bz2
/OpenCV-2.4.4-beta.tar.bz2
/OpenCV-2.4.4a.tar.bz2
/OpenCV-2.4.4a-clean.tar.bz2
/opencv-2.4.5-clean.tar.xz
/opencv-clean-2.4.6.1.tar.xz
/opencv-clean-2.4.7.tar.xz
/opencv-clean-2.4.9.tar.xz
/opencv-clean-2.4.11.tar.xz
/opencv-clean-2.4.12.3.tar.xz
/opencv_contrib-3.1.0.tar.gz
/opencv-3.1.0.tar.gz
/opencv_contrib-clean-3.1.0.tar.gz
/opencv-clean-3.2.0.tar.gz
/opencv-3.2.0.tar.gz
/opencv_contrib-clean-3.2.0.tar.gz
/opencv_contrib-clean-3.3.1.tar.gz
/opencv-clean-3.3.1.tar.gz
/opencv_contrib-clean-3.4.1.tar.gz
/opencv-clean-3.4.1.tar.gz
/opencv_contrib-clean-3.4.2.tar.gz
/opencv-clean-3.4.2.tar.gz
/opencv_contrib-clean-3.4.3.tar.gz
/opencv-clean-3.4.3.tar.gz
/opencv-clean-3.4.4.tar.gz
/opencv_contrib-clean-3.4.4.tar.gz
OpenCV*.tar.*
opencv*.tar.*
face_landmark_model.dat.xz
/b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip
/fa4b3e25167319cb0fa9432ef8281945-v0.1.2a.zip
/wechat-20230712.git3487ef7.tar.gz
/dbb095a8bf3008e91edbbf45d8d34885-v0.1.2d.zip
/962ce79e0b95591f226431f7b5f152cd-v0.1.2e.zip

19
.packit.yaml Normal file
View file

@ -0,0 +1,19 @@
# See the documentation for more information:
# https://packit.dev/docs/configuration/
# run opencv-clean.sh
# the sed currently hacks the script so that the version is correctly set and the sources upload is handled by Packit
actions:
pre-sync:
- bash -c "${PACKIT_DOWNSTREAM_REPO}/opencv-clean.sh ${PACKIT_PROJECT_VERSION}"
files_to_sync:
- src:
- "opencv*clean-*.tar.gz"
dest: .
jobs:
- job: pull_from_upstream
trigger: release
dist_git_branches:
- fedora-rawhide

View file

@ -0,0 +1,155 @@
From c399203e9861bf3ff5b976cd597b9820eee5d93a Mon Sep 17 00:00:00 2001
From: Vincent Rabaud <vrabaud@google.com>
Date: Fri, 10 Jan 2025 09:33:43 +0100
Subject: [PATCH 01/10] Merge pull request #26739 from vrabaud:png_leak
Add more boundary checks. #26739
Also fix a bug in read_chunk where we could end up with png_get_uint_32(len) + 12 < 4
### 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
- [x] 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
---
modules/imgcodecs/src/grfmt_png.cpp | 54 +++++++++++++++++------------
modules/imgcodecs/src/grfmt_png.hpp | 2 +-
2 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 6b4cea405c..744f244a20 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -255,11 +255,14 @@ bool PngDecoder::readHeader()
png_init_io(png_ptr, m_f);
}
- if (read_from_io(&sig, 8, 1) != 1)
+ // Read PNG header: 137 80 78 71 13 10 26 10
+ if (!read_from_io(&sig, 8))
return false;
id = read_chunk(m_chunkIHDR);
- if (!(id == id_IHDR && m_chunkIHDR.p.size() == 25))
+ // 8=HDR+size, 13=size of IHDR chunk, 4=CRC
+ // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.IHDR
+ if (!(id == id_IHDR && m_chunkIHDR.p.size() == 8 + 13 + 4))
{
return false;
}
@@ -283,23 +286,25 @@ bool PngDecoder::readHeader()
break;
}
- if (id == id_acTL && chunk.p.size() == 20)
+ if (id == id_acTL)
{
+ // 8=HDR+size, 8=size of acTL chunk, 4=CRC
+ // https://wiki.mozilla.org/APNG_Specification#%60acTL%60:_The_Animation_Control_Chunk
+ if (chunk.p.size() != 8 + 8 + 4)
+ return false;
m_animation.loop_count = png_get_uint_32(&chunk.p[12]);
- if (chunk.p[8] > 0)
- {
- chunk.p[8] = 0;
- chunk.p[9] = 0;
- m_frame_count = png_get_uint_32(&chunk.p[8]);
- m_frame_count++;
- }
- else
- m_frame_count = png_get_uint_32(&chunk.p[8]);
+ m_frame_count = png_get_uint_32(&chunk.p[8]);
+ if (m_frame_count == 0)
+ return false;
}
if (id == id_fcTL)
{
+ // 8=HDR+size, 26=size of fcTL chunk, 4=CRC
+ // https://wiki.mozilla.org/APNG_Specification#%60fcTL%60:_The_Frame_Control_Chunk
+ if (chunk.p.size() != 8 + 26 + 4)
+ return false;
m_is_fcTL_loaded = true;
w0 = png_get_uint_32(&chunk.p[12]);
h0 = png_get_uint_32(&chunk.p[16]);
@@ -313,6 +318,11 @@ bool PngDecoder::readHeader()
if (id == id_bKGD)
{
+ // 8=HDR+size, ??=size of bKGD chunk, 4=CRC
+ // The spec is actually more complex: http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
+ // TODO: we only check that 4 bytes can be read from &chunk.p[8]. Fix.
+ if (chunk.p.size() < 8 + 4)
+ return false;
int bgcolor = png_get_uint_32(&chunk.p[8]);
m_animation.bgcolor[3] = (bgcolor >> 24) & 0xFF;
m_animation.bgcolor[2] = (bgcolor >> 16) & 0xFF;
@@ -669,34 +679,34 @@ void PngDecoder::compose_frame(std::vector<png_bytep>& rows_dst, const std::vect
});
}
-size_t PngDecoder::read_from_io(void* _Buffer, size_t _ElementSize, size_t _ElementCount)
+bool PngDecoder::read_from_io(void* buffer, size_t num_bytes)
{
if (m_f)
- return fread(_Buffer, _ElementSize, _ElementCount, m_f);
+ return fread(buffer, 1, num_bytes, m_f) == num_bytes;
- if (m_buf_pos + _ElementSize > m_buf.cols * m_buf.rows * m_buf.elemSize()) {
+ if (m_buf_pos + num_bytes > m_buf.cols * m_buf.rows * m_buf.elemSize()) {
CV_LOG_WARNING(NULL, "PNG input buffer is incomplete");
- return 0;
+ return false;
}
- memcpy( _Buffer, m_buf.ptr() + m_buf_pos, _ElementSize );
- m_buf_pos += _ElementSize;
- return 1;
+ memcpy( buffer, m_buf.ptr() + m_buf_pos, num_bytes );
+ m_buf_pos += num_bytes;
+ return true;
}
uint32_t PngDecoder::read_chunk(Chunk& chunk)
{
unsigned char len[4];
- if (read_from_io(&len, 4, 1) == 1)
+ if (read_from_io(&len, 4))
{
- const size_t size = png_get_uint_32(len) + 12;
+ const size_t size = static_cast<size_t>(png_get_uint_32(len)) + 12;
if (size > PNG_USER_CHUNK_MALLOC_MAX)
{
CV_LOG_WARNING(NULL, "chunk data is too large");
}
chunk.p.resize(size);
memcpy(chunk.p.data(), len, 4);
- if (read_from_io(&chunk.p[4], chunk.p.size() - 4, 1) == 1)
+ if (read_from_io(&chunk.p[4], chunk.p.size() - 4))
return *(uint32_t*)(&chunk.p[4]);
}
return 0;
diff --git a/modules/imgcodecs/src/grfmt_png.hpp b/modules/imgcodecs/src/grfmt_png.hpp
index a950b9e941..dec2cd0b61 100644
--- a/modules/imgcodecs/src/grfmt_png.hpp
+++ b/modules/imgcodecs/src/grfmt_png.hpp
@@ -137,7 +137,7 @@ protected:
bool processing_start(void* frame_ptr, const Mat& img);
bool processing_finish();
void compose_frame(std::vector<png_bytep>& rows_dst, const std::vector<png_bytep>& rows_src, unsigned char bop, uint32_t x, uint32_t y, uint32_t w, uint32_t h, Mat& img);
- size_t read_from_io(void* _Buffer, size_t _ElementSize, size_t _ElementCount);
+ bool read_from_io(void* buffer, size_t num_bytes);
uint32_t read_chunk(Chunk& chunk);
struct PngPtrs {
--
2.48.1

View file

@ -0,0 +1,37 @@
From b7b84ec6364809306776b48206ad36266274c297 Mon Sep 17 00:00:00 2001
From: Vincent Rabaud <vrabaud@google.com>
Date: Fri, 10 Jan 2025 14:57:39 +0100
Subject: [PATCH 02/10] Fix remaining bugs in PNG reader
- free chunk before a potential longjmp
- do not try to allocate when the chunk is > PNG_USER_CHUNK_MALLOC_MAX
---
modules/imgcodecs/src/grfmt_png.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 744f244a20..1ecc01f17f 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -339,6 +339,10 @@ bool PngDecoder::readHeader()
png_bytep trans;
png_color_16p trans_values;
+ // Free chunk in case png_read_info uses longjmp.
+ chunk.p.clear();
+ chunk.p.shrink_to_fit();
+
png_read_info( png_ptr, info_ptr );
png_get_IHDR(png_ptr, info_ptr, &wdth, &hght,
&bit_depth, &color_type, 0, 0, 0);
@@ -703,6 +707,7 @@ uint32_t PngDecoder::read_chunk(Chunk& chunk)
if (size > PNG_USER_CHUNK_MALLOC_MAX)
{
CV_LOG_WARNING(NULL, "chunk data is too large");
+ return 0;
}
chunk.p.resize(size);
memcpy(chunk.p.data(), len, 4);
--
2.48.1

View file

@ -0,0 +1,654 @@
From c29de7cc4b89c80f7ee910f318dfc1bc462d576c Mon Sep 17 00:00:00 2001
From: Vincent Rabaud <vrabaud@google.com>
Date: Wed, 22 Jan 2025 12:47:28 +0100
Subject: [PATCH 03/10] Merge pull request #26782 from vrabaud:png_leak
Fix potential READ memory access #26782
This fixes https://oss-fuzz.com/testcase-detail/4923671881252864 and https://oss-fuzz.com/testcase-detail/5048650127966208
### 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
- [x] The PR is proposed to the proper branch
- [x] 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
---
modules/imgcodecs/src/grfmt_png.cpp | 394 ++++++++++++++--------------
modules/imgcodecs/src/grfmt_png.hpp | 53 +---
2 files changed, 206 insertions(+), 241 deletions(-)
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 1ecc01f17f..105288c5e5 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -198,6 +198,7 @@ PngDecoder::PngDecoder()
PngDecoder::~PngDecoder()
{
+ ClearPngPtr();
if( m_f )
{
fclose( m_f );
@@ -205,6 +206,26 @@ PngDecoder::~PngDecoder()
}
}
+bool PngDecoder::InitPngPtr() {
+ ClearPngPtr();
+
+ m_png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
+ if (!m_png_ptr)
+ return false;
+
+ m_info_ptr = png_create_info_struct(m_png_ptr);
+ m_end_info = png_create_info_struct(m_png_ptr);
+ return (m_info_ptr && m_end_info);
+}
+
+void PngDecoder::ClearPngPtr() {
+ if (m_png_ptr)
+ png_destroy_read_struct(&m_png_ptr, &m_info_ptr, &m_end_info);
+ m_png_ptr = nullptr;
+ m_info_ptr = nullptr;
+ m_end_info = nullptr;
+}
+
ImageDecoder PngDecoder::newDecoder() const
{
return makePtr<PngDecoder>();
@@ -227,167 +248,164 @@ void PngDecoder::readDataFromBuf( void* _png_ptr, unsigned char* dst, size_t si
bool PngDecoder::readHeader()
{
- volatile bool result = false;
+ // Declare dynamic variables before a potential longjmp.
+ Chunk chunk;
+
+ if (!InitPngPtr())
+ return false;
+
+ if (setjmp(png_jmpbuf(m_png_ptr)))
+ return false;
- PngPtrs png_ptrs;
- png_structp png_ptr = png_ptrs.getPng();
- png_infop info_ptr = png_ptrs.getInfo();
- png_infop end_info = png_ptrs.getEndInfo();
+ m_buf_pos = 0;
+ unsigned char sig[8];
+ uint32_t id = 0;
- if( png_ptr && info_ptr && end_info )
+ if( !m_buf.empty() )
+ png_set_read_fn(m_png_ptr, this, (png_rw_ptr)readDataFromBuf );
+ else
{
- m_buf_pos = 0;
- if( setjmp( png_jmpbuf( png_ptr ) ) == 0 )
+ m_f = fopen(m_filename.c_str(), "rb");
+ if (!m_f)
{
- unsigned char sig[8];
- uint32_t id = 0;
- Chunk chunk;
+ return false;
+ }
+ png_init_io(m_png_ptr, m_f);
+ }
- if( !m_buf.empty() )
- png_set_read_fn(png_ptr, this, (png_rw_ptr)readDataFromBuf );
- else
- {
- m_f = fopen(m_filename.c_str(), "rb");
- if (!m_f)
- {
- return false;
- }
- png_init_io(png_ptr, m_f);
- }
+ // Read PNG header: 137 80 78 71 13 10 26 10
+ if (!read_from_io(&sig, 8))
+ return false;
- // Read PNG header: 137 80 78 71 13 10 26 10
- if (!read_from_io(&sig, 8))
- return false;
+ id = read_chunk(m_chunkIHDR);
+ // 8=HDR+size, 13=size of IHDR chunk, 4=CRC
+ // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.IHDR
+ if (!(id == id_IHDR && m_chunkIHDR.p.size() == 8 + 13 + 4))
+ {
+ return false;
+ }
- id = read_chunk(m_chunkIHDR);
- // 8=HDR+size, 13=size of IHDR chunk, 4=CRC
- // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.IHDR
- if (!(id == id_IHDR && m_chunkIHDR.p.size() == 8 + 13 + 4))
- {
- return false;
- }
+ m_is_fcTL_loaded = false;
+ while (true)
+ {
+ id = read_chunk(chunk);
- while (true)
- {
- m_is_fcTL_loaded = false;
- id = read_chunk(chunk);
+ if (!id || (m_f && feof(m_f)) || (!m_buf.empty() && m_buf_pos > m_buf.total()))
+ {
+ return false;
+ }
- if (!id || (m_f && feof(m_f)) || (!m_buf.empty() && m_buf_pos > m_buf.total()))
- {
- return false;
- }
+ if (id == id_IDAT)
+ {
+ if (m_f)
+ fseek(m_f, 0, SEEK_SET);
+ else
+ m_buf_pos = 0;
+ break;
+ }
- if (id == id_IDAT)
- {
- if (m_f)
- fseek(m_f, 0, SEEK_SET);
- else
- m_buf_pos = 0;
- break;
- }
+ if (id == id_acTL)
+ {
+ // 8=HDR+size, 8=size of acTL chunk, 4=CRC
+ // https://wiki.mozilla.org/APNG_Specification#%60acTL%60:_The_Animation_Control_Chunk
+ if (chunk.p.size() != 8 + 8 + 4)
+ return false;
+ m_animation.loop_count = png_get_uint_32(&chunk.p[12]);
- if (id == id_acTL)
- {
- // 8=HDR+size, 8=size of acTL chunk, 4=CRC
- // https://wiki.mozilla.org/APNG_Specification#%60acTL%60:_The_Animation_Control_Chunk
- if (chunk.p.size() != 8 + 8 + 4)
- return false;
- m_animation.loop_count = png_get_uint_32(&chunk.p[12]);
-
- m_frame_count = png_get_uint_32(&chunk.p[8]);
- if (m_frame_count == 0)
- return false;
- }
+ m_frame_count = png_get_uint_32(&chunk.p[8]);
+ if (m_frame_count == 0)
+ return false;
+ }
- if (id == id_fcTL)
- {
- // 8=HDR+size, 26=size of fcTL chunk, 4=CRC
- // https://wiki.mozilla.org/APNG_Specification#%60fcTL%60:_The_Frame_Control_Chunk
- if (chunk.p.size() != 8 + 26 + 4)
- return false;
- m_is_fcTL_loaded = true;
- w0 = png_get_uint_32(&chunk.p[12]);
- h0 = png_get_uint_32(&chunk.p[16]);
- x0 = png_get_uint_32(&chunk.p[20]);
- y0 = png_get_uint_32(&chunk.p[24]);
- delay_num = png_get_uint_16(&chunk.p[28]);
- delay_den = png_get_uint_16(&chunk.p[30]);
- dop = chunk.p[32];
- bop = chunk.p[33];
- }
+ if (id == id_fcTL)
+ {
+ // 8=HDR+size, 26=size of fcTL chunk, 4=CRC
+ // https://wiki.mozilla.org/APNG_Specification#%60fcTL%60:_The_Frame_Control_Chunk
+ if (chunk.p.size() != 8 + 26 + 4)
+ return false;
+ m_is_fcTL_loaded = true;
+ w0 = png_get_uint_32(&chunk.p[12]);
+ h0 = png_get_uint_32(&chunk.p[16]);
+ x0 = png_get_uint_32(&chunk.p[20]);
+ y0 = png_get_uint_32(&chunk.p[24]);
+ delay_num = png_get_uint_16(&chunk.p[28]);
+ delay_den = png_get_uint_16(&chunk.p[30]);
+ dop = chunk.p[32];
+ bop = chunk.p[33];
+ }
- if (id == id_bKGD)
- {
- // 8=HDR+size, ??=size of bKGD chunk, 4=CRC
- // The spec is actually more complex: http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
- // TODO: we only check that 4 bytes can be read from &chunk.p[8]. Fix.
- if (chunk.p.size() < 8 + 4)
- return false;
- int bgcolor = png_get_uint_32(&chunk.p[8]);
- m_animation.bgcolor[3] = (bgcolor >> 24) & 0xFF;
- m_animation.bgcolor[2] = (bgcolor >> 16) & 0xFF;
- m_animation.bgcolor[1] = (bgcolor >> 8) & 0xFF;
- m_animation.bgcolor[0] = bgcolor & 0xFF;
- }
+ if (id == id_bKGD)
+ {
+ // 8=HDR+size, ??=size of bKGD chunk, 4=CRC
+ // The spec is actually more complex: http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
+ // TODO: we only check that 4 bytes can be read from &chunk.p[8]. Fix.
+ if (chunk.p.size() < 8 + 4)
+ return false;
+ int bgcolor = png_get_uint_32(&chunk.p[8]);
+ m_animation.bgcolor[3] = (bgcolor >> 24) & 0xFF;
+ m_animation.bgcolor[2] = (bgcolor >> 16) & 0xFF;
+ m_animation.bgcolor[1] = (bgcolor >> 8) & 0xFF;
+ m_animation.bgcolor[0] = bgcolor & 0xFF;
+ }
- if (id == id_PLTE || id == id_tRNS)
- m_chunksInfo.push_back(chunk);
- }
+ if (id == id_PLTE || id == id_tRNS)
+ m_chunksInfo.push_back(chunk);
+ }
- png_uint_32 wdth, hght;
- int bit_depth, color_type, num_trans=0;
- png_bytep trans;
- png_color_16p trans_values;
+ png_uint_32 wdth, hght;
+ int bit_depth, color_type, num_trans=0;
+ png_bytep trans;
+ png_color_16p trans_values;
- // Free chunk in case png_read_info uses longjmp.
- chunk.p.clear();
- chunk.p.shrink_to_fit();
+ // Free chunk in case png_read_info uses longjmp.
+ chunk.p.clear();
+ chunk.p.shrink_to_fit();
- png_read_info( png_ptr, info_ptr );
- png_get_IHDR(png_ptr, info_ptr, &wdth, &hght,
- &bit_depth, &color_type, 0, 0, 0);
+ png_read_info( m_png_ptr, m_info_ptr );
+ png_get_IHDR(m_png_ptr, m_info_ptr, &wdth, &hght,
+ &bit_depth, &color_type, 0, 0, 0);
- m_width = (int)wdth;
- m_height = (int)hght;
- m_color_type = color_type;
- m_bit_depth = bit_depth;
+ m_width = (int)wdth;
+ m_height = (int)hght;
+ m_color_type = color_type;
+ m_bit_depth = bit_depth;
- if (bit_depth <= 8 || bit_depth == 16)
- {
- switch (color_type)
- {
- case PNG_COLOR_TYPE_RGB:
- case PNG_COLOR_TYPE_PALETTE:
- png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &trans_values);
- if (num_trans > 0)
- m_type = CV_8UC4;
- else
- m_type = CV_8UC3;
- break;
- case PNG_COLOR_TYPE_GRAY_ALPHA:
- case PNG_COLOR_TYPE_RGB_ALPHA:
- m_type = CV_8UC4;
- break;
- default:
- m_type = CV_8UC1;
- }
- if (bit_depth == 16)
- m_type = CV_MAKETYPE(CV_16U, CV_MAT_CN(m_type));
- result = true;
- }
- }
- }
+ if (m_is_fcTL_loaded && (int(x0 + w0) > m_width || int(y0 + h0) > m_height || dop > 2 || bop > 1))
+ return false;
- if(result)
+ if (bit_depth <= 8 || bit_depth == 16)
{
- m_png_ptrs = std::move(png_ptrs);
+ switch (color_type)
+ {
+ case PNG_COLOR_TYPE_RGB:
+ case PNG_COLOR_TYPE_PALETTE:
+ png_get_tRNS(m_png_ptr, m_info_ptr, &trans, &num_trans, &trans_values);
+ if (num_trans > 0)
+ m_type = CV_8UC4;
+ else
+ m_type = CV_8UC3;
+ break;
+ case PNG_COLOR_TYPE_GRAY_ALPHA:
+ case PNG_COLOR_TYPE_RGB_ALPHA:
+ m_type = CV_8UC4;
+ break;
+ default:
+ m_type = CV_8UC1;
+ }
+ if (bit_depth == 16)
+ m_type = CV_MAKETYPE(CV_16U, CV_MAT_CN(m_type));
}
- return result;
+ return true;
}
bool PngDecoder::readData( Mat& img )
{
+ // Declare dynamic variables before a potential longjmp.
+ AutoBuffer<unsigned char*> _buffer(m_height);
+ unsigned char** buffer = _buffer.data();
+ Chunk chunk;
+
if (m_frame_count > 1)
{
Mat mat_cur = Mat::zeros(img.rows, img.cols, m_type);
@@ -412,13 +430,14 @@ bool PngDecoder::readData( Mat& img )
frameCur.setMat(mat_cur);
- processing_start((void*)&frameRaw, mat_cur);
- png_structp png_ptr = m_png_ptrs.getPng();
- png_infop info_ptr = m_png_ptrs.getInfo();
+ if (!processing_start((void*)&frameRaw, mat_cur))
+ return false;
+
+ if(setjmp(png_jmpbuf(m_png_ptr)))
+ return false;
while (true)
{
- Chunk chunk;
id = read_chunk(chunk);
if (!id)
return false;
@@ -482,14 +501,14 @@ bool PngDecoder::readData( Mat& img )
else if (id == id_IDAT)
{
m_is_IDAT_loaded = true;
- png_process_data(png_ptr, info_ptr, chunk.p.data(), chunk.p.size());
+ png_process_data(m_png_ptr, m_info_ptr, chunk.p.data(), chunk.p.size());
}
else if (id == id_fdAT && m_is_fcTL_loaded)
{
m_is_IDAT_loaded = true;
png_save_uint_32(&chunk.p[4], static_cast<uint32_t>(chunk.p.size() - 16));
memcpy(&chunk.p[8], "IDAT", 4);
- png_process_data(png_ptr, info_ptr, &chunk.p[4], chunk.p.size() - 4);
+ png_process_data(m_png_ptr, m_info_ptr, &chunk.p[4], chunk.p.size() - 4);
}
else if (id == id_IEND)
{
@@ -513,30 +532,24 @@ bool PngDecoder::readData( Mat& img )
return true;
}
else
- png_process_data(png_ptr, info_ptr, chunk.p.data(), chunk.p.size());
+ png_process_data(m_png_ptr, m_info_ptr, chunk.p.data(), chunk.p.size());
}
return false;
}
volatile bool result = false;
- AutoBuffer<unsigned char*> _buffer(m_height);
- unsigned char** buffer = _buffer.data();
bool color = img.channels() > 1;
- png_structp png_ptr = m_png_ptrs.getPng();
- png_infop info_ptr = m_png_ptrs.getInfo();
- png_infop end_info = m_png_ptrs.getEndInfo();
-
- if( png_ptr && info_ptr && end_info && m_width && m_height )
+ if( m_png_ptr && m_info_ptr && m_end_info && m_width && m_height )
{
- if( setjmp( png_jmpbuf ( png_ptr ) ) == 0 )
+ if( setjmp( png_jmpbuf ( m_png_ptr ) ) == 0 )
{
int y;
if( img.depth() == CV_8U && m_bit_depth == 16 )
- png_set_strip_16( png_ptr );
+ png_set_strip_16( m_png_ptr );
else if( !isBigEndian() )
- png_set_swap( png_ptr );
+ png_set_swap( m_png_ptr );
if(img.channels() < 4)
{
@@ -548,46 +561,46 @@ bool PngDecoder::readData( Mat& img )
* indicate that it is a good idea to always ask for
* stripping alpha.. 18.11.2004 Axel Walthelm
*/
- png_set_strip_alpha( png_ptr );
+ png_set_strip_alpha( m_png_ptr );
} else
- png_set_tRNS_to_alpha( png_ptr );
+ png_set_tRNS_to_alpha( m_png_ptr );
if( m_color_type == PNG_COLOR_TYPE_PALETTE )
- png_set_palette_to_rgb( png_ptr );
+ png_set_palette_to_rgb( m_png_ptr );
if( (m_color_type & PNG_COLOR_MASK_COLOR) == 0 && m_bit_depth < 8 )
#if (PNG_LIBPNG_VER_MAJOR*10000 + PNG_LIBPNG_VER_MINOR*100 + PNG_LIBPNG_VER_RELEASE >= 10209) || \
(PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR == 0 && PNG_LIBPNG_VER_RELEASE >= 18)
- png_set_expand_gray_1_2_4_to_8( png_ptr );
+ png_set_expand_gray_1_2_4_to_8( m_png_ptr );
#else
png_set_gray_1_2_4_to_8( png_ptr );
#endif
if( (m_color_type & PNG_COLOR_MASK_COLOR) && color && !m_use_rgb)
- png_set_bgr( png_ptr ); // convert RGB to BGR
+ png_set_bgr( m_png_ptr ); // convert RGB to BGR
else if( color )
- png_set_gray_to_rgb( png_ptr ); // Gray->RGB
+ png_set_gray_to_rgb( m_png_ptr ); // Gray->RGB
else
- png_set_rgb_to_gray( png_ptr, 1, 0.299, 0.587 ); // RGB->Gray
+ png_set_rgb_to_gray( m_png_ptr, 1, 0.299, 0.587 ); // RGB->Gray
- png_set_interlace_handling( png_ptr );
- png_read_update_info( png_ptr, info_ptr );
+ png_set_interlace_handling( m_png_ptr );
+ png_read_update_info( m_png_ptr, m_info_ptr );
for( y = 0; y < m_height; y++ )
buffer[y] = img.data + y*img.step;
- png_read_image( png_ptr, buffer );
- png_read_end( png_ptr, end_info );
+ png_read_image( m_png_ptr, buffer );
+ png_read_end( m_png_ptr, m_end_info );
#ifdef PNG_eXIf_SUPPORTED
png_uint_32 num_exif = 0;
png_bytep exif = 0;
// Exif info could be in info_ptr (intro_info) or end_info per specification
- if( png_get_valid(png_ptr, info_ptr, PNG_INFO_eXIf) )
- png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif);
- else if( png_get_valid(png_ptr, end_info, PNG_INFO_eXIf) )
- png_get_eXIf_1(png_ptr, end_info, &num_exif, &exif);
+ if( png_get_valid(m_png_ptr, m_info_ptr, PNG_INFO_eXIf) )
+ png_get_eXIf_1(m_png_ptr, m_info_ptr, &num_exif, &exif);
+ else if( png_get_valid(m_png_ptr, m_end_info, PNG_INFO_eXIf) )
+ png_get_eXIf_1(m_png_ptr, m_end_info, &num_exif, &exif);
if( exif && num_exif > 0 )
{
@@ -719,42 +732,34 @@ uint32_t PngDecoder::read_chunk(Chunk& chunk)
bool PngDecoder::processing_start(void* frame_ptr, const Mat& img)
{
- static uint8_t header[8] = { 137, 80, 78, 71, 13, 10, 26, 10 };
-
- PngPtrs png_ptrs;
- png_structp png_ptr = png_ptrs.getPng();
- png_infop info_ptr = png_ptrs.getInfo();
-
- if (!png_ptr || !info_ptr) {
+ if (!InitPngPtr())
return false;
- }
- if (setjmp(png_jmpbuf(png_ptr)))
- {
+ if (setjmp(png_jmpbuf(m_png_ptr)))
return false;
- }
- m_png_ptrs = std::move(png_ptrs);
- png_set_crc_action(png_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
- png_set_progressive_read_fn(png_ptr, frame_ptr, (png_progressive_info_ptr)info_fn, row_fn, NULL);
+ static uint8_t header[8] = { 137, 80, 78, 71, 13, 10, 26, 10 };
+
+ png_set_crc_action(m_png_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
+ png_set_progressive_read_fn(m_png_ptr, frame_ptr, (png_progressive_info_ptr)info_fn, row_fn, NULL);
if (img.channels() < 4)
- png_set_strip_alpha(png_ptr);
+ png_set_strip_alpha(m_png_ptr);
else
- png_set_tRNS_to_alpha(png_ptr);
+ png_set_tRNS_to_alpha(m_png_ptr);
- png_process_data(png_ptr, info_ptr, header, 8);
- png_process_data(png_ptr, info_ptr, m_chunkIHDR.p.data(), m_chunkIHDR.p.size());
+ png_process_data(m_png_ptr, m_info_ptr, header, 8);
+ png_process_data(m_png_ptr, m_info_ptr, m_chunkIHDR.p.data(), m_chunkIHDR.p.size());
if ((m_color_type & PNG_COLOR_MASK_COLOR) && img.channels() > 1 && !m_use_rgb)
- png_set_bgr(png_ptr); // convert RGB to BGR
+ png_set_bgr(m_png_ptr); // convert RGB to BGR
else if (img.channels() > 1)
- png_set_gray_to_rgb(png_ptr); // Gray->RGB
+ png_set_gray_to_rgb(m_png_ptr); // Gray->RGB
else
- png_set_rgb_to_gray(png_ptr, 1, 0.299, 0.587); // RGB->Gray
+ png_set_rgb_to_gray(m_png_ptr, 1, 0.299, 0.587); // RGB->Gray
for (size_t i = 0; i < m_chunksInfo.size(); i++)
- png_process_data(png_ptr, info_ptr, m_chunksInfo[i].p.data(), m_chunksInfo[i].p.size());
+ png_process_data(m_png_ptr, m_info_ptr, m_chunksInfo[i].p.data(), m_chunksInfo[i].p.size());
return true;
}
@@ -763,22 +768,17 @@ bool PngDecoder::processing_finish()
{
static uint8_t footer[12] = { 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130 };
- png_structp png_ptr = m_png_ptrs.getPng();
- png_infop info_ptr = m_png_ptrs.getInfo();
-
- if (!png_ptr) {
- m_png_ptrs.clear();
+ if (!m_png_ptr) {
return false;
}
- if (setjmp(png_jmpbuf(png_ptr)))
+ if (setjmp(png_jmpbuf(m_png_ptr)))
{
- m_png_ptrs.clear();
return false;
}
- png_process_data(png_ptr, info_ptr, footer, 12);
- m_png_ptrs.clear();
+ png_process_data(m_png_ptr, m_info_ptr, footer, 12);
+ ClearPngPtr();
return true;
}
diff --git a/modules/imgcodecs/src/grfmt_png.hpp b/modules/imgcodecs/src/grfmt_png.hpp
index dec2cd0b61..5dfc86efcc 100644
--- a/modules/imgcodecs/src/grfmt_png.hpp
+++ b/modules/imgcodecs/src/grfmt_png.hpp
@@ -130,56 +130,21 @@ public:
ImageDecoder newDecoder() const CV_OVERRIDE;
-protected:
+private:
static void readDataFromBuf(void* png_ptr, uchar* dst, size_t size);
static void info_fn(png_structp png_ptr, png_infop info_ptr);
static void row_fn(png_structp png_ptr, png_bytep new_row, png_uint_32 row_num, int pass);
- bool processing_start(void* frame_ptr, const Mat& img);
- bool processing_finish();
+ CV_NODISCARD_STD bool processing_start(void* frame_ptr, const Mat& img);
+ CV_NODISCARD_STD bool processing_finish();
void compose_frame(std::vector<png_bytep>& rows_dst, const std::vector<png_bytep>& rows_src, unsigned char bop, uint32_t x, uint32_t y, uint32_t w, uint32_t h, Mat& img);
- bool read_from_io(void* buffer, size_t num_bytes);
+ CV_NODISCARD_STD bool read_from_io(void* buffer, size_t num_bytes);
uint32_t read_chunk(Chunk& chunk);
+ CV_NODISCARD_STD bool InitPngPtr();
+ void ClearPngPtr();
- struct PngPtrs {
- public:
- PngPtrs() {
- png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 );
- if (png_ptr) {
- info_ptr = png_create_info_struct( png_ptr );
- end_info = png_create_info_struct( png_ptr );
- } else {
- info_ptr = end_info = nullptr;
- }
- }
- ~PngPtrs() {
- clear();
- }
- PngPtrs& operator=(PngPtrs&& other) {
- clear();
- png_ptr = other.png_ptr;
- info_ptr = other.info_ptr;
- end_info = other.end_info;
- other.png_ptr = nullptr;
- other.info_ptr = other.end_info = nullptr;
- return *this;
- }
- void clear() {
- if (png_ptr) {
- png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- png_ptr = nullptr;
- info_ptr = end_info = nullptr;
- }
- }
- png_structp getPng() const { return png_ptr; }
- png_infop getInfo() const { return info_ptr; }
- png_infop getEndInfo() const { return end_info; }
- private:
- png_structp png_ptr; // pointer to decompression structure
- png_infop info_ptr; // pointer to image information structure
- png_infop end_info; // pointer to one more image information structure
- };
-
- PngPtrs m_png_ptrs;
+ png_structp m_png_ptr = nullptr; // pointer to decompression structure
+ png_infop m_info_ptr = nullptr; // pointer to image information structure
+ png_infop m_end_info = nullptr; // pointer to one more image information structure
int m_bit_depth;
FILE* m_f;
int m_color_type;
--
2.48.1

View file

@ -0,0 +1,121 @@
From eba1a8955f9d7f8aa8c6b3ddee4565ee4185136c Mon Sep 17 00:00:00 2001
From: Vincent Rabaud <vrabaud@google.com>
Date: Thu, 23 Jan 2025 16:30:38 +0100
Subject: [PATCH 04/10] Move the checks to read_chunk.
Only user chunks need to be compared to PNG_USER_CHUNK_MALLOC_MAX
---
modules/imgcodecs/src/grfmt_png.cpp | 60 +++++++++++++++++------------
1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 105288c5e5..64ef56c8c5 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -278,12 +278,8 @@ bool PngDecoder::readHeader()
return false;
id = read_chunk(m_chunkIHDR);
- // 8=HDR+size, 13=size of IHDR chunk, 4=CRC
- // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.IHDR
- if (!(id == id_IHDR && m_chunkIHDR.p.size() == 8 + 13 + 4))
- {
+ if (id != id_IHDR)
return false;
- }
m_is_fcTL_loaded = false;
while (true)
@@ -306,10 +302,7 @@ bool PngDecoder::readHeader()
if (id == id_acTL)
{
- // 8=HDR+size, 8=size of acTL chunk, 4=CRC
// https://wiki.mozilla.org/APNG_Specification#%60acTL%60:_The_Animation_Control_Chunk
- if (chunk.p.size() != 8 + 8 + 4)
- return false;
m_animation.loop_count = png_get_uint_32(&chunk.p[12]);
m_frame_count = png_get_uint_32(&chunk.p[8]);
@@ -319,10 +312,7 @@ bool PngDecoder::readHeader()
if (id == id_fcTL)
{
- // 8=HDR+size, 26=size of fcTL chunk, 4=CRC
// https://wiki.mozilla.org/APNG_Specification#%60fcTL%60:_The_Frame_Control_Chunk
- if (chunk.p.size() != 8 + 26 + 4)
- return false;
m_is_fcTL_loaded = true;
w0 = png_get_uint_32(&chunk.p[12]);
h0 = png_get_uint_32(&chunk.p[16]);
@@ -336,11 +326,7 @@ bool PngDecoder::readHeader()
if (id == id_bKGD)
{
- // 8=HDR+size, ??=size of bKGD chunk, 4=CRC
// The spec is actually more complex: http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
- // TODO: we only check that 4 bytes can be read from &chunk.p[8]. Fix.
- if (chunk.p.size() < 8 + 4)
- return false;
int bgcolor = png_get_uint_32(&chunk.p[8]);
m_animation.bgcolor[3] = (bgcolor >> 24) & 0xFF;
m_animation.bgcolor[2] = (bgcolor >> 16) & 0xFF;
@@ -713,20 +699,46 @@ bool PngDecoder::read_from_io(void* buffer, size_t num_bytes)
uint32_t PngDecoder::read_chunk(Chunk& chunk)
{
- unsigned char len[4];
- if (read_from_io(&len, 4))
- {
- const size_t size = static_cast<size_t>(png_get_uint_32(len)) + 12;
+ unsigned char size_id[8];
+ if (!read_from_io(&size_id, 8))
+ return 0;
+ const size_t size = static_cast<size_t>(png_get_uint_32(size_id)) + 12;
+
+ const uint32_t id = *(uint32_t*)(&size_id[4]);
+ if (id == id_IHDR) {
+ // 8=HDR+size, 13=size of IHDR chunk, 4=CRC
+ // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.IHDR
+ if (size != 8 + 13 + 4)
+ return 0;
+ } else if (id == id_acTL) {
+ // 8=HDR+size, 8=size of acTL chunk, 4=CRC
+ // https://wiki.mozilla.org/APNG_Specification#%60acTL%60:_The_Animation_Control_Chunk
+ if (size != 8 + 8 + 4)
+ return 0;
+ } else if (id == id_fcTL) {
+ // 8=HDR+size, 26=size of fcTL chunk, 4=CRC
+ // https://wiki.mozilla.org/APNG_Specification#%60fcTL%60:_The_Frame_Control_Chunk
+ if (size != 8 + 26 + 4)
+ return 0;
+ } else if (id == id_bKGD) {
+ // 8=HDR+size, ??=size of bKGD chunk, 4=CRC
+ // The spec is actually more complex:
+ // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
+ // TODO: we only check that 4 bytes can be read from &chunk.p[8]. Fix.
+ if (size < 8 + 4)
+ return 0;
+ } else if (id != id_fdAT && id != id_IDAT && id != id_IEND && id != id_PLTE && id != id_tRNS) {
if (size > PNG_USER_CHUNK_MALLOC_MAX)
{
- CV_LOG_WARNING(NULL, "chunk data is too large");
+ CV_LOG_WARNING(NULL, "user chunk data is too large");
return 0;
}
- chunk.p.resize(size);
- memcpy(chunk.p.data(), len, 4);
- if (read_from_io(&chunk.p[4], chunk.p.size() - 4))
- return *(uint32_t*)(&chunk.p[4]);
}
+
+ chunk.p.resize(size);
+ memcpy(chunk.p.data(), size_id, 8);
+ if (read_from_io(&chunk.p[8], chunk.p.size() - 8))
+ return id;
return 0;
}
--
2.48.1

View file

@ -0,0 +1,170 @@
From 49c3a5eca58276daca4207c38a1579080aade23e Mon Sep 17 00:00:00 2001
From: Suleyman TURKMEN <sturkmen@hotmail.com>
Date: Fri, 24 Jan 2025 15:31:53 +0300
Subject: [PATCH 05/10] minor improvement for better code readibility
---
modules/imgcodecs/src/grfmt_png.cpp | 41 ++++++++++++++++++-----------
modules/imgcodecs/src/grfmt_png.hpp | 27 +++++++++++++++++--
2 files changed, 50 insertions(+), 18 deletions(-)
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 64ef56c8c5..08e37ec0c3 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -274,7 +274,7 @@ bool PngDecoder::readHeader()
}
// Read PNG header: 137 80 78 71 13 10 26 10
- if (!read_from_io(&sig, 8))
+ if (!readFromStreamOrBuffer(&sig, 8))
return false;
id = read_chunk(m_chunkIHDR);
@@ -682,7 +682,7 @@ void PngDecoder::compose_frame(std::vector<png_bytep>& rows_dst, const std::vect
});
}
-bool PngDecoder::read_from_io(void* buffer, size_t num_bytes)
+bool PngDecoder::readFromStreamOrBuffer(void* buffer, size_t num_bytes)
{
if (m_f)
return fread(buffer, 1, num_bytes, m_f) == num_bytes;
@@ -700,7 +700,7 @@ bool PngDecoder::read_from_io(void* buffer, size_t num_bytes)
uint32_t PngDecoder::read_chunk(Chunk& chunk)
{
unsigned char size_id[8];
- if (!read_from_io(&size_id, 8))
+ if (!readFromStreamOrBuffer(&size_id, 8))
return 0;
const size_t size = static_cast<size_t>(png_get_uint_32(size_id)) + 12;
@@ -737,7 +737,7 @@ uint32_t PngDecoder::read_chunk(Chunk& chunk)
chunk.p.resize(size);
memcpy(chunk.p.data(), size_id, 8);
- if (read_from_io(&chunk.p[8], chunk.p.size() - 8))
+ if (readFromStreamOrBuffer(&chunk.p[8], chunk.p.size() - 8))
return id;
return 0;
}
@@ -960,15 +960,24 @@ bool PngEncoder::write( const Mat& img, const std::vector<int>& params )
return result;
}
-size_t PngEncoder::write_to_io(void const* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE * _Stream)
+size_t PngEncoder::writeToStreamOrBuffer(void const* buffer, size_t num_bytes, FILE* stream)
{
- if (_Stream)
- return fwrite(_Buffer, _ElementSize, _ElementCount, _Stream);
+ if (!buffer || !num_bytes)
+ return 0; // Handle null buffer or empty writes
+
+ if (stream)
+ {
+ size_t written = fwrite(buffer, 1, num_bytes, stream);
+ return written; // fwrite handles the write count
+ }
size_t cursz = m_buf->size();
- m_buf->resize(cursz + _ElementCount);
- memcpy( &(*m_buf)[cursz], _Buffer, _ElementCount );
- return _ElementCount;
+ if (cursz + num_bytes > m_buf->max_size())
+ throw std::runtime_error("Buffer size exceeds maximum capacity");
+
+ m_buf->resize(cursz + num_bytes);
+ memcpy(&(*m_buf)[cursz], buffer, num_bytes);
+ return num_bytes;
}
void PngEncoder::writeChunk(FILE* f, const char* name, unsigned char* data, uint32_t length)
@@ -977,26 +986,26 @@ void PngEncoder::writeChunk(FILE* f, const char* name, unsigned char* data, uint
uint32_t crc = crc32(0, Z_NULL, 0);
png_save_uint_32(buf, length);
- write_to_io(buf, 1, 4, f);
- write_to_io(name, 1, 4, f);
+ writeToStreamOrBuffer(buf, 4, f);
+ writeToStreamOrBuffer(name, 4, f);
crc = crc32(crc, (const Bytef*)name, 4);
if (memcmp(name, "fdAT", 4) == 0)
{
png_save_uint_32(buf, next_seq_num++);
- write_to_io(buf, 1, 4, f);
+ writeToStreamOrBuffer(buf, 4, f);
crc = crc32(crc, buf, 4);
length -= 4;
}
if (data != NULL && length > 0)
{
- write_to_io(data, 1, length, f);
+ writeToStreamOrBuffer(data, length, f);
crc = crc32(crc, data, length);
}
png_save_uint_32(buf, crc);
- write_to_io(buf, 1, 4, f);
+ writeToStreamOrBuffer(buf, 4, f);
}
void PngEncoder::writeIDATs(FILE* f, int frame, unsigned char* data, uint32_t length, uint32_t idat_size)
@@ -1521,7 +1530,7 @@ bool PngEncoder::writeanimation(const Animation& animation, const std::vector<in
png_save_uint_32(buf_acTL, num_frames - first);
png_save_uint_32(buf_acTL + 4, loops);
- write_to_io(header, 1, 8, m_f);
+ writeToStreamOrBuffer(header, 8, m_f);
writeChunk(m_f, "IHDR", buf_IHDR, 13);
diff --git a/modules/imgcodecs/src/grfmt_png.hpp b/modules/imgcodecs/src/grfmt_png.hpp
index 5dfc86efcc..6e1a06473d 100644
--- a/modules/imgcodecs/src/grfmt_png.hpp
+++ b/modules/imgcodecs/src/grfmt_png.hpp
@@ -137,7 +137,13 @@ private:
CV_NODISCARD_STD bool processing_start(void* frame_ptr, const Mat& img);
CV_NODISCARD_STD bool processing_finish();
void compose_frame(std::vector<png_bytep>& rows_dst, const std::vector<png_bytep>& rows_src, unsigned char bop, uint32_t x, uint32_t y, uint32_t w, uint32_t h, Mat& img);
- CV_NODISCARD_STD bool read_from_io(void* buffer, size_t num_bytes);
+ /**
+ * @brief Reads data from an I/O source into the provided buffer.
+ * @param buffer Pointer to the buffer where the data will be stored.
+ * @param num_bytes Number of bytes to read into the buffer.
+ * @return true if the operation is successful, false otherwise.
+ */
+ CV_NODISCARD_STD bool readFromStreamOrBuffer(void* buffer, size_t num_bytes);
uint32_t read_chunk(Chunk& chunk);
CV_NODISCARD_STD bool InitPngPtr();
void ClearPngPtr();
@@ -185,7 +191,24 @@ public:
protected:
static void writeDataToBuf(void* png_ptr, unsigned char* src, size_t size);
static void flushBuf(void* png_ptr);
- size_t write_to_io(void const* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream);
+ /**
+ * @brief Writes data to an output destination, either a file stream or an in-memory buffer.
+ *
+ * This function handles two output scenarios:
+ * 1. If a file stream is provided, the data is written to the stream using `fwrite`.
+ * 2. If `stream` is null, the data is written to an in-memory buffer (`m_buf`), which is resized as needed.
+ *
+ * @param buffer Pointer to the data to be written.
+ * @param num_bytes The number of bytes to be written.
+ * @param stream Pointer to the file stream for writing. If null, the data is written to the in-memory buffer.
+ * @return The number of bytes successfully written.
+ * - For file-based writes, this is the number of bytes written to the stream.
+ * - For buffer-based writes, this is the total number of bytes added to the buffer.
+ *
+ * @throws std::runtime_error If the in-memory buffer (`m_buf`) exceeds its maximum capacity.
+ * @note If `num_bytes` is 0 or `buffer` is null, the function returns 0.
+ */
+ size_t writeToStreamOrBuffer(void const* buffer, size_t num_bytes, FILE* stream);
private:
void writeChunk(FILE* f, const char* name, unsigned char* data, uint32_t length);
--
2.48.1

View file

@ -0,0 +1,133 @@
From 8131e27e824740afa447a129e72a2f6a3876cbc9 Mon Sep 17 00:00:00 2001
From: Suleyman TURKMEN <sturkmen@hotmail.com>
Date: Sat, 25 Jan 2025 09:31:00 +0300
Subject: [PATCH 06/10] Merge pull request #26835 from sturkmen72:patch-4
Corrections on bKGD chunk writing and reading in PNG #26835
### 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
- [x] 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
---
modules/imgcodecs/src/grfmt_png.cpp | 26 ++++++++---------
modules/imgcodecs/test/test_animation.cpp | 35 ++++++++++++++++++++++-
2 files changed, 46 insertions(+), 15 deletions(-)
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 08e37ec0c3..4ec3280607 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -327,11 +327,10 @@ bool PngDecoder::readHeader()
if (id == id_bKGD)
{
// The spec is actually more complex: http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
- int bgcolor = png_get_uint_32(&chunk.p[8]);
- m_animation.bgcolor[3] = (bgcolor >> 24) & 0xFF;
- m_animation.bgcolor[2] = (bgcolor >> 16) & 0xFF;
- m_animation.bgcolor[1] = (bgcolor >> 8) & 0xFF;
- m_animation.bgcolor[0] = bgcolor & 0xFF;
+ m_animation.bgcolor[0] = png_get_uint_16(&chunk.p[8]);
+ m_animation.bgcolor[1] = png_get_uint_16(&chunk.p[10]);
+ m_animation.bgcolor[2] = png_get_uint_16(&chunk.p[12]);
+ m_animation.bgcolor[3] = 0;
}
if (id == id_PLTE || id == id_tRNS)
@@ -721,11 +720,10 @@ uint32_t PngDecoder::read_chunk(Chunk& chunk)
if (size != 8 + 26 + 4)
return 0;
} else if (id == id_bKGD) {
- // 8=HDR+size, ??=size of bKGD chunk, 4=CRC
+ // 8=HDR+size, (1, 2 or 6)=size of bKGD chunk, 4=CRC
// The spec is actually more complex:
// http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
- // TODO: we only check that 4 bytes can be read from &chunk.p[8]. Fix.
- if (size < 8 + 4)
+ if (size != 8 + 1 + 4 && size != 8 + 2 + 4 && size != 8 + 6 + 4)
return 0;
} else if (id != id_fdAT && id != id_IDAT && id != id_IEND && id != id_PLTE && id != id_tRNS) {
if (size > PNG_USER_CHUNK_MALLOC_MAX)
@@ -1542,13 +1540,13 @@ bool PngEncoder::writeanimation(const Animation& animation, const std::vector<in
if (palsize > 0)
writeChunk(m_f, "PLTE", (unsigned char*)(&palette), palsize * 3);
- if ((animation.bgcolor != Scalar()) && (animation.frames.size() > 1))
+ if ((animation.bgcolor != Scalar()) && coltype)
{
- uint64_t bgvalue = (static_cast<int>(animation.bgcolor[0]) & 0xFF) << 24 |
- (static_cast<int>(animation.bgcolor[1]) & 0xFF) << 16 |
- (static_cast<int>(animation.bgcolor[2]) & 0xFF) << 8 |
- (static_cast<int>(animation.bgcolor[3]) & 0xFF);
- writeChunk(m_f, "bKGD", (unsigned char*)(&bgvalue), 6); //the bKGD chunk must precede the first IDAT chunk, and must follow the PLTE chunk.
+ unsigned char bgvalue[6] = {};
+ bgvalue[1] = animation.bgcolor[0];
+ bgvalue[3] = animation.bgcolor[1];
+ bgvalue[5] = animation.bgcolor[2];
+ writeChunk(m_f, "bKGD", bgvalue, 6); //the bKGD chunk must precede the first IDAT chunk, and must follow the PLTE chunk.
}
if (trnssize > 0)
diff --git a/modules/imgcodecs/test/test_animation.cpp b/modules/imgcodecs/test/test_animation.cpp
index e8c42cbcc0..df0a00a8b1 100644
--- a/modules/imgcodecs/test/test_animation.cpp
+++ b/modules/imgcodecs/test/test_animation.cpp
@@ -425,6 +425,39 @@ TEST(Imgcodecs_APNG, imwriteanimation_rgb)
EXPECT_EQ(0, remove(output.c_str()));
}
+TEST(Imgcodecs_APNG, imwriteanimation_gray)
+{
+ Animation s_animation, l_animation;
+ EXPECT_TRUE(fillFrames(s_animation, false));
+
+ for (size_t i = 0; i < s_animation.frames.size(); i++)
+ {
+ cvtColor(s_animation.frames[i], s_animation.frames[i], COLOR_BGR2GRAY);
+ }
+
+ s_animation.bgcolor = Scalar(50, 100, 150);
+ string output = cv::tempfile(".png");
+ // Write the animation to a .png file and verify success.
+ EXPECT_TRUE(imwriteanimation(output, s_animation));
+
+ // Read the animation back and compare with the original.
+ EXPECT_TRUE(imreadanimation(output, l_animation));
+
+ EXPECT_EQ(Scalar(), l_animation.bgcolor);
+ size_t expected_frame_count = s_animation.frames.size() - 2;
+
+ // Verify that the number of frames matches the expected count.
+ EXPECT_EQ(expected_frame_count, imcount(output));
+ EXPECT_EQ(expected_frame_count, l_animation.frames.size());
+
+ EXPECT_EQ(0, remove(output.c_str()));
+
+ for (size_t i = 0; i < l_animation.frames.size(); i++)
+ {
+ EXPECT_EQ(0, cvtest::norm(s_animation.frames[i], l_animation.frames[i], NORM_INF));
+ }
+}
+
TEST(Imgcodecs_APNG, imwritemulti_rgba)
{
Animation s_animation;
@@ -492,7 +525,7 @@ TEST(Imgcodecs_APNG, imwriteanimation_bgcolor)
{
Animation s_animation, l_animation;
EXPECT_TRUE(fillFrames(s_animation, true, 2));
- s_animation.bgcolor = Scalar(50, 100, 150, 128); // different values for test purpose.
+ s_animation.bgcolor = Scalar(50, 100, 150); // will be written in bKGD chunk as RGB.
// Create a temporary output filename for saving the animation.
string output = cv::tempfile(".png");
--
2.48.1

View file

@ -0,0 +1,39 @@
From d6c4ac2e5e9cb7ea607ecb8e70884a3c5a06654c Mon Sep 17 00:00:00 2001
From: Suleyman TURKMEN <sturkmen@hotmail.com>
Date: Tue, 28 Jan 2025 01:06:41 +0300
Subject: [PATCH 07/10] fix for large tEXt chunk
---
modules/imgcodecs/src/grfmt_png.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 4ec3280607..909a9017b2 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -126,9 +126,10 @@ const uint32_t id_acTL = 0x4C546361; // Animation control chunk
const uint32_t id_fcTL = 0x4C546366; // Frame control chunk
const uint32_t id_IDAT = 0x54414449; // first frame and/or default image
const uint32_t id_fdAT = 0x54416466; // Frame data chunk
-const uint32_t id_PLTE = 0x45544C50;
-const uint32_t id_bKGD = 0x44474B62;
-const uint32_t id_tRNS = 0x534E5274;
+const uint32_t id_PLTE = 0x45544C50; // The PLTE chunk contains a color palette for indexed-color images
+const uint32_t id_bKGD = 0x44474B62; // The bKGD chunk specifies a default background color for the image
+const uint32_t id_tRNS = 0x534E5274; // The tRNS chunk provides transparency information
+const uint32_t id_tEXt = 0x74584574; // The tEXt chunk stores metadata as text in key-value pairs
const uint32_t id_IEND = 0x444E4549; // end/footer chunk
APNGFrame::APNGFrame()
@@ -725,7 +726,7 @@ uint32_t PngDecoder::read_chunk(Chunk& chunk)
// http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
if (size != 8 + 1 + 4 && size != 8 + 2 + 4 && size != 8 + 6 + 4)
return 0;
- } else if (id != id_fdAT && id != id_IDAT && id != id_IEND && id != id_PLTE && id != id_tRNS) {
+ } else if (id != id_fdAT && id != id_IDAT && id != id_IEND && id != id_PLTE && id != id_tEXt && id != id_tRNS) {
if (size > PNG_USER_CHUNK_MALLOC_MAX)
{
CV_LOG_WARNING(NULL, "user chunk data is too large");
--
2.48.1

View file

@ -0,0 +1,90 @@
From 0d99c4283620671be3009ec00eb260e5a759cc39 Mon Sep 17 00:00:00 2001
From: Vincent Rabaud <vrabaud@google.com>
Date: Fri, 31 Jan 2025 09:00:23 +0100
Subject: [PATCH 08/10] Merge pull request #26854 from vrabaud:png_leak
Fix oss-fuzz bugs 391934081 and 392318892 #26854
- fix a potential overflow in x0+w0
- use the proper function to deal with background color to deal with all cases of the spec
- use BGR layout for APNG background color
### 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
- [x] The PR is proposed to the proper branch
- [x] 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
---
.../imgcodecs/include/opencv2/imgcodecs.hpp | 2 +-
modules/imgcodecs/src/grfmt_png.cpp | 19 +++++++------------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/modules/imgcodecs/include/opencv2/imgcodecs.hpp b/modules/imgcodecs/include/opencv2/imgcodecs.hpp
index cd648c2c6e..c802033e6b 100644
--- a/modules/imgcodecs/include/opencv2/imgcodecs.hpp
+++ b/modules/imgcodecs/include/opencv2/imgcodecs.hpp
@@ -263,7 +263,7 @@ struct CV_EXPORTS_W_SIMPLE Animation
- If a negative value or a value beyond the maximum of `0xffff` (65535) is provided, it is reset to `0`
(infinite looping) to maintain valid bounds.
- @param bgColor A `Scalar` object representing the background color in BGRA format:
+ @param bgColor A `Scalar` object representing the background color in BGR format:
- Defaults to `Scalar()`, indicating an empty color (usually transparent if supported).
- This background color provides a solid fill behind frames that have transparency, ensuring a consistent display appearance.
*/
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 909a9017b2..f7a19c2bf5 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -325,15 +325,6 @@ bool PngDecoder::readHeader()
bop = chunk.p[33];
}
- if (id == id_bKGD)
- {
- // The spec is actually more complex: http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
- m_animation.bgcolor[0] = png_get_uint_16(&chunk.p[8]);
- m_animation.bgcolor[1] = png_get_uint_16(&chunk.p[10]);
- m_animation.bgcolor[2] = png_get_uint_16(&chunk.p[12]);
- m_animation.bgcolor[3] = 0;
- }
-
if (id == id_PLTE || id == id_tRNS)
m_chunksInfo.push_back(chunk);
}
@@ -356,9 +347,13 @@ bool PngDecoder::readHeader()
m_color_type = color_type;
m_bit_depth = bit_depth;
- if (m_is_fcTL_loaded && (int(x0 + w0) > m_width || int(y0 + h0) > m_height || dop > 2 || bop > 1))
+ if (m_is_fcTL_loaded && ((long long int)x0 + w0 > m_width || (long long int)y0 + h0 > m_height || dop > 2 || bop > 1))
return false;
+ png_color_16p background_color;
+ if (png_get_bKGD(m_png_ptr, m_info_ptr, &background_color))
+ m_animation.bgcolor = Scalar(background_color->blue, background_color->green, background_color->red);
+
if (bit_depth <= 8 || bit_depth == 16)
{
switch (color_type)
@@ -1544,9 +1539,9 @@ bool PngEncoder::writeanimation(const Animation& animation, const std::vector<in
if ((animation.bgcolor != Scalar()) && coltype)
{
unsigned char bgvalue[6] = {};
- bgvalue[1] = animation.bgcolor[0];
+ bgvalue[1] = animation.bgcolor[2];
bgvalue[3] = animation.bgcolor[1];
- bgvalue[5] = animation.bgcolor[2];
+ bgvalue[5] = animation.bgcolor[0];
writeChunk(m_f, "bKGD", bgvalue, 6); //the bKGD chunk must precede the first IDAT chunk, and must follow the PLTE chunk.
}
--
2.48.1

View file

@ -0,0 +1,367 @@
From 8aa1086ab475ef0040d3865e49edd6feba4eb7d3 Mon Sep 17 00:00:00 2001
From: Suleyman TURKMEN <sturkmen@hotmail.com>
Date: Tue, 4 Feb 2025 12:21:55 +0300
Subject: [PATCH 09/10] Merge pull request #26872 from
sturkmen72:ImageEncoders_revisions
Performance tests for image encoders and decoders and code cleanup #26872
### 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
- [x] 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
---
modules/highgui/src/window_w32.cpp | 10 +-
modules/imgcodecs/perf/perf_decode_encode.cpp | 131 ++++++++++++++++++
modules/imgcodecs/src/grfmt_avif.cpp | 5 -
modules/imgcodecs/src/grfmt_avif.hpp | 1 -
modules/imgcodecs/src/grfmt_base.cpp | 8 +-
modules/imgcodecs/src/grfmt_base.hpp | 5 +-
modules/imgcodecs/src/grfmt_gif.cpp | 10 +-
modules/imgcodecs/src/grfmt_gif.hpp | 3 -
modules/imgcodecs/src/grfmt_png.cpp | 6 +-
modules/imgcodecs/src/loadsave.cpp | 2 +-
10 files changed, 155 insertions(+), 26 deletions(-)
create mode 100644 modules/imgcodecs/perf/perf_decode_encode.cpp
diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp
index 2543c81c6a..8e041c9609 100644
--- a/modules/highgui/src/window_w32.cpp
+++ b/modules/highgui/src/window_w32.cpp
@@ -2170,9 +2170,15 @@ static void showSaveDialog(CvWindow& window)
#ifdef HAVE_WEBP
"WebP files (*.webp)\0*.webp\0"
#endif
- "Portable image format (*.pbm;*.pgm;*.ppm;*.pxm;*.pnm)\0*.pbm;*.pgm;*.ppm;*.pxm;*.pnm\0"
+ "Portable image format (*.pbm;*.pgm;*.ppm;*.pnm;*.pam)\0*.pbm;*.pgm;*.ppm;*.pnm;*.pam\0"
#ifdef HAVE_OPENEXR
"OpenEXR Image files (*.exr)\0*.exr\0"
+#endif
+#ifdef HAVE_AVIF
+ "AVIF files (*.avif)\0*.avif\0"
+#endif
+#ifdef HAVE_IMGCODEC_GIF
+ "Graphics Interchange Format 89a(*.gif)\0*.gif\0"
#endif
"Radiance HDR (*.hdr;*.pic)\0*.hdr;*.pic\0"
"Sun raster files (*.sr;*.ras)\0*.sr;*.ras\0"
@@ -2194,7 +2200,7 @@ static void showSaveDialog(CvWindow& window)
}
#else
CV_UNUSED(window);
- CV_LOG_WARNING("Save dialog requires enabled 'imgcodecs' module.");
+ CV_LOG_WARNING(NULL, "Save dialog requires enabled 'imgcodecs' module.");
return;
#endif
}
diff --git a/modules/imgcodecs/perf/perf_decode_encode.cpp b/modules/imgcodecs/perf/perf_decode_encode.cpp
new file mode 100644
index 0000000000..ce693cb878
--- /dev/null
+++ b/modules/imgcodecs/perf/perf_decode_encode.cpp
@@ -0,0 +1,131 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html
+
+#include "perf_precomp.hpp"
+
+namespace opencv_test
+{
+
+#ifdef HAVE_PNG
+
+using namespace perf;
+
+typedef perf::TestBaseWithParam<std::string> Decode;
+typedef perf::TestBaseWithParam<std::string> Encode;
+
+const string exts[] = {
+#ifdef HAVE_AVIF
+ ".avif",
+#endif
+ ".bmp",
+#ifdef HAVE_IMGCODEC_GIF
+ ".gif",
+#endif
+#if (defined(HAVE_JASPER) && defined(OPENCV_IMGCODECS_ENABLE_JASPER_TESTS)) \
+ || defined(HAVE_OPENJPEG)
+ ".jp2",
+#endif
+#ifdef HAVE_JPEG
+ ".jpg",
+#endif
+#ifdef HAVE_JPEGXL
+ ".jxl",
+#endif
+ ".png",
+#ifdef HAVE_IMGCODEC_PXM
+ ".ppm",
+#endif
+#ifdef HAVE_IMGCODEC_SUNRASTER
+ ".ras",
+#endif
+#ifdef HAVE_TIFF
+ ".tiff",
+#endif
+#ifdef HAVE_WEBP
+ ".webp",
+#endif
+};
+
+const string exts_multi[] = {
+#ifdef HAVE_AVIF
+ ".avif",
+#endif
+#ifdef HAVE_IMGCODEC_GIF
+ ".gif",
+#endif
+ ".png",
+#ifdef HAVE_TIFF
+ ".tiff",
+#endif
+#ifdef HAVE_WEBP
+ ".webp",
+#endif
+};
+
+PERF_TEST_P(Decode, bgr, testing::ValuesIn(exts))
+{
+ String filename = getDataPath("perf/1920x1080.png");
+
+ Mat src = imread(filename);
+ EXPECT_FALSE(src.empty()) << "Cannot open test image perf/1920x1080.png";
+ vector<uchar> buf;
+ EXPECT_TRUE(imencode(GetParam(), src, buf));
+
+ TEST_CYCLE() imdecode(buf, IMREAD_UNCHANGED);
+
+ SANITY_CHECK_NOTHING();
+}
+
+PERF_TEST_P(Decode, rgb, testing::ValuesIn(exts))
+{
+ String filename = getDataPath("perf/1920x1080.png");
+
+ Mat src = imread(filename);
+ EXPECT_FALSE(src.empty()) << "Cannot open test image perf/1920x1080.png";
+ vector<uchar> buf;
+ EXPECT_TRUE(imencode(GetParam(), src, buf));
+
+ TEST_CYCLE() imdecode(buf, IMREAD_COLOR_RGB);
+
+ SANITY_CHECK_NOTHING();
+}
+
+PERF_TEST_P(Encode, bgr, testing::ValuesIn(exts))
+{
+ String filename = getDataPath("perf/1920x1080.png");
+
+ Mat src = imread(filename);
+ EXPECT_FALSE(src.empty()) << "Cannot open test image perf/1920x1080.png";
+ vector<uchar> buf;
+
+ TEST_CYCLE() imencode(GetParam(), src, buf);
+
+ std::cout << "Encoded buffer size: " << buf.size()
+ << " bytes, Compression ratio: " << std::fixed << std::setprecision(2)
+ << (static_cast<double>(buf.size()) / (src.total() * src.channels())) * 100.0 << "%" << std::endl;
+
+ SANITY_CHECK_NOTHING();
+}
+
+PERF_TEST_P(Encode, multi, testing::ValuesIn(exts_multi))
+{
+ String filename = getDataPath("perf/1920x1080.png");
+ vector<Mat> vec;
+ EXPECT_TRUE(imreadmulti(filename, vec));
+ vec.push_back(vec.back().clone());
+ circle(vec.back(), Point(100, 100), 45, Scalar(0, 0, 255, 0), 2, LINE_AA);
+ vector<uchar> buf;
+ EXPECT_TRUE(imwrite("test" + GetParam(), vec));
+
+ TEST_CYCLE() imencode(GetParam(), vec, buf);
+
+ std::cout << "Encoded buffer size: " << buf.size()
+ << " bytes, Compression ratio: " << std::fixed << std::setprecision(2)
+ << (static_cast<double>(buf.size()) / (vec[0].total() * vec[0].channels())) * 100.0 << "%" << std::endl;
+
+ SANITY_CHECK_NOTHING();
+}
+#endif // HAVE_PNG
+
+} // namespace
diff --git a/modules/imgcodecs/src/grfmt_avif.cpp b/modules/imgcodecs/src/grfmt_avif.cpp
index d3fb500604..c35eb50306 100644
--- a/modules/imgcodecs/src/grfmt_avif.cpp
+++ b/modules/imgcodecs/src/grfmt_avif.cpp
@@ -298,11 +298,6 @@ bool AvifEncoder::isFormatSupported(int depth) const {
return (depth == CV_8U || depth == CV_16U);
}
-bool AvifEncoder::write(const Mat &img, const std::vector<int> &params) {
- std::vector<Mat> img_vec(1, img);
- return writemulti(img_vec, params);
-}
-
bool AvifEncoder::writeanimation(const Animation& animation,
const std::vector<int> &params) {
int bit_depth = 8;
diff --git a/modules/imgcodecs/src/grfmt_avif.hpp b/modules/imgcodecs/src/grfmt_avif.hpp
index 87b765619e..9f097aaf55 100644
--- a/modules/imgcodecs/src/grfmt_avif.hpp
+++ b/modules/imgcodecs/src/grfmt_avif.hpp
@@ -41,7 +41,6 @@ class AvifEncoder CV_FINAL : public BaseImageEncoder {
~AvifEncoder() CV_OVERRIDE;
bool isFormatSupported(int depth) const CV_OVERRIDE;
- bool write(const Mat& img, const std::vector<int>& params) CV_OVERRIDE;
bool writeanimation(const Animation& animation, const std::vector<int>& params) CV_OVERRIDE;
ImageEncoder newEncoder() const CV_OVERRIDE;
diff --git a/modules/imgcodecs/src/grfmt_base.cpp b/modules/imgcodecs/src/grfmt_base.cpp
index 1e09882780..dc3d07ab78 100644
--- a/modules/imgcodecs/src/grfmt_base.cpp
+++ b/modules/imgcodecs/src/grfmt_base.cpp
@@ -140,6 +140,11 @@ bool BaseImageEncoder::setDestination( std::vector<uchar>& buf )
return true;
}
+bool BaseImageEncoder::write(const Mat &img, const std::vector<int> &params) {
+ std::vector<Mat> img_vec(1, img);
+ return writemulti(img_vec, params);
+}
+
bool BaseImageEncoder::writemulti(const std::vector<Mat>& img_vec, const std::vector<int>& params)
{
if(img_vec.size() > 1)
@@ -157,6 +162,7 @@ bool BaseImageEncoder::writemulti(const std::vector<Mat>& img_vec, const std::ve
bool BaseImageEncoder::writeanimation(const Animation&, const std::vector<int>& )
{
+ CV_LOG_WARNING(NULL, "No Animation encoder for specified file extension");
return false;
}
@@ -165,7 +171,7 @@ ImageEncoder BaseImageEncoder::newEncoder() const
return ImageEncoder();
}
-void BaseImageEncoder::throwOnEror() const
+void BaseImageEncoder::throwOnError() const
{
if(!m_last_error.empty())
{
diff --git a/modules/imgcodecs/src/grfmt_base.hpp b/modules/imgcodecs/src/grfmt_base.hpp
index a90bd8a3de..ae5622528c 100644
--- a/modules/imgcodecs/src/grfmt_base.hpp
+++ b/modules/imgcodecs/src/grfmt_base.hpp
@@ -202,12 +202,11 @@ public:
/**
* @brief Encode and write the image data.
- * This is a pure virtual function that must be implemented by derived classes.
* @param img The Mat object containing the image data to be encoded.
* @param params A vector of parameters controlling the encoding process (e.g., compression level).
* @return true if the image was successfully written, false otherwise.
*/
- virtual bool write(const Mat& img, const std::vector<int>& params) = 0;
+ virtual bool write(const Mat& img, const std::vector<int>& params);
/**
* @brief Encode and write multiple images (e.g., for animated formats).
@@ -236,7 +235,7 @@ public:
* @brief Throw an exception based on the last error encountered during encoding.
* This method can be used to propagate error conditions back to the caller.
*/
- virtual void throwOnEror() const;
+ virtual void throwOnError() const;
protected:
String m_description; ///< Description of the encoder (e.g., format name, capabilities).
diff --git a/modules/imgcodecs/src/grfmt_gif.cpp b/modules/imgcodecs/src/grfmt_gif.cpp
index 5a65ae04b1..b0533b644f 100644
--- a/modules/imgcodecs/src/grfmt_gif.cpp
+++ b/modules/imgcodecs/src/grfmt_gif.cpp
@@ -488,19 +488,11 @@ GifEncoder::~GifEncoder() {
close();
}
-bool GifEncoder::isFormatSupported(int depth) const {
- return depth == CV_8U;
-}
-
-bool GifEncoder::write(const Mat &img, const std::vector<int> &params) {
- std::vector<Mat> img_vec(1, img);
- return writemulti(img_vec, params);
-}
-
bool GifEncoder::writeanimation(const Animation& animation, const std::vector<int>& params) {
if (animation.frames.empty()) {
return false;
}
+ CV_CheckDepthEQ(animation.frames[0].depth(), CV_8U, "GIF encoder supports only 8-bit unsigned images");
if (m_buf) {
if (!strm.open(*m_buf)) {
diff --git a/modules/imgcodecs/src/grfmt_gif.hpp b/modules/imgcodecs/src/grfmt_gif.hpp
index 8f520745ba..8552718d00 100644
--- a/modules/imgcodecs/src/grfmt_gif.hpp
+++ b/modules/imgcodecs/src/grfmt_gif.hpp
@@ -83,9 +83,6 @@ public:
GifEncoder();
~GifEncoder() CV_OVERRIDE;
- bool isFormatSupported(int depth) const CV_OVERRIDE;
-
- bool write(const Mat& img, const std::vector<int>& params) CV_OVERRIDE;
bool writeanimation(const Animation& animation, const std::vector<int>& params) CV_OVERRIDE;
ImageEncoder newEncoder() const CV_OVERRIDE;
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index f7a19c2bf5..825122304a 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -1412,6 +1412,9 @@ void PngEncoder::deflateRectFin(unsigned char* zbuf, uint32_t* zsize, int bpp, i
bool PngEncoder::writeanimation(const Animation& animation, const std::vector<int>& params)
{
+ int frame_type = animation.frames[0].type();
+ int frame_depth = animation.frames[0].depth();
+ CV_CheckType(frame_type, frame_depth == CV_8U || frame_depth == CV_16U, "APNG decoder supports only 8 or 16 bit unsigned images");
int compression_level = 6;
int compression_strategy = IMWRITE_PNG_STRATEGY_RLE; // Default strategy
bool isBilevel = false;
@@ -1435,7 +1438,8 @@ bool PngEncoder::writeanimation(const Animation& animation, const std::vector<in
}
}
- CV_UNUSED(isBilevel);
+ if (isBilevel)
+ CV_LOG_WARNING(NULL, "IMWRITE_PNG_BILEVEL parameter is not supported yet.");
uint32_t first =0;
uint32_t loops= animation.loop_count;
uint32_t coltype= animation.frames[0].channels() == 1 ? PNG_COLOR_TYPE_GRAY : animation.frames[0].channels() == 3 ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA;
diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp
index ec25f8c610..37b0701c8a 100644
--- a/modules/imgcodecs/src/loadsave.cpp
+++ b/modules/imgcodecs/src/loadsave.cpp
@@ -1372,7 +1372,7 @@ bool imencode( const String& ext, InputArray _img,
else
code = encoder->writemulti(write_vec, params);
- encoder->throwOnEror();
+ encoder->throwOnError();
CV_Assert( code );
}
catch (const cv::Exception& e)
--
2.48.1

View file

@ -0,0 +1,54 @@
From ab0a4167057dadcfc497f0d4d653b5eec7fd586a Mon Sep 17 00:00:00 2001
From: Maksim Shabunin <maksim.shabunin@gmail.com>
Date: Thu, 13 Feb 2025 16:58:15 +0300
Subject: [PATCH 10/10] Merge pull request #26915 from mshabunin:fix-png-be
Resolves #26913
Related(?): #25715 #26832
---
modules/imgcodecs/src/grfmt_png.cpp | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
index 825122304a..84df975471 100644
--- a/modules/imgcodecs/src/grfmt_png.cpp
+++ b/modules/imgcodecs/src/grfmt_png.cpp
@@ -121,16 +121,16 @@
namespace cv
{
-const uint32_t id_IHDR = 0x52444849; // PNG header
-const uint32_t id_acTL = 0x4C546361; // Animation control chunk
-const uint32_t id_fcTL = 0x4C546366; // Frame control chunk
-const uint32_t id_IDAT = 0x54414449; // first frame and/or default image
-const uint32_t id_fdAT = 0x54416466; // Frame data chunk
-const uint32_t id_PLTE = 0x45544C50; // The PLTE chunk contains a color palette for indexed-color images
-const uint32_t id_bKGD = 0x44474B62; // The bKGD chunk specifies a default background color for the image
-const uint32_t id_tRNS = 0x534E5274; // The tRNS chunk provides transparency information
-const uint32_t id_tEXt = 0x74584574; // The tEXt chunk stores metadata as text in key-value pairs
-const uint32_t id_IEND = 0x444E4549; // end/footer chunk
+const uint32_t id_IHDR = 0x49484452; // PNG header
+const uint32_t id_acTL = 0x6163544C; // Animation control chunk
+const uint32_t id_fcTL = 0x6663544C; // Frame control chunk
+const uint32_t id_IDAT = 0x49444154; // first frame and/or default image
+const uint32_t id_fdAT = 0x66644154; // Frame data chunk
+const uint32_t id_PLTE = 0x504C5445; // The PLTE chunk contains a color palette for indexed-color images
+const uint32_t id_bKGD = 0x624B4744; // The bKGD chunk specifies a default background color for the image
+const uint32_t id_tRNS = 0x74524E53; // The tRNS chunk provides transparency information
+const uint32_t id_tEXt = 0x74455874; // The tEXt chunk stores metadata as text in key-value pairs
+const uint32_t id_IEND = 0x49454E44; // end/footer chunk
APNGFrame::APNGFrame()
{
@@ -699,7 +699,7 @@ uint32_t PngDecoder::read_chunk(Chunk& chunk)
return 0;
const size_t size = static_cast<size_t>(png_get_uint_32(size_id)) + 12;
- const uint32_t id = *(uint32_t*)(&size_id[4]);
+ const uint32_t id = png_get_uint_32(size_id + 4);
if (id == id_IHDR) {
// 8=HDR+size, 13=size of IHDR chunk, 4=CRC
// http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.IHDR
--
2.48.1

54
26750.patch Normal file
View file

@ -0,0 +1,54 @@
From 97f3f390661f2fd1168336820b89eb4383ce8528 Mon Sep 17 00:00:00 2001
From: Maksim Shabunin <maksim.shabunin@gmail.com>
Date: Fri, 10 Jan 2025 18:34:11 +0300
Subject: [PATCH] core: fixed VSX intrinsics implementation
---
modules/core/include/opencv2/core/hal/intrin_vsx.hpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/core/include/opencv2/core/hal/intrin_vsx.hpp b/modules/core/include/opencv2/core/hal/intrin_vsx.hpp
index 2157e1e87063..0a0915a22fc4 100644
--- a/modules/core/include/opencv2/core/hal/intrin_vsx.hpp
+++ b/modules/core/include/opencv2/core/hal/intrin_vsx.hpp
@@ -262,7 +262,7 @@ OPENCV_HAL_IMPL_VSX_EXTRACT_N(v_float64x2, double)
inline _Tpvec v_setzero_##suffix() { return _Tpvec(vec_splats((_Tp)0)); } \
inline _Tpvec v_setall_##suffix(_Tp v) { return _Tpvec(vec_splats((_Tp)v));} \
template <> inline _Tpvec v_setzero_() { return v_setzero_##suffix(); } \
-template <> inline _Tpvec v_setall_(_Tp v) { return v_setall_##suffix(_Tp v); } \
+template <> inline _Tpvec v_setall_(_Tp v) { return v_setall_##suffix(v); } \
template<typename _Tpvec0> inline _Tpvec v_reinterpret_as_##suffix(const _Tpvec0 &a) \
{ return _Tpvec((cast)a.val); }
@@ -650,11 +650,11 @@ OPENCV_HAL_IMPL_VSX_SELECT(v_float64x2, vec_bdword2_c)
#define OPENCV_HAL_IMPL_VSX_INT_CMP_OP(_Tpvec) \
inline _Tpvec v_eq(const _Tpvec& a, const _Tpvec& b) \
{ return _Tpvec(vec_cmpeq(a.val, b.val)); } \
-inline _Tpvec V_ne(const _Tpvec& a, const _Tpvec& b) \
+inline _Tpvec v_ne(const _Tpvec& a, const _Tpvec& b) \
{ return _Tpvec(vec_cmpne(a.val, b.val)); } \
inline _Tpvec v_lt(const _Tpvec& a, const _Tpvec& b) \
{ return _Tpvec(vec_cmplt(a.val, b.val)); } \
-inline _Tpvec V_gt(const _Tpvec& a, const _Tpvec& b) \
+inline _Tpvec v_gt(const _Tpvec& a, const _Tpvec& b) \
{ return _Tpvec(vec_cmpgt(a.val, b.val)); } \
inline _Tpvec v_le(const _Tpvec& a, const _Tpvec& b) \
{ return _Tpvec(vec_cmple(a.val, b.val)); } \
@@ -1507,7 +1507,7 @@ inline v_float64x2 v_dotprod_expand(const v_int32x4& a, const v_int32x4& b, cons
inline v_int32x4 v_dotprod_fast(const v_int16x8& a, const v_int16x8& b)
{ return v_dotprod(a, b); }
inline v_int32x4 v_dotprod_fast(const v_int16x8& a, const v_int16x8& b, const v_int32x4& c)
-{ return v_int32x4(vec_msum(a.val, b.val, vec_int4_z)) + c; }
+{ return v_add(v_int32x4(vec_msum(a.val, b.val, vec_int4_z)), c); }
// 32 >> 64
inline v_int64x2 v_dotprod_fast(const v_int32x4& a, const v_int32x4& b)
{ return v_dotprod(a, b); }
@@ -1518,7 +1518,7 @@ inline v_int64x2 v_dotprod_fast(const v_int32x4& a, const v_int32x4& b, const v_
inline v_uint32x4 v_dotprod_expand_fast(const v_uint8x16& a, const v_uint8x16& b)
{ return v_dotprod_expand(a, b); }
inline v_uint32x4 v_dotprod_expand_fast(const v_uint8x16& a, const v_uint8x16& b, const v_uint32x4& c)
-{ return v_uint32x4(vec_msum(a.val, b.val, vec_uint4_z)) + c; }
+{ return v_add(v_uint32x4(vec_msum(a.val, b.val, vec_uint4_z)), c); }
inline v_int32x4 v_dotprod_expand_fast(const v_int8x16& a, const v_int8x16& b)
{

35
26786.patch Normal file
View file

@ -0,0 +1,35 @@
From 63ef786a3a0afcd44bf842f967656052d52dde09 Mon Sep 17 00:00:00 2001
From: Maksim Shabunin <maksim.shabunin@gmail.com>
Date: Thu, 16 Jan 2025 23:48:29 +0300
Subject: [PATCH] core: fixed VSX build with GCC 15
---
modules/core/include/opencv2/core/vsx_utils.hpp | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/modules/core/include/opencv2/core/vsx_utils.hpp b/modules/core/include/opencv2/core/vsx_utils.hpp
index 79a1074d59ff..4d5a694bae8e 100644
--- a/modules/core/include/opencv2/core/vsx_utils.hpp
+++ b/modules/core/include/opencv2/core/vsx_utils.hpp
@@ -257,8 +257,8 @@ VSX_IMPL_1VRG(vec_udword2, vec_udword2, vpopcntd, vec_popcntu)
VSX_IMPL_1VRG(vec_udword2, vec_dword2, vpopcntd, vec_popcntu)
// converts between single and double-precision
-VSX_REDIRECT_1RG(vec_float4, vec_double2, vec_cvfo, __builtin_vsx_xvcvdpsp)
-VSX_REDIRECT_1RG(vec_double2, vec_float4, vec_cvfo, __builtin_vsx_xvcvspdp)
+VSX_REDIRECT_1RG(vec_float4, vec_double2, vec_cvfo, vec_floate)
+VSX_REDIRECT_1RG(vec_double2, vec_float4, vec_cvfo, vec_doubleo)
// converts word and doubleword to double-precision
#undef vec_ctd
@@ -399,10 +399,6 @@ VSX_REDIRECT_1RG(vec_ushort8, vec_ushort8, vec_popcntu, vec_popcnt)
VSX_REDIRECT_1RG(vec_uint4, vec_uint4, vec_popcntu, vec_popcnt)
VSX_REDIRECT_1RG(vec_udword2, vec_udword2, vec_popcntu, vec_popcnt)
-// converts between single and double precision
-VSX_REDIRECT_1RG(vec_float4, vec_double2, vec_cvfo, __builtin_vsx_xvcvdpsp)
-VSX_REDIRECT_1RG(vec_double2, vec_float4, vec_cvfo, __builtin_vsx_xvcvspdp)
-
// converts word and doubleword to double-precision
#ifdef vec_ctd
# undef vec_ctd

57
27536.patch Normal file
View file

@ -0,0 +1,57 @@
From 353b4ddf52db48ba85d2efaa33310afa0eb73a72 Mon Sep 17 00:00:00 2001
From: Kumataro <Kumataro@users.noreply.github.com>
Date: Sun, 13 Jul 2025 08:11:06 +0900
Subject: [PATCH 1/2] eigen: fix to get version from eigen master branch
---
cmake/OpenCVFindLibsPerf.cmake | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/cmake/OpenCVFindLibsPerf.cmake b/cmake/OpenCVFindLibsPerf.cmake
index dfc94597bbba..55a08f72d00d 100644
--- a/cmake/OpenCVFindLibsPerf.cmake
+++ b/cmake/OpenCVFindLibsPerf.cmake
@@ -84,6 +84,12 @@ if(WITH_EIGEN AND NOT HAVE_EIGEN)
set(EIGEN_WORLD_VERSION ${EIGEN3_WORLD_VERSION})
set(EIGEN_MAJOR_VERSION ${EIGEN3_MAJOR_VERSION})
set(EIGEN_MINOR_VERSION ${EIGEN3_MINOR_VERSION})
+ elseif(DEFINED Eigen3_VERSION_MAJOR)
+ # see https://github.com/opencv/opencv/issues/27530
+ # Case sensitive is needed to support Eigen on Master branch at 13 July,2025.
+ set(EIGEN_WORLD_VERSION ${Eigen3_VERSION_MAJOR})
+ set(EIGEN_MAJOR_VERSION ${Eigen3_VERSION_MINOR})
+ set(EIGEN_MINOR_VERSION ${Eigen3_VERSION_PATCH})
else() # Eigen config file
set(EIGEN_WORLD_VERSION ${EIGEN3_VERSION_MAJOR})
set(EIGEN_MAJOR_VERSION ${EIGEN3_VERSION_MINOR})
From 94e909d4a6811bbd4774baae8722df79d057a2bc Mon Sep 17 00:00:00 2001
From: Kumataro <Kumataro@users.noreply.github.com>
Date: Mon, 14 Jul 2025 21:25:52 +0900
Subject: [PATCH 2/2] add pointer to Eigen commit
---
cmake/OpenCVFindLibsPerf.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmake/OpenCVFindLibsPerf.cmake b/cmake/OpenCVFindLibsPerf.cmake
index 55a08f72d00d..861a39c47f9b 100644
--- a/cmake/OpenCVFindLibsPerf.cmake
+++ b/cmake/OpenCVFindLibsPerf.cmake
@@ -84,13 +84,13 @@ if(WITH_EIGEN AND NOT HAVE_EIGEN)
set(EIGEN_WORLD_VERSION ${EIGEN3_WORLD_VERSION})
set(EIGEN_MAJOR_VERSION ${EIGEN3_MAJOR_VERSION})
set(EIGEN_MINOR_VERSION ${EIGEN3_MINOR_VERSION})
- elseif(DEFINED Eigen3_VERSION_MAJOR)
+ elseif(DEFINED Eigen3_VERSION_MAJOR) # Recommended package config variables
# see https://github.com/opencv/opencv/issues/27530
- # Case sensitive is needed to support Eigen on Master branch at 13 July,2025.
set(EIGEN_WORLD_VERSION ${Eigen3_VERSION_MAJOR})
set(EIGEN_MAJOR_VERSION ${Eigen3_VERSION_MINOR})
set(EIGEN_MINOR_VERSION ${Eigen3_VERSION_PATCH})
- else() # Eigen config file
+ else() # Deprecated package config variables
+ # Removed on master at https://gitlab.com/libeigen/eigen/-/commit/f2984cd0778dd0a1d7e74216d826eaff2bc6bfab
set(EIGEN_WORLD_VERSION ${EIGEN3_VERSION_MAJOR})
set(EIGEN_MAJOR_VERSION ${EIGEN3_VERSION_MINOR})
set(EIGEN_MINOR_VERSION ${EIGEN3_VERSION_PATCH})

43
27691.patch Normal file
View file

@ -0,0 +1,43 @@
From 90c444abd387ffa70b2e72a34922903a2f0f4f5a Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Wed, 20 Aug 2025 10:53:51 +0300
Subject: [PATCH] FFmpeg 8.0 support.
---
modules/videoio/src/cap_ffmpeg_impl.hpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
index 489dbe565d3d..5780b4c11361 100644
--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
@@ -685,7 +685,10 @@ void CvCapture_FFMPEG::close()
if( video_st )
{
#ifdef CV_FFMPEG_CODECPAR
+// avcodec_close removed in FFmpeg release 8.0
+# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100))
avcodec_close( context );
+# endif
#endif
video_st = NULL;
}
@@ -2005,7 +2008,18 @@ void CvCapture_FFMPEG::get_rotation_angle()
rotation_angle = 0;
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(57, 68, 100)
const uint8_t *data = 0;
+ // av_stream_get_side_data removed in FFmpeg release 8.0
+# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100))
data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
+# else
+ AVPacketSideData* sd = video_st->codecpar->coded_side_data;
+ int nb_sd = video_st->codecpar->nb_coded_side_data;
+ if (sd && nb_sd > 0)
+ {
+ const AVPacketSideData* mtx = av_packet_side_data_get(sd, nb_sd, AV_PKT_DATA_DISPLAYMATRIX);
+ data = mtx->data;
+ }
+# endif
if (data)
{
rotation_angle = -cvRound(av_display_rotation_get((const int32_t*)data));

3
README.packit Normal file
View file

@ -0,0 +1,3 @@
This repository is maintained by packit.
https://packit.dev/
The file was generated using packit 0.106.0.post1.dev8+g521f1e1d.

View file

@ -1,82 +0,0 @@
From ad35b79e3f98b4ce30481e0299cca550ed77aef0 Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
Date: Thu, 22 Nov 2018 21:06:33 +0000
Subject: [PATCH] python: update install paths
- don't require "OPENCV_PYTHON{2,3}_INSTALL_PATH" if OPENCV_SKIP_PYTHON_LOADER=ON
- avoid unnecessary relative paths in generated config-X.Y.py
---
CMakeLists.txt | 4 ++--
modules/python/common.cmake | 14 +++++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fde8b578ba0..6298f4438c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1494,7 +1494,7 @@ if(BUILD_opencv_python2)
status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES}" ELSE NO)
endif()
status(" numpy:" PYTHON2_NUMPY_INCLUDE_DIRS THEN "${PYTHON2_NUMPY_INCLUDE_DIRS} (ver ${PYTHON2_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
- status(" packages path:" PYTHON2_EXECUTABLE THEN "${PYTHON2_PACKAGES_PATH}" ELSE "-")
+ status(" install path:" HAVE_opencv_python2 THEN "${__INSTALL_PATH_PYTHON2}" ELSE "-")
endif()
if(BUILD_opencv_python3)
@@ -1507,7 +1507,7 @@ if(BUILD_opencv_python3)
status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES}" ELSE NO)
endif()
status(" numpy:" PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
- status(" packages path:" PYTHON3_EXECUTABLE THEN "${PYTHON3_PACKAGES_PATH}" ELSE "-")
+ status(" install path:" HAVE_opencv_python3 THEN "${__INSTALL_PATH_PYTHON3}" ELSE "-")
endif()
status("")
diff --git a/modules/python/common.cmake b/modules/python/common.cmake
index 14912297eae..4b4eaa6e7f8 100644
--- a/modules/python/common.cmake
+++ b/modules/python/common.cmake
@@ -122,6 +122,8 @@ endif()
if(NOT " ${PYTHON}" STREQUAL " PYTHON" AND DEFINED OPENCV_${PYTHON}_INSTALL_PATH)
set(__python_binary_install_path "${OPENCV_${PYTHON}_INSTALL_PATH}")
+elseif(OPENCV_SKIP_PYTHON_LOADER AND DEFINED ${PYTHON}_PACKAGES_PATH)
+ set(__python_binary_install_path "${${PYTHON}_PACKAGES_PATH}")
else()
ocv_assert(DEFINED OPENCV_PYTHON_INSTALL_PATH)
set(__python_binary_install_path "${OPENCV_PYTHON_INSTALL_PATH}/${__python_loader_subdir}python-${${PYTHON}_VERSION_MAJOR}.${${PYTHON}_VERSION_MINOR}")
@@ -134,6 +136,8 @@ install(TARGETS ${the_module}
${PYTHON_INSTALL_ARCHIVE}
)
+set(__INSTALL_PATH_${PYTHON} "${__python_binary_install_path}" CACHE INTERNAL "") # CMake status
+
if(NOT OPENCV_SKIP_PYTHON_LOADER)
ocv_assert(DEFINED OPENCV_PYTHON_INSTALL_PATH)
if(OpenCV_FOUND)
@@ -143,12 +147,11 @@ if(NOT OPENCV_SKIP_PYTHON_LOADER)
endif()
set(__python_loader_install_tmp_path "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/install/python_loader/")
+ set(OpenCV_PYTHON_LOADER_FULL_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_PYTHON_INSTALL_PATH}/cv2")
if(IS_ABSOLUTE "${OPENCV_PYTHON_INSTALL_PATH}")
- set(OpenCV_PYTHON_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/")
- set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "'${CMAKE_INSTALL_PREFIX}'")
+ set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "'${OPENCV_PYTHON_INSTALL_PATH}/cv2'")
else()
- file(RELATIVE_PATH OpenCV_PYTHON_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/${OPENCV_PYTHON_INSTALL_PATH}/cv2" ${CMAKE_INSTALL_PREFIX})
- set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "os.path.join(LOADER_DIR, '${OpenCV_PYTHON_INSTALL_PATH_RELATIVE_CONFIGCMAKE}')")
+ set(CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE "LOADER_DIR")
endif()
if(DEFINED ${PYTHON}_VERSION_MINOR)
@@ -167,7 +170,8 @@ if(NOT OPENCV_SKIP_PYTHON_LOADER)
if(IS_ABSOLUTE __python_binary_install_path)
set(CMAKE_PYTHON_EXTENSION_PATH "'${__python_binary_install_path}'")
else()
- set(CMAKE_PYTHON_EXTENSION_PATH "os.path.join(${CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE}, '${__python_binary_install_path}')")
+ file(RELATIVE_PATH OpenCV_PYTHON_BINARY_RELATIVE_INSTALL_PATH "${OpenCV_PYTHON_LOADER_FULL_INSTALL_PATH}" "${CMAKE_INSTALL_PREFIX}/${__python_binary_install_path}")
+ set(CMAKE_PYTHON_EXTENSION_PATH "os.path.join(${CMAKE_PYTHON_EXTENSION_INSTALL_PATH_BASE}, '${OpenCV_PYTHON_BINARY_RELATIVE_INSTALL_PATH}')")
endif()
configure_file("${PYTHON_SOURCE_DIR}/package/template/config-x.y.py.in" "${__python_loader_install_tmp_path}/cv2/${__target_config}" @ONLY)
install(FILES "${__python_loader_install_tmp_path}/cv2/${__target_config}" DESTINATION "${OPENCV_PYTHON_INSTALL_PATH}/cv2/" COMPONENT python)

View file

@ -1,35 +0,0 @@
From c26c43c69c654344d2e2fb7b2d21121ca89224e6 Mon Sep 17 00:00:00 2001
From: Maksim Shabunin <maksim.shabunin@gmail.com>
Date: Mon, 3 Dec 2018 17:16:09 +0300
Subject: [PATCH] Fixed compilation with VA-interop on 32-bit platforms
---
modules/core/src/va_intel.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/core/src/va_intel.cpp b/modules/core/src/va_intel.cpp
index ac74f0c5337..c571b90b5fe 100644
--- a/modules/core/src/va_intel.cpp
+++ b/modules/core/src/va_intel.cpp
@@ -340,8 +340,8 @@ static void copy_convert_yv12_to_bgr(const VAImage& image, const unsigned char*
1.5959997177f
};
- CV_CheckEQ(image.format.fourcc, VA_FOURCC_YV12, "Unexpected image format");
- CV_CheckEQ(image.num_planes, 3, "");
+ CV_CheckEQ((size_t)image.format.fourcc, (size_t)VA_FOURCC_YV12, "Unexpected image format");
+ CV_CheckEQ((size_t)image.num_planes, (size_t)3, "");
const size_t srcOffsetY = image.offsets[0];
const size_t srcOffsetV = image.offsets[1];
@@ -417,8 +417,8 @@ static void copy_convert_bgr_to_yv12(const VAImage& image, const Mat& bgr, unsig
-0.2909994125f, 0.438999176f, -0.3679990768f, -0.0709991455f
};
- CV_CheckEQ(image.format.fourcc, VA_FOURCC_YV12, "Unexpected image format");
- CV_CheckEQ(image.num_planes, 3, "");
+ CV_CheckEQ((size_t)image.format.fourcc, (size_t)VA_FOURCC_YV12, "Unexpected image format");
+ CV_CheckEQ((size_t)image.num_planes, (size_t)3, "");
const size_t dstOffsetY = image.offsets[0];
const size_t dstOffsetV = image.offsets[1];

View file

@ -1,28 +0,0 @@
From c4419e4e65a8d9e0b5a15e9a5242453f261bee46 Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
Date: Thu, 15 Nov 2018 06:54:35 +0000
Subject: [PATCH] cvv: repair build
---
modules/cvv/src/qtutil/filter/diffFilterWidget.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/cvv/src/qtutil/filter/diffFilterWidget.cpp b/modules/cvv/src/qtutil/filter/diffFilterWidget.cpp
index a555c84983..ca2964fd16 100644
--- a/modules/cvv/src/qtutil/filter/diffFilterWidget.cpp
+++ b/modules/cvv/src/qtutil/filter/diffFilterWidget.cpp
@@ -1,6 +1,5 @@
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
-#include <opencv2/imgproc/types_c.h>
#include <unordered_map>
@@ -14,6 +13,7 @@
namespace cvv
{
+using namespace cv;
namespace qtutil
{

View file

@ -1,24 +0,0 @@
--- ./CMakeLists.txt.orig 2018-02-27 01:46:32.259819239 +0000
+++ ./CMakeLists.txt 2018-02-27 19:48:19.658736383 +0000
@@ -439,19 +439,14 @@ else()
ocv_update(OPENCV_CONFIG_INSTALL_PATH ".")
else()
include(GNUInstallDirs)
- ocv_update(OPENCV_LIB_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX})
+ ocv_update(OPENCV_LIB_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR})
ocv_update(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH})
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples)
ocv_update(OPENCV_JAR_INSTALL_PATH share/OpenCV/java)
ocv_update(OPENCV_OTHER_INSTALL_PATH share/OpenCV)
if(NOT DEFINED OPENCV_CONFIG_INSTALL_PATH)
- math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
- if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX)
- ocv_update(OPENCV_CONFIG_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/opencv)
- else()
- ocv_update(OPENCV_CONFIG_INSTALL_PATH share/OpenCV)
- endif()
+ ocv_update(OPENCV_CONFIG_INSTALL_PATH lib${LIB_SUFFIX}/OpenCV)
endif()
endif()
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "include")

View file

@ -0,0 +1,11 @@
--- ./cmake/OpenCVDetectOpenCL.cmake.orig 2019-05-14 00:35:41.373094435 +0100
+++ ./cmake/OpenCVDetectOpenCL.cmake 2019-05-14 00:35:50.833189862 +0100
@@ -5,7 +5,7 @@ if(APPLE)
else()
set(OPENCL_LIBRARY "" CACHE STRING "OpenCL library")
set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2" CACHE PATH "OpenCL include directory")
- ocv_install_3rdparty_licenses(opencl-headers "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/LICENSE.txt")
+ #ocv_install_3rdparty_licenses(opencl-headers "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/LICENSE.txt")
endif()
mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)

View file

@ -1,16 +1,34 @@
export VERSION=3.4.4
#!/bin/bash
VERSION=$1
wget -c https://github.com/opencv/opencv/archive/${VERSION}/opencv-${VERSION}.tar.gz
tar xf opencv-${VERSION}.tar.gz
cd opencv-${VERSION}/
find ./ -iname "len*.*" -exec rm {} \;
rm -rf modules/xfeatures2d/
cd ..; tar zcf opencv-clean-${VERSION}.tar.gz opencv-${VERSION}/
rm -rf opencv-${VERSION}/
wget -c https://github.com/opencv/opencv_contrib/archive/${VERSION}/opencv_contrib-${VERSION}.tar.gz
tar xf opencv_contrib-${VERSION}.tar.gz
cd opencv_contrib-${VERSION}/
rm -rf modules/xfeatures2d/
cd ..; tar zcf opencv_contrib-clean-${VERSION}.tar.gz opencv_contrib-${VERSION}/
wget -c https://github.com/opencv/opencv_extra/archive/${VERSION}/opencv_extra-${VERSION}.tar.gz
rm -rf opencv-${VERSION}/
tar xf opencv-${VERSION}.tar.gz
find opencv-${VERSION}/ -iname "*lena*" -exec rm {} ';' -print
find opencv-${VERSION}/ -iname "*lenna*" -exec rm {} ';' -print
rm -r opencv-${VERSION}/modules/xfeatures2d/
tar zcf opencv-clean-${VERSION}.tar.gz opencv-${VERSION}/
rm -r opencv-${VERSION}/
rm -rf opencv_contrib-${VERSION}/
tar xf opencv_contrib-${VERSION}.tar.gz
find opencv_contrib-${VERSION}/ -iname "*lena*" -exec rm {} ';' -print
find opencv_contrib-${VERSION}/ -iname "*lenna*" -exec rm {} ';' -print
rm -r opencv_contrib-${VERSION}/modules/xfeatures2d/
tar zcf opencv_contrib-clean-${VERSION}.tar.gz opencv_contrib-${VERSION}/
rm -r opencv_contrib-${VERSION}/
rm -rf opencv_extra-${VERSION}/
tar xf opencv_extra-${VERSION}.tar.gz
find opencv_extra-${VERSION} -iname "*lena*" -exec rm {} ';' -print
find opencv_extra-${VERSION} -iname "*lenna*" -exec rm {} ';' -print
find opencv_extra-${VERSION} \( -iname "len*.*" -o -iname "*lena*.png" -o -iname "*lena*.jpg" \) -exec rm {} ';' -print
tar zcf opencv_extra-clean-${VERSION}.tar.gz opencv_extra-${VERSION}/
rm -r opencv_extra-${VERSION}/
#echo fedpkg new-sources $(spectool -l --sources opencv.spec | sed 's/.*: //;s/.*\///')

11
opencv.python.patch Normal file
View file

@ -0,0 +1,11 @@
--- opencv-4.5.5/modules/python/common.cmake.orig 2022-04-11 18:40:18.925266930 +0100
+++ opencv-4.5.5/modules/python/common.cmake 2022-04-11 18:42:17.753849346 +0100
@@ -179,7 +179,7 @@ else()
else()
set(__python_binary_subdir "python-${${PYTHON}_VERSION_MAJOR}.${${PYTHON}_VERSION_MINOR}")
endif()
- set(__python_binary_install_path "${OPENCV_PYTHON_INSTALL_PATH}/${__python_loader_subdir}${__python_binary_subdir}")
+ set(__python_binary_install_path "${OPENCV_PYTHON_INSTALL_PATH}/${__python_loader_subdir}")
endif()
install(TARGETS ${the_module}

File diff suppressed because it is too large Load diff

11
qt69.patch Normal file
View file

@ -0,0 +1,11 @@
--- opencv-4.11.0/modules/highgui/CMakeLists.txt 2025-01-08 04:47:46.000000000 -0800
+++ opencv-4.11.0/modules/highgui/CMakeLists.txt.new 2025-07-08 15:54:10.138078285 -0700
@@ -125,7 +125,7 @@
endif()
foreach(dt_dep ${qt_deps})
- add_definitions(${Qt${QT_VERSION_MAJOR}${dt_dep}_DEFINITIONS})
+ link_libraries(${Qt${QT_VERSION_MAJOR}${dt_dep}})
include_directories(${Qt${QT_VERSION_MAJOR}${dt_dep}_INCLUDE_DIRS})
list(APPEND HIGHGUI_LIBRARIES ${Qt${QT_VERSION_MAJOR}${dt_dep}_LIBRARIES})
endforeach()

View file

@ -1,2 +1,5 @@
SHA512 (opencv_contrib-clean-3.4.4.tar.gz) = ccb2fd7c3034e5c6e6d5065ee74a65ad4d4861a5683a81013cc93750de81d390ff2ad40ed65fcf54807090f67b136e6bb57cd9f1a435c49d5812d5380c062fd7
SHA512 (opencv-clean-3.4.4.tar.gz) = ee8cc8af5e8c6accb4593171c6e30848f91717d41143e74336934fa4eefe4a333623ce2cf54f663f4e70a86c2d637389d9d0636458c9d35e6a5bf75a4cd78b84
SHA512 (opencv-clean-4.12.0.tar.gz) = 7bcbe3629dda78e63cd737568ed94ef3f63dd7b11196247ffd03f93fed5ae9a96483d9fae25385dfd6f30c8c2e11677fd9f5c26b2f7a1bd88ca303b06a98b87d
SHA512 (opencv_contrib-clean-4.12.0.tar.gz) = e279bd46d2b4a3e4d8c98401e2abdd873ee15b63d14d16b7c9980f84fee02c08491cab4d8cd6b4e493d0892e254e56dd759235f3606332a1b264a41be3c8f9d8
SHA512 (wechat-20230712.git3487ef7.tar.gz) = bc4f220465de41df8af0cb35312c1db155976d05f13a60e43c1798b161d8f56388e34a59108fb3e27e8c97b53acfd198256d9ae420b5f70a32ddc1ea65c3c8a6
SHA512 (face_landmark_model.dat.xz) = 7558f29431bb9cad1f22ee067ad3ed41be8f68b865992eb7d3a5ce6b6b9e1d031cb03e33c3c149220ef8faebd0471703a8a3bbb06402bcc8ce76bd28317aa307
SHA512 (962ce79e0b95591f226431f7b5f152cd-v0.1.2e.zip) = 87c65716498ca2e4f64fb9a1f78f7e5c48fffff5fc6735027edfb7d7ccc0d9f5b01c85f4b956ddc7e1c35c69ee2513d48a7da91764c2fd01d073ee5a1fc90c6f

98
xorg.conf Normal file
View file

@ -0,0 +1,98 @@
# This xorg configuration file is meant to be used
# to start a dummy X11 server for graphical testing.
Section "ServerFlags"
Option "DontVTSwitch" "true"
Option "AllowMouseOpenFail" "true"
Option "PciForceNone" "true"
Option "AutoEnableDevices" "false"
Option "AutoAddDevices" "false"
EndSection
Section "InputDevice"
Identifier "dummy_mouse"
Option "CorePointer" "true"
Driver "void"
EndSection
Section "InputDevice"
Identifier "dummy_keyboard"
Option "CoreKeyboard" "true"
Driver "void"
EndSection
Section "Device"
Identifier "dummy_videocard"
Driver "dummy"
Option "ConstantDPI" "true"
#VideoRam 4096000
#VideoRam 256000
VideoRam 192000
EndSection
Section "Monitor"
Identifier "dummy_monitor"
HorizSync 5.0 - 1000.0
VertRefresh 5.0 - 200.0
#This can be used to get a specific DPI, but only for the default resolution:
#DisplaySize 508 317
#NOTE: the highest modes will not work without increasing the VideoRam
# for the dummy video card.
Modeline "32768x32768" 15226.50 32768 35800 39488 46208 32768 32771 32781 32953
Modeline "32768x16384" 7516.25 32768 35544 39192 45616 16384 16387 16397 16478
Modeline "16384x8192" 2101.93 16384 16416 24400 24432 8192 8390 8403 8602
Modeline "8192x4096" 424.46 8192 8224 9832 9864 4096 4195 4202 4301
Modeline "5496x1200" 199.13 5496 5528 6280 6312 1200 1228 1233 1261
Modeline "5280x1080" 169.96 5280 5312 5952 5984 1080 1105 1110 1135
Modeline "5280x1200" 191.40 5280 5312 6032 6064 1200 1228 1233 1261
Modeline "5120x3200" 199.75 5120 5152 5904 5936 3200 3277 3283 3361
Modeline "4800x1200" 64.42 4800 4832 5072 5104 1200 1229 1231 1261
Modeline "3840x2880" 133.43 3840 3872 4376 4408 2880 2950 2955 3025
Modeline "3840x2560" 116.93 3840 3872 4312 4344 2560 2622 2627 2689
Modeline "3840x2048" 91.45 3840 3872 4216 4248 2048 2097 2101 2151
Modeline "3840x1080" 100.38 3840 3848 4216 4592 1080 1081 1084 1093
Modeline "3600x1200" 106.06 3600 3632 3984 4368 1200 1201 1204 1214
Modeline "3288x1080" 39.76 3288 3320 3464 3496 1080 1106 1108 1135
Modeline "2048x2048" 49.47 2048 2080 2264 2296 2048 2097 2101 2151
Modeline "2048x1536" 80.06 2048 2104 2312 2576 1536 1537 1540 1554
Modeline "2560x1600" 47.12 2560 2592 2768 2800 1600 1639 1642 1681
Modeline "2560x1440" 42.12 2560 2592 2752 2784 1440 1475 1478 1513
Modeline "1920x1440" 69.47 1920 1960 2152 2384 1440 1441 1444 1457
Modeline "1920x1200" 26.28 1920 1952 2048 2080 1200 1229 1231 1261
Modeline "1920x1080" 23.53 1920 1952 2040 2072 1080 1106 1108 1135
Modeline "1680x1050" 20.08 1680 1712 1784 1816 1050 1075 1077 1103
Modeline "1600x1200" 22.04 1600 1632 1712 1744 1200 1229 1231 1261
Modeline "1600x900" 33.92 1600 1632 1760 1792 900 921 924 946
Modeline "1440x900" 30.66 1440 1472 1584 1616 900 921 924 946
ModeLine "1366x768" 72.00 1366 1414 1446 1494 768 771 777 803
Modeline "1280x1024" 31.50 1280 1312 1424 1456 1024 1048 1052 1076
Modeline "1280x800" 24.15 1280 1312 1400 1432 800 819 822 841
Modeline "1280x768" 23.11 1280 1312 1392 1424 768 786 789 807
Modeline "1360x768" 24.49 1360 1392 1480 1512 768 786 789 807
Modeline "1024x768" 18.71 1024 1056 1120 1152 768 786 789 807
Modeline "768x1024" 19.50 768 800 872 904 1024 1048 1052 1076
EndSection
Section "Screen"
Identifier "dummy_screen"
Device "dummy_videocard"
Monitor "dummy_monitor"
DefaultDepth 24
SubSectionSub "Display"
Viewport 0 0
Depth 24
#Modes "32768x32768" "32768x16384" "16384x8192" "8192x4096" "5120x3200" "3840x2880" "3840x2560" "3840x2048" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768"
Modes "5120x3200" "3840x2880" "3840x2560" "3840x2048" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768"
#Virtual 32000 32000
#Virtual 16384 8192
Virtual 8192 4096
#Virtual 5120 3200
EndSubSection
EndSection
Section "ServerLayout"
Identifier "dummy_layout"
Screen "dummy_screen"
InputDevice "dummy_mouse"
InputDevice "dummy_keyboard"
EndSection