Visual regression testing of H264 frames and images.

Overview

twenty-twenty

The twenty-twenty library allows for visual regression testing of H.264 frames and images. It makes it easy to update the contents when they should be updated to match the new results.

Each function takes a score threshold, which is the lowest possible "score" you are willing for the image comparison to return. If the resulting score is less than the threshold, the test will fail. The score must be a number between 0 and 1. If the images are the exact same, the score will be 1.

The underlying algorithm is SSIM, which is a perceptual metric that quantifies the image quality degradation that is caused by processing such as data compression or by losses in data transmission. More information can be found here.

You will need ffmpeg installed on your system to use this library. This library uses the ffmpeg bindings in rust to convert the H.264 frames to images.

Use it like this for an H.264 frame:

let actual = get_h264_frame();
twenty_twenty::assert_h264_frame("tests/initial-grid.png", &actual, 0.9);

Use it like this for an image:

let actual = get_image();
twenty_twenty::assert_image("tests/dog1.png", &actual, 0.9);

If the output doesn't match, the program will panic! and emit the difference in the score.

To accept the changes from get_h264_frame() or get_image(), run with TWENTY_TWENTY=overwrite.

Publishing a new release

We have a GitHub action that pushes our releases here. It is triggered by pushing a new tag. So do the following:

  1. Bump the version in Cargo.toml. Commit it and push it up to the repo.
  2. Create a tag with the new version: git tag -sa v$(VERSION) -m "v$(VERSION)"
  3. Push the tag to the repo: git push origin v$(VERSION)
Comments
  • Add more modes to support dumping images on CI

    Add more modes to support dumping images on CI

    Now in CI we can just set TWENTY_TWENTY=store-artifact-on-mismatch and later upload the images as artifacts. This helps if we want to visually compare the generated images.

    TWENTY_TWENTY=store-artifact also exists to always write the new images to disk.

    We may want to make the directory for artifacts configurable, but this should be fine for our purposes for now.

    opened by iterion 2
  • Bump Swatinem/rust-cache from 2.5.0 to 2.5.1

    Bump Swatinem/rust-cache from 2.5.0 to 2.5.1

    Bumps Swatinem/rust-cache from 2.5.0 to 2.5.1.

    Release notes

    Sourced from Swatinem/rust-cache's releases.

    v2.5.1

    • Fix hash contribution of Cargo.lock.
    Changelog

    Sourced from Swatinem/rust-cache's changelog.

    2.5.1

    • Fix hash contribution of Cargo.lock.
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 0
  • Bump anyhow from 1.0.71 to 1.0.72

    Bump anyhow from 1.0.71 to 1.0.72

    Bumps anyhow from 1.0.71 to 1.0.72.

    Release notes

    Sourced from anyhow's releases.

    1.0.72

    • Documentation improvements
    Commits
    • e458996 Release 1.0.72
    • 660fb0f Opt in to generate-link-to-definition when building on docs.rs
    • 24d9166 Add CI job using minimal-versions
    • 2c913b3 Remove .clippy.toml in favor of respecting rust-version from Cargo.toml
    • 1f17666 Ignore needless_else clippy lint in test suite
    • 6046674 Show error details during miri setup in CI
    • dffcb4b Revert "Temporarily disable miri CI"
    • 438fec6 Temporarily disable miri CI
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies rust 
    opened by dependabot[bot] 1
  • Bump uuid from 1.4.0 to 1.4.1

    Bump uuid from 1.4.0 to 1.4.1

    Bumps uuid from 1.4.0 to 1.4.1.

    Release notes

    Sourced from uuid's releases.

    1.4.1

    What's Changed

    New Contributors

    Full Changelog: https://github.com/uuid-rs/uuid/compare/1.4.0...1.4.1

    Commits
    • 97b7f07 Merge pull request #698 from uuid-rs/cargo/1.4.1
    • 8e930cf prepare for 1.4.1 release
    • 0041b3b Merge pull request #697 from uuid-rs/chore/example-printing
    • 5a1f3f5 use uuid_unstable
    • 6b0cfb2 Merge pull request #693 from jrose-signal/inline-from_bytes
    • 33f6b3e print uuids in examples
    • bd7df72 Merge pull request #694 from teohhanhui/fix/macro-hygiene
    • 1d1ae31 Fix macro hygiene
    • 317d925 Add #[inline] for Uuid::from_bytes[_ref] and Uuid::{as,into}_bytes
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies rust 
    opened by dependabot[bot] 1
  • Github action for releasing should add a changelog

    Github action for releasing should add a changelog

    it'd be good if the Github Release for each version of the library included a changelog, e.g. how hyper does it https://github.com/hyperium/hyper/releases

    obviously very low priority haha

    opened by adamchalmers 0
Releases(v0.6.1)
Owner
KittyCAD
Building Infrastructure for Hardware Designers. We're hiring! https://kittycad.io/careers
KittyCAD
A visual canvas and virtual machine for writing assembly to build cool things. Create machines and connect them together.

Visual Assembly Canvas A highly visual assembly editor, infinite canvas for wiring blocks and machines together, bytecode virtual machine runnable nat

Phoomparin Mano 31 Oct 11, 2023
A visual canvas and virtual machine for writing assembly to build cool things. Create machines and connect them together.

Visual Assembly Canvas A highly visual assembly editor, infinite canvas for wiring blocks and machines together, bytecode virtual machine runnable nat

Phoomparin Mano 32 Oct 11, 2023
Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)

WSLGit This project provides a small executable that forwards all arguments to git running inside Bash on Windows/Windows Subsystem for Linux (WSL). T

A. R. S. 1.1k Jan 3, 2023
Exeprimental visual terminal for egui

eterm: a visual terminal for egui If you have a service written in rust (running on the cloud, or even locally) that you need to inspect, eterm might

Emil Ernerfeldt 48 Dec 29, 2022
A visual regex substitution tool

A visual regex substitution tool

Ilya Maximov 3 Feb 6, 2022
visual guide for writing Intrinsics(SIMD)

wasm-pack-template A template for kick starting a Rust and WebAssembly project using wasm-pack. Tutorial | Chat Built with ?? ?? by The Rust and WebAs

Ric Li 1 Apr 6, 2022
A visual novel engine written by Rust. Just Ayaka.

Ayaka Ayaka is currently a project for OSPP 2022. About the name The frontend is Ayaka. The runtime is Ayaka. The script is Ayaka. Just Ayaka. What we

UniGal 86 Dec 30, 2022
Stream-based visual programming language for systems observability

Stream-based visual programming language for systems observability. Metalens allows to build observability programs in a reactive and visual way. On L

Nikita Baksalyar 53 Dec 23, 2022
A visual studio code's workspaces organizer written in Rust

ruscode A visual studio code's workspaces organizer written in Rust Supports Linux, and Windows. What is a workspaces organizer? After months of or ev

晧暐 8 Dec 15, 2022
A visual node-based programming language

Stainless Script Stainless Script is a visual node-based programming language. The structure is as follows: program contains classes, objects (constan

null 4 Dec 15, 2022
Tight Model format is a lossy 3D model format focused on reducing file size as much as posible without decreasing visual quality of the viewed model or read speeds.

What is Tight Model Format The main goal of the tmf project is to provide a way to save 3D game assets compressed in such a way, that there are no not

null 59 Mar 6, 2023
Command-Line program that takes images and produces the copy of the image with a thin frame and palette made of the 10 most frequent colors.

paleatra v.0.0.1 Command-Line program that takes an image and produces the copy of the image with a thin frame and palette made of the 10 most frequen

Beka Modebadze 24 Dec 29, 2022
Safer Nostr is a service that helps protect users by loading sensitive information (IP leak) and using AI to prevent inappropriate images from being uploaded.

Safer Nostr is a service that helps protect users by loading sensitive information (IP leak) and using AI to prevent inappropriate images from being uploaded. It also offers image optimization and storage options. It has configurable privacy and storage settings, as well as custom cache expiration.

Thomas 4 Dec 29, 2022
Enhance low quality images and videos using AI technology.

Real ESRGAN GUI Real ESRGAN GUI is a simple and minimal GUI for xinntao's Real-ESRGAN This allows you to enhance low quality images and videos using A

null 20 Dec 21, 2022
PlandUML and Drawio diagrams in doc comments as PNG or SVG images.

rsdoc This crate provides a procedural macro that transform PlandUML and Drawio diagrams in doc comments as PNG or SVG images. The diagrams in doc com

null 4 Feb 20, 2023
A simple CLI utility to add rounded borders, padding, and shadows to images.

shadower a simple command-line utility to add rounded corners and shadows to images Installation From AUR paru -S shadower-git From source cargo build

Michał 5 Mar 16, 2023
Convert your favorite images and wallpapers with your favorite color palettes/themes

dipc doprz' image palette converter Convert your favorite images and wallpapers with your favorite color palettes/themes Color Palettes/Themes catppuc

null 50 Apr 26, 2023
Manage lightweight VMs created from OCI images

krunvm krunvm is a CLI-based utility for managing lightweight VMs created from OCI images, using libkrun and buildah. Features Minimal footprint Fast

Containers 1.1k Jan 6, 2023
A small command-line application to view images from the terminal written in Rust.

A small command-line application to view images from the terminal written in Rust. It is basically the front-end of viuer

Atanas Yankov 1.9k Jan 3, 2023