From 228233bfb0768b6118cee6574c6f51dda3c2e68b Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Mon, 24 Apr 2023 09:40:29 -0400 Subject: [PATCH] Bump y4m, clippy cleanup, etc --- CHANGELOG.md | 4 + Cargo.lock | 390 ++++++++++++++++++++++++++++++++++----------------- Cargo.toml | 6 +- src/lib.rs | 133 ++++++++++++------ src/main.rs | 149 +++++++++++++------- src/y4m.rs | 5 +- 6 files changed, 463 insertions(+), 224 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f20b013..890c072 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Version 0.9.0 + +- Bump `y4m` dependency to `0.8` + ## Version 0.8.1 - Finally release a new version because we can depend on rav1e 0.6.1 diff --git a/Cargo.lock b/Cargo.lock index 8a87d77..72252f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,55 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "anstream" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e579a7752471abc2a8268df8b20005e3eadd975f585398f17efcfd8d4927371" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcd8291a340dd8ac70e18878bc4501dd7b4ff970cfa21c207d36ece51ea88fd" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" version = "1.0.70" @@ -42,7 +91,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "av-scenechange" -version = "0.8.1" +version = "0.9.0" dependencies = [ "anyhow", "clap", @@ -78,12 +127,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487f1e0fcbe47deb8b0574e646def1c903389d95241dd1bbcc6ce4a715dfc0c1" - [[package]] name = "bitstream-io" version = "1.6.0" @@ -107,7 +150,7 @@ checksum = "031718ddb8f78aa5def78a09e90defe30151d1f6c672f937af4dd916429ed996" dependencies = [ "semver", "serde", - "toml", + "toml 0.5.11", "url", ] @@ -122,11 +165,12 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.11.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0357a6402b295ca3a86bc148e84df46c02e41f41fef186bda662557ef6328aa" +checksum = "c8790cf1286da485c72cf5fc7aeba308438800036ec67d89425924c4807268c9" dependencies = [ "smallvec", + "target-lexicon", ] [[package]] @@ -137,49 +181,61 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.1.12" +version = "4.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e21918af71fb4bcd813230cf549e33d14f73d0326b932b630ce2930332b131" +checksum = "956ac1f6381d8d82ab4684768f89c0ea3afe66925ceadb4eeb3fc452ffc55d62" dependencies = [ - "bitflags 2.0.2", + "clap_builder", "clap_derive", - "clap_lex", - "is-terminal", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84080e799e54cff944f4b4a4b0e71630b0e0443b25b985175c7dddc1a859b749" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.1.12" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a932373bab67b984c790ddf2c9ca295d8e3af3b7ef92de5a5bacdccdee4b09b" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.8", + "syn 2.0.15", ] [[package]] name = "clap_lex" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646" -dependencies = [ - "os_str_bytes", -] +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" [[package]] name = "cmake" -version = "0.1.49" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" dependencies = [ "cc", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "console" version = "0.15.5" @@ -201,9 +257,9 @@ checksum = "27d614f23f34f7b5165a77dc1591f497e2518f9cec4b4f4b92bfc4dc6cf7a190" [[package]] name = "crossbeam-channel" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -256,13 +312,13 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "errno" -version = "0.2.8" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -295,15 +351,21 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", "libc", "wasi", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "heck" version = "0.4.1" @@ -335,6 +397,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + [[package]] name = "interpolate_name" version = "0.2.3" @@ -348,25 +420,25 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "is-terminal" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8687c819457e979cc940d09cb16e42a1bf70aa6b60a549de6d3a62a0ee90c69e" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -410,9 +482,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" [[package]] name = "libfuzzer-sys" @@ -426,9 +498,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf" [[package]] name = "log" @@ -472,9 +544,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nasm-rs" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce095842aee9aa3ecbda7a5d2a4df680375fd128a8596b6b56f8e497e231f483" +checksum = "fe4d98d0065f4b1daf164b3eafb11974c94662e5e2396cf03f32d0bb5c17da51" dependencies = [ "rayon", ] @@ -570,12 +642,6 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" -[[package]] -name = "os_str_bytes" -version = "6.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" - [[package]] name = "paste" version = "1.0.12" @@ -602,9 +668,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] @@ -650,9 +716,9 @@ dependencies = [ [[package]] name = "rav1e" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "277898094f0d03c6a609e491324102daf5080e71c06b4b25e5acf8b89d26c945" +checksum = "be22fc799d8dc5573ba290fd436cea91ccfc0c6b7e121750ea5939cc786429ec" dependencies = [ "arbitrary", "arg_enum_proc_macro", @@ -757,16 +823,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.11" +version = "0.37.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e" +checksum = "d9b864d3c18a5785a05953adeed93e2dca37ed30f18e69bba9f30079d51f363f" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -792,35 +858,44 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.158" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.158" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.8", + "syn 2.0.15", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + [[package]] name = "simd_helpers" version = "0.1.0" @@ -855,9 +930,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.8" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc02725fd69ab9f26eab07fad303e2497fad6fb9eba4f96c4d1687bdf704ad9" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" dependencies = [ "proc-macro2", "quote", @@ -866,25 +941,22 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.0.3" +version = "6.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2955b1fe31e1fa2fbd1976b71cc69a606d7d4da16f6de3333d0c92d51419aeff" +checksum = "d0fe581ad25d11420b873cf9aedaca0419c2b411487b134d4d21065f3d092055" dependencies = [ "cfg-expr", "heck", "pkg-config", - "toml", + "toml 0.7.3", "version-compare", ] [[package]] -name = "termcolor" -version = "1.2.0" +name = "target-lexicon" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" [[package]] name = "thiserror" @@ -903,7 +975,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.8", + "syn 2.0.15", ] [[package]] @@ -930,6 +1002,40 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -968,6 +1074,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "v_frame" version = "0.3.3" @@ -994,74 +1106,43 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-sys" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] name = "windows-sys" -version = "0.45.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -1070,44 +1151,95 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winnow" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +dependencies = [ + "memchr", +] + [[package]] name = "y4m" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a72a9921af8237fe25097a1ae31c92a05c1d39b2454653ad48f2f407cf7a0dae" +checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" diff --git a/Cargo.toml b/Cargo.toml index 40c8fa6..d016fed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "av-scenechange" -version = "0.8.1" +version = "0.9.0" authors = ["Josh Holmer "] edition = "2021" description = "Estimates frames in a video where a scenecut would be ideal" @@ -9,11 +9,11 @@ repository = "https://github.com/rust-av/av-scenechange" [dependencies] anyhow = "1.0.56" -y4m = "0.7.0" +y4m = "0.8.0" clap = { version = "4.0.22", optional = true, features = ["derive"] } serde = { version = "1.0.123", optional = true, features = ["derive"] } serde_json = { version = "1.0.62", optional = true } -rav1e = { version = "0.6.1", default-features = false, features = [ +rav1e = { version = "0.6.4", default-features = false, features = [ "asm", "scenechange", "threading", diff --git a/src/lib.rs b/src/lib.rs index e391d0d..666aacc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,43 +1,93 @@ -#![deny(clippy::all)] -#![warn(clippy::nursery)] -#![warn(clippy::pedantic)] -#![allow(clippy::cast_possible_truncation)] -#![allow(clippy::cast_possible_wrap)] -#![allow(clippy::cast_precision_loss)] -#![allow(clippy::cast_sign_loss)] -#![allow(clippy::default_trait_access)] -#![allow(clippy::inconsistent_struct_constructor)] -#![allow(clippy::inline_always)] -#![allow(clippy::module_name_repetitions)] -#![allow(clippy::redundant_closure_for_method_calls)] -#![allow(clippy::similar_names)] -#![allow(clippy::struct_excessive_bools)] -#![allow(clippy::use_self)] -#![warn(clippy::clone_on_ref_ptr)] -#![warn(clippy::create_dir)] -#![warn(clippy::dbg_macro)] -#![warn(clippy::default_numeric_fallback)] -#![warn(clippy::exit)] -#![warn(clippy::filetype_is_file)] -#![warn(clippy::float_cmp_const)] -#![warn(clippy::if_then_some_else_none)] -#![warn(clippy::lossy_float_literal)] -#![warn(clippy::map_err_ignore)] -#![warn(clippy::mem_forget)] -#![warn(clippy::mod_module_files)] -#![warn(clippy::multiple_inherent_impl)] -#![warn(clippy::pattern_type_mismatch)] -#![warn(clippy::rc_buffer)] -#![warn(clippy::rc_mutex)] -#![warn(clippy::rest_pat_in_fully_bound_structs)] -#![warn(clippy::same_name_method)] -#![warn(clippy::str_to_string)] -#![warn(clippy::string_to_string)] -#![warn(clippy::undocumented_unsafe_blocks)] -#![warn(clippy::unnecessary_self_imports)] -#![warn(clippy::unneeded_field_pattern)] -#![warn(clippy::use_debug)] +// Safety lints +#![deny(bare_trait_objects)] +#![deny(clippy::as_ptr_cast_mut)] +#![deny(clippy::cast_ptr_alignment)] +#![deny(clippy::large_stack_arrays)] +#![deny(clippy::ptr_as_ptr)] +#![deny(clippy::transmute_ptr_to_ptr)] +#![deny(clippy::unwrap_used)] +// Performance lints +#![warn(clippy::cloned_instead_of_copied)] +#![warn(clippy::inefficient_to_string)] +#![warn(clippy::invalid_upcast_comparisons)] +#![warn(clippy::iter_with_drain)] +#![warn(clippy::large_types_passed_by_value)] +#![warn(clippy::linkedlist)] +#![warn(clippy::mutex_integer)] +#![warn(clippy::naive_bytecount)] +#![warn(clippy::needless_bitwise_bool)] +#![warn(clippy::needless_collect)] +#![warn(clippy::needless_pass_by_value)] +#![warn(clippy::no_effect_underscore_binding)] +#![warn(clippy::or_fun_call)] +#![warn(clippy::stable_sort_primitive)] +#![warn(clippy::suboptimal_flops)] +#![warn(clippy::trivial_regex)] +#![warn(clippy::trivially_copy_pass_by_ref)] +#![warn(clippy::unnecessary_join)] +#![warn(clippy::unused_async)] +#![warn(clippy::zero_sized_map_values)] +// Correctness lints +#![deny(clippy::case_sensitive_file_extension_comparisons)] +#![deny(clippy::copy_iterator)] +#![deny(clippy::expl_impl_clone_on_copy)] +#![deny(clippy::float_cmp)] +#![warn(clippy::imprecise_flops)] +#![deny(clippy::manual_instant_elapsed)] +#![deny(clippy::match_same_arms)] +#![deny(clippy::mem_forget)] +#![warn(clippy::must_use_candidate)] +#![deny(clippy::path_buf_push_overwrite)] +#![deny(clippy::same_functions_in_if_condition)] +#![warn(clippy::suspicious_operation_groupings)] +#![deny(clippy::unchecked_duration_subtraction)] +#![deny(clippy::unicode_not_nfc)] +// Clarity/formatting lints +#![warn(clippy::borrow_as_ptr)] +#![warn(clippy::checked_conversions)] +#![warn(clippy::default_trait_access)] +#![warn(clippy::derive_partial_eq_without_eq)] +#![warn(clippy::explicit_deref_methods)] +#![warn(clippy::filter_map_next)] +#![warn(clippy::flat_map_option)] +#![warn(clippy::fn_params_excessive_bools)] +#![warn(clippy::from_iter_instead_of_collect)] +#![warn(clippy::if_not_else)] +#![warn(clippy::implicit_clone)] +#![warn(clippy::iter_not_returning_iterator)] +#![warn(clippy::iter_on_empty_collections)] +#![warn(clippy::macro_use_imports)] +#![warn(clippy::manual_clamp)] +#![warn(clippy::manual_let_else)] +#![warn(clippy::manual_ok_or)] +#![warn(clippy::manual_string_new)] +#![warn(clippy::map_flatten)] +#![warn(clippy::map_unwrap_or)] +#![warn(clippy::match_bool)] +#![warn(clippy::mut_mut)] +#![warn(clippy::needless_borrow)] +#![warn(clippy::needless_continue)] +#![warn(clippy::option_if_let_else)] +#![warn(clippy::range_minus_one)] +#![warn(clippy::range_plus_one)] +#![warn(clippy::redundant_else)] +#![warn(clippy::ref_binding_to_reference)] +#![warn(clippy::ref_option_ref)] +#![warn(clippy::semicolon_if_nothing_returned)] +#![warn(clippy::trait_duplication_in_bounds)] +#![warn(clippy::type_repetition_in_bounds)] +#![warn(clippy::unnested_or_patterns)] +#![warn(clippy::unused_peekable)] +#![warn(clippy::unused_rounding)] +#![warn(clippy::unused_self)] +#![warn(clippy::used_underscore_binding)] +#![warn(clippy::verbose_bit_mask)] #![warn(clippy::verbose_file_reads)] +// Documentation lints +#![warn(clippy::doc_link_with_quotes)] +#![warn(clippy::doc_markdown)] +#![warn(clippy::missing_errors_doc)] +#![warn(clippy::missing_panics_doc)] mod y4m; @@ -202,7 +252,10 @@ pub fn detect_scene_changes( || detector.analyze_next_frame( &frame_set, frameno as u64, - *keyframes.iter().last().unwrap(), + *keyframes + .iter() + .last() + .expect("at least 1 keyframe should exist"), ) { keyframes.insert(frameno as u64); diff --git a/src/main.rs b/src/main.rs index d70fccf..e24f00e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,52 +1,100 @@ -#![deny(clippy::all)] -#![warn(clippy::nursery)] -#![warn(clippy::pedantic)] -#![allow(clippy::cast_possible_truncation)] -#![allow(clippy::cast_possible_wrap)] -#![allow(clippy::cast_precision_loss)] -#![allow(clippy::cast_sign_loss)] -#![allow(clippy::default_trait_access)] -#![allow(clippy::inconsistent_struct_constructor)] -#![allow(clippy::inline_always)] -#![allow(clippy::module_name_repetitions)] -#![allow(clippy::redundant_closure_for_method_calls)] -#![allow(clippy::similar_names)] -#![allow(clippy::struct_excessive_bools)] -#![allow(clippy::use_self)] -#![warn(clippy::clone_on_ref_ptr)] -#![warn(clippy::create_dir)] -#![warn(clippy::dbg_macro)] -#![warn(clippy::default_numeric_fallback)] -#![warn(clippy::exit)] -#![warn(clippy::filetype_is_file)] -#![warn(clippy::float_cmp_const)] -#![warn(clippy::if_then_some_else_none)] -#![warn(clippy::lossy_float_literal)] -#![warn(clippy::map_err_ignore)] -#![warn(clippy::mem_forget)] -#![warn(clippy::mod_module_files)] -#![warn(clippy::multiple_inherent_impl)] -#![warn(clippy::pattern_type_mismatch)] -#![warn(clippy::rc_buffer)] -#![warn(clippy::rc_mutex)] -#![warn(clippy::rest_pat_in_fully_bound_structs)] -#![warn(clippy::same_name_method)] -#![warn(clippy::str_to_string)] -#![warn(clippy::string_to_string)] -#![warn(clippy::undocumented_unsafe_blocks)] -#![warn(clippy::unnecessary_self_imports)] -#![warn(clippy::unneeded_field_pattern)] -#![warn(clippy::use_debug)] +// Safety lints +#![deny(bare_trait_objects)] +#![deny(clippy::as_ptr_cast_mut)] +#![deny(clippy::cast_ptr_alignment)] +#![deny(clippy::large_stack_arrays)] +#![deny(clippy::ptr_as_ptr)] +#![deny(clippy::transmute_ptr_to_ptr)] +#![deny(clippy::unwrap_used)] +// Performance lints +#![warn(clippy::cloned_instead_of_copied)] +#![warn(clippy::inefficient_to_string)] +#![warn(clippy::invalid_upcast_comparisons)] +#![warn(clippy::iter_with_drain)] +#![warn(clippy::large_types_passed_by_value)] +#![warn(clippy::linkedlist)] +#![warn(clippy::mutex_integer)] +#![warn(clippy::naive_bytecount)] +#![warn(clippy::needless_bitwise_bool)] +#![warn(clippy::needless_collect)] +#![warn(clippy::needless_pass_by_value)] +#![warn(clippy::no_effect_underscore_binding)] +#![warn(clippy::or_fun_call)] +#![warn(clippy::stable_sort_primitive)] +#![warn(clippy::suboptimal_flops)] +#![warn(clippy::trivial_regex)] +#![warn(clippy::trivially_copy_pass_by_ref)] +#![warn(clippy::unnecessary_join)] +#![warn(clippy::unused_async)] +#![warn(clippy::zero_sized_map_values)] +// Correctness lints +#![deny(clippy::case_sensitive_file_extension_comparisons)] +#![deny(clippy::copy_iterator)] +#![deny(clippy::expl_impl_clone_on_copy)] +#![deny(clippy::float_cmp)] +#![warn(clippy::imprecise_flops)] +#![deny(clippy::manual_instant_elapsed)] +#![deny(clippy::match_same_arms)] +#![deny(clippy::mem_forget)] +#![warn(clippy::must_use_candidate)] +#![deny(clippy::path_buf_push_overwrite)] +#![deny(clippy::same_functions_in_if_condition)] +#![warn(clippy::suspicious_operation_groupings)] +#![deny(clippy::unchecked_duration_subtraction)] +#![deny(clippy::unicode_not_nfc)] +// Clarity/formatting lints +#![warn(clippy::borrow_as_ptr)] +#![warn(clippy::checked_conversions)] +#![warn(clippy::default_trait_access)] +#![warn(clippy::derive_partial_eq_without_eq)] +#![warn(clippy::explicit_deref_methods)] +#![warn(clippy::filter_map_next)] +#![warn(clippy::flat_map_option)] +#![warn(clippy::fn_params_excessive_bools)] +#![warn(clippy::from_iter_instead_of_collect)] +#![warn(clippy::if_not_else)] +#![warn(clippy::implicit_clone)] +#![warn(clippy::iter_not_returning_iterator)] +#![warn(clippy::iter_on_empty_collections)] +#![warn(clippy::macro_use_imports)] +#![warn(clippy::manual_clamp)] +#![warn(clippy::manual_let_else)] +#![warn(clippy::manual_ok_or)] +#![warn(clippy::manual_string_new)] +#![warn(clippy::map_flatten)] +#![warn(clippy::map_unwrap_or)] +#![warn(clippy::match_bool)] +#![warn(clippy::mut_mut)] +#![warn(clippy::needless_borrow)] +#![warn(clippy::needless_continue)] +#![warn(clippy::option_if_let_else)] +#![warn(clippy::range_minus_one)] +#![warn(clippy::range_plus_one)] +#![warn(clippy::redundant_else)] +#![warn(clippy::ref_binding_to_reference)] +#![warn(clippy::ref_option_ref)] +#![warn(clippy::semicolon_if_nothing_returned)] +#![warn(clippy::trait_duplication_in_bounds)] +#![warn(clippy::type_repetition_in_bounds)] +#![warn(clippy::unnested_or_patterns)] +#![warn(clippy::unused_peekable)] +#![warn(clippy::unused_rounding)] +#![warn(clippy::unused_self)] +#![warn(clippy::used_underscore_binding)] +#![warn(clippy::verbose_bit_mask)] #![warn(clippy::verbose_file_reads)] -// For binary-only crates -#![allow(clippy::missing_errors_doc)] -#![allow(clippy::missing_panics_doc)] +// Documentation lints +#![warn(clippy::doc_link_with_quotes)] +#![warn(clippy::doc_markdown)] +#![warn(clippy::missing_errors_doc)] +#![warn(clippy::missing_panics_doc)] use std::{ fs::File, io::{self, BufReader, Read, Write}, }; +use anyhow::Result; use av_scenechange::{detect_scene_changes, DetectionOptions, SceneDetectionSpeed}; use clap::Parser; @@ -78,7 +126,7 @@ struct Args { pub max_scenecut: Option, } -fn main() { +fn main() -> Result<()> { #[cfg(feature = "tracing")] use rust_hawktracer::*; init_logger(); @@ -94,7 +142,7 @@ fn main() { let matches = Args::parse(); let input = match matches.input.as_str() { "-" => Box::new(io::stdin()) as Box, - f => Box::new(File::open(f).unwrap()) as Box, + f => Box::new(File::open(f)?) as Box, }; let mut reader = BufReader::new(input); @@ -111,22 +159,23 @@ fn main() { _ => panic!("Speed mode must be in range [0; 1]"), }; - let mut dec = y4m::Decoder::new(&mut reader).unwrap(); + let mut dec = y4m::Decoder::new(&mut reader)?; let bit_depth = dec.get_bit_depth(); let results = if bit_depth == 8 { detect_scene_changes::<_, u8>(&mut dec, opts, None, None) } else { detect_scene_changes::<_, u16>(&mut dec, opts, None, None) }; - print!("{}", serde_json::to_string(&results).unwrap()); + print!("{}", serde_json::to_string(&results)?); if let Some(output_file) = matches.output { - let mut file = File::create(output_file).expect("Could not create file"); + let mut file = File::create(output_file)?; - let output = - serde_json::to_string_pretty(&results).expect("Could not convert results into json"); - file.write_all(&output.into_bytes()).unwrap(); + let output = serde_json::to_string_pretty(&results)?; + file.write_all(&output.into_bytes())?; } + + Ok(()) } #[cfg(not(feature = "devel"))] diff --git a/src/y4m.rs b/src/y4m.rs index a0b5526..3ba8794 100644 --- a/src/y4m.rs +++ b/src/y4m.rs @@ -26,17 +26,18 @@ const fn map_y4m_color_space( ) -> (ChromaSampling, ChromaSamplePosition) { use y4m::Colorspace::{ C420jpeg, C420mpeg2, C420p10, C420p12, C420paldv, C422p10, C422p12, C444p10, C444p12, - Cmono, C420, C422, C444, + Cmono, Cmono12, C420, C422, C444, }; use ChromaSamplePosition::{Colocated, Unknown, Vertical}; use ChromaSampling::{Cs400, Cs420, Cs422, Cs444}; match color_space { - Cmono => (Cs400, Unknown), + Cmono | Cmono12 => (Cs400, Unknown), C420jpeg | C420paldv => (Cs420, Unknown), C420mpeg2 => (Cs420, Vertical), C420 | C420p10 | C420p12 => (Cs420, Colocated), C422 | C422p10 | C422p12 => (Cs422, Colocated), C444 | C444p10 | C444p12 => (Cs444, Colocated), + _ => unimplemented!(), } }