opencv/modules
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
..
calib3d js: add types included in bound APIs 2024-12-18 11:43:39 +01:00
core core: fixed VSX intrinsics implementation 2025-01-10 18:34:11 +03:00
dnn Tune threshold to stabinlize test with Vulkan backend. 2024-12-31 10:23:13 +03:00
features2d Merge pull request #26590 from Kumataro:fix26589 2024-12-17 07:40:27 +03:00
flann flann: remove unused hdf5 header 2024-11-14 19:44:10 +03:00
gapi Add include chrono gstreamersource.cpp 2024-12-24 06:53:30 +00:00
highgui Merge pull request #26379 from cdcseacave:jxl_codec 2024-12-31 11:56:35 +03:00
imgcodecs Merge pull request #26738 from redhecker:fix 2025-01-11 10:34:49 +03:00
imgproc Merge pull request #26729 from MaximSmolskiy:change-article-for-fitEllipseDirect-function 2025-01-08 12:14:45 +03:00
java Merge pull request #26057 from asmorkalov:as/android_16k_pages 2024-12-31 11:53:04 +03:00
js Merge pull request #26147 from vrabaud:opencv_js 2024-12-19 17:35:16 +03:00
ml Merge pull request #26590 from Kumataro:fix26589 2024-12-17 07:40:27 +03:00
objc Merge pull request #26713 from homuler:fix/build-ios-framework 2025-01-10 14:48:56 +03:00
objdetect minor change 2025-01-08 20:17:17 +05:30
photo Merge pull request #26511 from sturkmen72:proposed_fix_for_21902 2024-12-19 11:57:58 +03:00
python addition of POST_BUILD 2025-01-09 20:40:56 +05:30
stitching Document some stitching methods and enable bindings for them. 2024-11-25 14:03:49 +03:00
ts Fix Syntax warning in ts summary.py 2024-12-18 05:27:10 +08:00
video build: made environment access a separate feature 2024-10-30 18:37:22 +03:00
videoio Merge pull request #26698 from warped-rudi:mediandk2 2025-01-03 17:53:00 +03:00
world cmake: use /INCREMENTAL:NO with MSVS 2015 2023-12-07 19:46:27 +00:00