imgcodecs: gif: support Disposal Method#26930
Conversation
|
Now this pull request is draft because we have to add tests for |
|
i can confirm the PR seems fixed the bug. |
|
I feel more refactoring seems be needed from current GifEncoder/Decoder. opencv/modules/imgcodecs/src/grfmt_gif.cpp Lines 516 to 536 in 7a2b048
class GifEncoder {
+ struct ImageDescriptor {
+ imageWidth;
+ imageHeight; };
+ struct LogicalScreenDescriptor {
+ logicalScreenWidth;
+ logicalScreenHeight; };
} |
|
Sorry I test with const uint8_t gcePackedFields = (GIF_DISPOSE_RESTORE_PREVIOUS << GIF_DISPOSE_METHOD_SHIFT) |
- (criticalTransparency) ? GIF_TRANSPARENT_INDEX_GIVEN : GIF_TRANSPARENT_INDEX_NOT_GIVEN;
+ (criticalTransparency ? GIF_TRANSPARENT_INDEX_GIVEN : GIF_TRANSPARENT_INDEX_NOT_GIVEN);It seems this code works following. const uint8_t gcePackedFields =
( (GIF_DISPOSE_RESTORE_PREVIOUS << GIF_DISPOSE_METHOD_SHIFT) | criticalTransparency) )
?
GIF_TRANSPARENT_INDEX_GIVEN :
GIF_TRANSPARENT_INDEX_NOT_GIVEN;
- ``` |
asmorkalov
left a comment
There was a problem hiding this comment.
Looks good to me. Need to check possible out-of-bound access mentioned bellow.
| TEST(Imgcodecs_Gif, decode_disposal_method) | ||
| { | ||
| const string root = cvtest::TS::ptr()->get_data_path(); | ||
| const string filename = root + "gifsuite/disposalMethod.gif"; |
There was a problem hiding this comment.
Looks like it's a new file. Please create PR to opencv_extra repo with the same branch name.
There was a problem hiding this comment.
I'm sorry I created branch which has same name this patch so its test is passed, but I forget to create PR.
Please could you merge this pull request ? opencv/opencv_extra#1239
Close #26924
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.