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.
Description
When reading a raw image, setting the
user_flip
to 1 meant ignoring theflip
value (to avoid buffer rotation from LibRaw).However the value 1 for the
user_flip
is not neutral: values lie between 0 and 7 (see https://www.libraw.org/docs/API-datastruct-eng.html#libraw_image_sizes_t), and 1 corresponds to a horizontal mirror (in my understanding of the source code).The proposed fix is to use 0 as
user_flip
value for ignoring theflip
value.This modification invalidates the changes made in this PR: #3847.
Therefore, flip to orientation conversion has been adapted to match exactly LibRaw's documentation, which handles only rotations (+90, +180, -90 degrees).
Tests
The previous PR was only tested on images of landscape and human faces, hence the mirroring issue remained unnoticed.
When reading images containing text however the problem is clearly visible.
This PR fixes this mirroring issue on the following 4 orientations: 0, +90, +180 and -90 degrees rotation.
Other orientations could not be tested as they don't seem to ever appear on raw images datasets.