Fix pinned logo mask matching (stride corruption at load) - #8
Merged
Merged
Conversation
LoadLogoMaskData can run when the width global is 0 (before the first decoded frame) or transiently wrong (it is rewritten by both decode and analysis contexts within one run), scattering mask cells so that CheckStationLogoEdge finds testEdges==0 and pinned-mask matching silently never works. Store cells at a fixed MAXWIDTH stride, record it, and index the mask through the recorded stride while frame pixels keep the live width.
Store a loaded mask at the file's picWidth stride (MAXWIDTH only when the file has none), record it in logo_mask_stride, and use it for every mask read and write: the matcher, the overlay, the dump and the save. The frame is still indexed by width, which the rejection-mode-4 branch had mixed up with the mask index. Reject a logo file whose area does not fit, and skip matching when the logo area does not fit the current frame.
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.
Supersedes #5 (commit kept, credit to @v8eta) with review fixes on top: one stride for every mask read and write (matcher, overlay, dump, save), the frame indexed by width in rejection mode 4 where the mask index was reading past the frame, a range check on the logo file's area, and a bounds guard when the logo area does not fit the current frame.
Verified on a recording with a logo: a pinned mask reproduces the learned run's logo fraction exactly, the re-saved logo file is byte-identical, and the cut list matches the current fancybits build on the same pinned run.