Repository navigation
Scan reads embedded XMP from metadata, not by re-reading whole files - #311
Open
erhangundogan wants to merge 5 commits into
Open
erhangundogan wants to merge 5 commits into
erhangundogan wants to merge 5 commits into
Conversation
After the hashing pass, scan reconciles XMP for every file it just hashed, and read_data_in found the embedded packet by reading the entire media file into memory, copying it again through String::from_utf8_lossy, and searching the text, one file at a time. A folder of 61 MP4s (21 GB) spent one minute hashing and 2.4 minutes here; a large video briefly cost about twice its size in RAM. faces' XMP readback used the same path. An embedded packet only ever sits in metadata: JPEG APP1, PNG iTXt, WebP's XMP chunk, TIFF tag 700, a HEIC's mime item, a movie's boxes other than mdat. content_key already finds exactly those spans by reading block headers for the metadata hash, so content_key::metadata returns their bytes (a span over 64 MB is skipped) and the reader searches only them, with the same confinement and size-scaled timeout as before. A format content_key does not parse is still searched whole, so no packet videre used to find is lost. No XMP crate fits: xmp_toolkit wraps Adobe's C++ SDK, nom-exif centres on EXIF under a non-standard license, img-parts covers JPEG, PNG and RIFF only; the span parser here already handles all eight formats. A test reads a video's packet through a counting reader and asserts the 8 MB of media samples are never read; it read all of them before. On a 999-file, 4.4 GB sample a fresh scan went from 34 s to under 2 s, storing identical rows and the same XMP-derived mark.
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://xmp-scan-videre-doc.erhan-gundogan.workers.dev (commit a88a38f)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
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.
After hashing, scan read every new file whole into memory (and copied it again) to find embedded XMP, one file at a time: 61 MP4s (21 GB) spent 2.4 minutes there after a 1-minute hash, and a large video cost about twice its size in RAM.
Embedded XMP only lives in metadata, and
content_keyalready finds those spans, so the reader now searches only them viacontent_key::metadata. Formats it does not parse are still searched whole.A counting-reader test proves a video's media samples are not read. On a 999-file, 4.4 GB sample a fresh scan went from 34 s to under 2 s with identical stored results.