docs(codec-eval): make the API quick-start compilable (callback signature + report shape)#2
Merged
Merged
Conversation
… signature + report-read + quality_levels semantics (insulated-dev usability test)
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
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.
Why
An "insulated external developer" usability test (given only the README) found the methodology/fair-comparison content excellent, but the API quick-start was uncompilable. Concretely:
Box::new(|image, request| my_codec::encode(image, request.quality))with no realimage/request/return types shown.session.evaluate_corpus("./test_images")—evaluate_corpusdoes not exist in the crate. The real method isevaluate_image(name, ImageData).reportwas never read — no field ofImageReport/CodecResultwas shown, so a reader couldn't tell how to get a metric or a byte count out.quality_levelssemantics were ambiguous: encoder quality (0-100) vs. target SSIMULACRA2 scores. The README's own "don't compare by quality" methodology made this genuinely confusing.codec-eval = "0.3.2".What this changes (README only, + a CHANGELOG note)
Rewrites the quick-start so every codec-eval symbol resolves, verified by compiling a faithful skeleton (
cargo check, clean):Box::new(|image: &ImageData, request: &EncodeRequest| -> Result<Vec<u8>> { ... }), matchingEncodeFninsrc/eval/session.rs:181. Showsimage.to_rgb8_vec()/image.width()/image.height()and returns encoded bytes.session.evaluate_image("test.png", reference)?returning anImageReport(src/eval/session.rs:368), with a note that it takes an already-decodedImageData(the harness doesn't read files) and a pointer toCorpus::get_dataset(...)for the built-in corpora.report.resultsand printscodec_id,quality,file_size,bits_per_pixel,metrics.ssimulacra2,metrics.dssim(fields fromsrc/eval/report.rs), pluswrite_image_report.quality_levelsclarified — documented inline as encoder quality settings (0-100) drawn intorequest.quality(a codec-specific dial), not target metric scores (EncodeRequest::qualityisf64, "0-100, codec-specific interpretation",src/eval/session.rs:153).cargo add codec-eval(crates.io) as the primary line; git for unreleased; the companioncodec-eval-cliflagged git-only.Note:
EncodeRequestis not re-exported at the crate root, so the example imports it via its real pathcodec_eval::eval::session::EncodeRequest(flagged in a comment). The samesrc/lib.rsdoc-comment quick-start has the analogousOk(encoded_bytes)-with-undefined-vars shape; left out of scope to keep this diff README-only, but worth a follow-up.Methodology / fair-comparison / R-D / viewing-conditions content is unchanged.