Commit Graph

555 Commits

Author SHA1 Message Date
Kumataro
a63ede6b1d
Merge pull request #26930 from Kumataro:fix26924
Imgcodecs: gif: support Disposal Method #26930

Close https://github.com/opencv/opencv/issues/26924

### 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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-02-26 17:15:41 +03:00
Suleyman TURKMEN
39bc5df72a
Merge pull request #26973 from sturkmen72:png_test
Add a test related IMWRITE_PNG_COMPRESSION parameter #26973

### 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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-02-25 15:24:25 +03:00
Maksim Shabunin
45aa502549
Merge pull request #26915 from mshabunin:fix-png-be
Resolves #26913
Related(?): #25715 #26832
2025-02-13 16:58:15 +03:00
Kumataro
fbd8180cc1 imgcodecs: tiff: refactor reading scanlines test 2025-02-10 08:40:28 +09:00
Kumataro
01e3fe8791
Merge pull request #26859 from Kumataro:fix26858
imgcodecs:gif: support IMREAD_UNCHANGED and IMREAD_GRAYSCALE #26859

Close #26858 

### 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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-02-06 19:29:54 +03:00
Suleyman TURKMEN
e8e49ab7a8
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
2025-02-04 12:21:55 +03:00
Vincent Rabaud
c21d0ad9d0
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
2025-01-31 11:00:23 +03:00
Suleyman TURKMEN
585226a5fd fix for large tEXt chunk 2025-01-28 16:54:00 +03:00
Kumataro
c840e24e94
Merge pull request #26844 from Kumataro:fix26843
imgcodecs: jpegxl: imdecode() directly read from memory #26844

Close #26843 

### 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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-01-27 17:18:28 +03:00
Alexander Smorkalov
c637dd2646
Merge pull request #26828 from sturkmen72:imgcodecs_improvements
Imgcodecs minor improvements for better code readibility
2025-01-25 09:41:10 +03:00
Suleyman TURKMEN
d4eed1c5aa
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
2025-01-25 09:31:00 +03:00
Suleyman TURKMEN
ca51d55ee3 minor improvement for better code readibility 2025-01-24 15:31:53 +03:00
Vincent Rabaud
4e4eaea9a3 Move the checks to read_chunk.
Only user chunks need to be compared to PNG_USER_CHUNK_MALLOC_MAX
2025-01-23 16:37:46 +01:00
Vincent Rabaud
7728dd3387
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
2025-01-22 14:47:28 +03:00
Kumataro
ea023b72ce
Merge pull request #26788 from Kumataro:fix26767
jpegxl: support cv::IMREAD_UNCHANGED and other ImreadFlags #26788

Close https://github.com/opencv/opencv/issues/26767

### 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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-01-22 10:50:43 +03:00
Suleyman TURKMEN
db962ea069
Merge pull request #26813 from sturkmen72:fix_animation
Added CV_WRAP to Animation struct #26813

closes #26808
### 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
2025-01-22 10:40:08 +03:00
MaximSmolskiy
b7e1cba660 Fix memory leaks for JpegXLDecoder 2025-01-17 00:39:32 +03:00
Vincent Rabaud
bfb54aa691 Remove useless C headers 2025-01-13 16:34:28 +01:00
Super
2c2866a7a6
Merge pull request #26738 from redhecker:fix
Fix bugs in GIF decoding #26738 

### Pull Request Readiness Checklist

this is related to #25691 

i solved two bugs here:

1. the decoding setting:
according to [https://www.w3.org/Graphics/GIF/spec-gif89a.txt](https://www.w3.org/Graphics/GIF/spec-gif89a.txt)

```
    DEFERRED CLEAR CODE IN LZW COMPRESSION

    There has been confusion about where clear codes can be found in the
    data stream.  As the specification says, they may appear at anytime.  There
    is not a requirement to send a clear code when the string table is full.

    It is the encoder's decision as to when the table should be cleared.  When
    the table is full, the encoder can chose to use the table as is, making no
    changes to it until the encoder chooses to clear it.  The encoder during
    this time sends out codes that are of the maximum Code Size.

    As we can see from the above, when the decoder's table is full, it must
    not change the table until a clear code is received.  The Code Size is that
    of the maximum Code Size.  Processing other than this is done normally.

    Because of a large base of decoders that do not handle the decompression in
    this manner, we ask developers of GIF encoding software to NOT implement
    this feature until at least January 1991 and later if they see that their
    particular market is not ready for it.  This will give developers of GIF
    decoding software time to implement this feature and to get it into the
    hands of their clients before the decoders start "breaking" on the new
    GIF's.  It is not required that encoders change their software to take
    advantage of the deferred clear code, but it is for decoders.
```
at first i didn't consider this case, thus leads to a bug discussed in #25691. the changes made in function lzwDecode() is aiming at solving this.

2. the fetch method of loopCount:
in the codes at https://github.com/opencv/opencv/blob/4.x/modules/imgcodecs/src/grfmt_gif.cpp#L410, if the branch is taken, 3 more bytes will be taken, leading to unpredictable behavior.

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
2025-01-11 10:34:49 +03:00
Vincent Rabaud
ee86f1c969 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
2025-01-10 17:04:39 +01:00
Vincent Rabaud
d12fa37eed
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
2025-01-10 11:33:43 +03:00
Alexander Smorkalov
bdb6a968ce
Merge pull request #26706 from Kumataro:fix26705
imgcodecs: fix EXR tests
2025-01-09 15:46:52 +03:00
Alexander Smorkalov
198f23890e Fixed fread size check for corrupted PNGs. 2025-01-08 14:23:43 +03:00
Vincent Rabaud
cb959b3915 Fix behavior change when PNG buffer is incomplete. 2025-01-08 09:11:38 +01:00
Alexander Smorkalov
4b35101d55
Merge pull request #26720 from vrabaud:png_leak
Use RAII to avoid leaks in PNG reader.
2025-01-08 10:57:28 +03:00
Vincent Rabaud
0e3d71b0e0 Remove extra /* in /**/ comment 2025-01-07 11:49:30 +01:00
Vincent Rabaud
d86387347d Use RAII to avoid leaks in PNG reader. 2025-01-06 16:42:30 +01:00
Suleyman TURKMEN
2aee94752a
Merge pull request #26714 from sturkmen72:png
Fix for png durations and memory leak #26714

### Pull Request Readiness Checklist

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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-01-06 14:25:08 +03:00
Alexander Smorkalov
ad36f68500 Fixed some memory leaks in PNG/APNG implementation. 2025-01-06 10:41:33 +03:00
Alexander Smorkalov
ff18c9cc79
Merge pull request #26688 from sturkmen72:gif-png-webp-avif
Animated GIF APNG WEBP AVIF revisions
2025-01-04 16:44:14 +03:00
Alexander Smorkalov
f65006eee1
Merge pull request #26699 from vrabaud:bmp_overflow
Fix integer overflow in in cv::BmpDecoder::readHeader
2025-01-03 14:43:23 +03:00
Suleyman TURKMEN
b4d0325666 GIF APNG WEBP AVIF revisions 2025-01-03 14:29:18 +03:00
Vincent Rabaud
0538e64b13
Fix leaks in cv:Merge pull request #26701 from vrabaud:png_leak
Fix leaks in cv::PngDecoder #26701

Bug: oss-fuzz:386688709

### Pull Request Readiness Checklist

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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-01-03 14:13:18 +03:00
Vincent Rabaud
845616d82c Fix integer overflow in in cv::BmpDecoder::readHeader
Bug: oss-fuzz:371546812
2025-01-03 08:59:43 +01:00
Alexander Smorkalov
5e1eed5026
Merge pull request #26700 from vrabaud:png_buffer_overflow
Fix heap buffer overflow in cv::PngDecoder::read_from_io
2025-01-03 10:39:23 +03:00
Kumataro
1281317e17 imgcodecs: fix EXR tests 2025-01-03 09:53:01 +09:00
Vincent Rabaud
2f0035b23f Fix flaky Imgcodecs_APNG.imwriteanimation_bgcolor 2025-01-02 22:53:06 +01:00
Vincent Rabaud
12963ea699 Fix heap buffer overflow in cv::PngDecoder::read_from_io
Bug: oss-fuzz:386688710
2025-01-02 14:51:20 +01:00
cDc
1db982780f
Merge pull request #26379 from cdcseacave:jxl_codec
Add jxl (JPEG XL) codec support #26379

### Pull Request Readiness Checklist

Related CI and Docker changes:
- https://github.com/opencv/ci-gha-workflow/pull/190
- https://github.com/opencv-infrastructure/opencv-gha-dockerfile/pull/44

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 https://github.com/opencv/opencv/issues/20178
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-12-31 11:56:35 +03:00
Suleyman TURKMEN
8bc65a1d13
Merge pull request #25715 from sturkmen72:apng_support
Animated PNG Support #25715

Continues https://github.com/opencv/opencv/pull/25608

### 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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-12-30 11:32:31 +03:00
Suleyman TURKMEN
d9a139f9e8
Merge pull request #25608 from sturkmen72:animated_webp_support
Animated WebP Support #25608

related issues #24855 #22569 

### 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
2024-12-20 13:06:28 +03:00
Letu Ren
2e21e11318 Fix test_exif compilation when non of JPEG, PNG, AVIF is enabled
When none of JPEG, PNG, AVIF is enabled, exif_files is a zero-length
array, which is prohibited by C++ reference.
2024-12-17 21:41:45 +08:00
Super
082cd7a74e
Merge pull request #25691 from redhecker:gifSupport
[GSoC] Add GIF decode and encode for imgcodecs #25691

this is related to #24855 

we add  gif support for `imread`, `imreadmulti`, `imwrite` and `imwritemulti`

opencv_extra: https://github.com/opencv/opencv_extra/pull/1203

### 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
- [x] 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
2024-12-07 10:17:41 +03:00
Maksim Shabunin
c58b6bf11f Fixed several cases of unaligned pointer cast 2024-12-02 16:15:23 +03:00
Kumataro
5080be6669 doc: fix to supported depth for TIFF 2024-11-24 15:03:58 +09:00
xkszltl
d0c8b36de8
Check existence of OpenEXR version macros before using.
It is introduced in 2.0.1 (not even in 2.0.0) and some old system like CentOS 7 still has 1.7 in stock.
- 60cdff8a6f (diff-c4bae0726aebe410e407db9abd406d9cf2684f82dd8a08f46d84e8b7c35cf22aR67)
2024-11-17 18:37:13 -08:00
Alexander Smorkalov
11a4a06fa4
Merge pull request #26181 from sturkmen72:png_exif_test
Enable PNG exif orientation test
2024-11-13 16:57:18 +03:00
Kumataro
35dbf32227
Merge pull request #26211 from Kumataro:fix26207
imgcodecs: implement imencodemulti() #26211

Close #26207
### 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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-10-18 14:44:55 +03:00
Suleyman TURKMEN
8e5dbc03fe
Merge pull request #26298 from sturkmen72:avif
Proposed solution for the issue 26297 #26298

closes #26297

### 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
- [x] 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
2024-10-14 11:23:02 +03:00
Suleyman TURKMEN
48a48fe11c Enable PNG exif orientation test 2024-09-27 00:04:12 +03:00