You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your review, I fixed this and next line.
(IHDR does not expect the length of chunk data is 4.)
- // If first is IHDR chunk, output shall not be empty.- // 8 means PNG sigunature length.- // 4 means lenght of chunk.+ // If IHDR chunk found as the first chunk, output shall not be empty.+ // 8 means PNG signature length.+ // 4 means length field(uint32_t).
The reason will be displayed to describe this comment to others. Learn more.
chatGPT suggests
if (id == id_CgBI)
{
CV_LOG_ERROR(NULL, "CgBI chunk (Apple private) found as the first chunk. IHDR is expected.");
}
else
{
CV_LOG_ERROR(NULL, "IHDR chunk shall be first. This data may be broken or malformed.");
}
The reason will be displayed to describe this comment to others. Learn more.
I agreed to the message change.
This fix resulted in a complicated if statement, so I flattened it.
Before
if (id != id_IHDR)
{
if (id == id_CgBI)
{
CV_LOG_ERROR(NULL, "CgBI chunk (Apple private) found as the first chunk. IHDR is expected.");
}
else
{
CV_LOG_ERROR(NULL, "IHDR chunk shall be first. This data may be broken or malformed.");
}
returnfalse;
}
After
if (id == id_CgBI)
{
CV_LOG_ERROR(NULL, "CgBI chunk (Apple private) found as the first chunk. IHDR is expected.");
returnfalse;
}
if (id != id_IHDR)
{
CV_LOG_ERROR(NULL, "IHDR chunk shall be first. This data may be broken or malformed.");
returnfalse;
}
I have also reflected this correction in the comments of the test code. Thank you very much !
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #27295
To optimize for the native pixel format of the iPhone's early PowerVR GPUs, Apple implemented a non-standard PNG format.
Details: https://theapplewiki.com/wiki/PNG_CgBI_Format
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.