Repository navigation
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Read the Olympus preview as GetOlympusPreviewImage does
NOTE: #24 answers both questions the port's way. C++'s
GetOlympusPreviewImagenow reads the full size from RawProcessing even when an earlier step fails, and writes the preview offset and length only when both read. On master with #24, all four rows below agree, with the Rust column's values on both sides, so this PR can be closed once #24 is merged.Problem
GetOlympusPreviewImage(C++, Rust) reads an ORF's preview offset and length from the MakerNote's CameraSettings IFD, and the full image size from the RawProcessing IFD's AspectFrame.OrfGetPreviewDataignores whether it succeeds, as the port does, so the caller gets whatever it wrote before it stopped. The two differ in two ways:For example, an ORF whose MakerNote starts at byte 1,024, with a 35-byte preview at 1,792 and an AspectFrame of 4032×3024, with one entry changed:
In the examples for (2), the full size is 4032×3024 on both sides. With PreviewImageStart unreadable, C++'s preview offset is the 0 it held plus the MakerNote's 1,024, so the preview starts at the MakerNote itself.
Question
Which behaviour do we want: C++'s or the Rust port's? Specifically:
GetOlympusPreviewImage, a step before the full size fails: should it stop there, leaving the full size unset (like the C++ library), or still read the full size from RawProcessing (like the Rust port)?GetOlympusPreviewImage, PreviewImageStart or PreviewImageLength does not read: should it still write the preview offset (plus the MakerNote's offset) and length (like the C++ library), or write neither (like the Rust port)?This PR implements C++'s behaviour.
Fix
get_olympus_preview_imagereturns whereGetOlympusPreviewImagereturns false, and writes the preview fields as it does:Replayed before and after:
Of the campaigns' inputs, 10 ORFs differ from C++ in these fields on main and none with this PR; no other input changes. The port's tests pass unchanged (44 + 174).
Notes for review:
OrfGetPreviewDataomits the error because "some images do not contain any preview data", yet such an ORF also loses its full size in C++; and in (2) C++ reports a preview that starts at the MakerNote or has no bytes. To keep the port's behavior, we can close this PR.get_olympus_preview_imageis public: it now returns an error whereGetOlympusPreviewImagereturns false.extract_orfignores the result, asOrfGetPreviewDatadoes.output_typealso differs on these files, before and after. Use piex's RawImageTypes numbers in the cxx bridge #9 covers that.