Skip to content

Commit 1f48816

Browse files
authored
Merge branch 'master' into dependabot/cargo/libgit2-sys-0.16.21.7.2
2 parents 58a6e59 + c7c72b5 commit 1f48816

24 files changed

+170
-186
lines changed

.github/workflows/deploy.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ jobs:
472472
473473
- name: Create a scheduled pre-release
474474
if: github.event_name == 'schedule'
475-
uses: softprops/action-gh-release@v1
475+
uses: softprops/action-gh-release@v2
476476
with:
477477
name: Weekly pre-release
478478
prerelease: true
@@ -506,7 +506,7 @@ jobs:
506506

507507
- name: Create a pre-release
508508
if: startsWith(github.ref, 'refs/tags/p')
509-
uses: softprops/action-gh-release@v1
509+
uses: softprops/action-gh-release@v2
510510
with:
511511
name: Weekly pre-release
512512
prerelease: true
@@ -539,7 +539,7 @@ jobs:
539539

540540
- name: Create a release
541541
if: startsWith(github.ref, 'refs/tags/v')
542-
uses: softprops/action-gh-release@v1
542+
uses: softprops/action-gh-release@v2
543543
with:
544544
name: v${{ steps.tagName.outputs.version }}
545545
files: |

.github/workflows/rav1e.yml

+76-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,79 @@ jobs:
2525
run: |
2626
cargo fmt -- --check --verbose
2727
- name: Run clippy
28-
uses: actions-rs/clippy-check@v1
28+
uses: clechasseur/rs-clippy-check@v3
2929
with:
30-
token: ${{ secrets.GITHUB_TOKEN }}
3130
args: -- -D warnings --verbose -A clippy::wrong-self-convention -A clippy::many_single_char_names -A clippy::upper-case-acronyms
3231

32+
msrv:
33+
runs-on: ubuntu-22.04
34+
35+
env:
36+
CARGO_INCREMENTAL: 0
37+
RUSTFLAGS: '-Dwarnings'
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
# Minimum version in build.rs
43+
- name: Install NASM 2.15
44+
uses: ilammy/setup-nasm@v1
45+
with:
46+
version: 2.15
47+
48+
# Minimum version in Cargo.toml
49+
- name: Install Rust 1.70.0
50+
uses: dtolnay/[email protected]
51+
with:
52+
targets: wasm32-unknown-unknown, wasm32-wasi
53+
54+
- uses: Swatinem/rust-cache@v2
55+
with:
56+
prefix-key: v1-rust
57+
58+
- name: Run cargo check
59+
run: cargo check
60+
61+
- name: Run cargo check (wasm32)
62+
run: >
63+
cargo check
64+
--target wasm32-unknown-unknown
65+
--no-default-features
66+
-F wasm
67+
68+
- name: Run cargo check (wasi)
69+
run: >
70+
cargo check
71+
--target wasm32-wasi
72+
--no-default-features
73+
74+
wasi:
75+
runs-on: ubuntu-22.04
76+
needs: [rustfmt-clippy, msrv]
77+
78+
env:
79+
CARGO_INCREMENTAL: 0
80+
RUSTFLAGS: '-Dwarnings'
81+
CARGO_TARGET_WASM32_WASI_RUNNER: wasmtime
82+
83+
steps:
84+
- uses: actions/checkout@v4
85+
86+
- name: Install wasmtime
87+
uses: taiki-e/install-action@wasmtime
88+
89+
- name: Install Rust stable
90+
uses: dtolnay/rust-toolchain@stable
91+
with:
92+
targets: wasm32-wasi
93+
- uses: Swatinem/rust-cache@v2
94+
95+
- name: Run tests
96+
run: >
97+
cargo test
98+
--target wasm32-wasi
99+
--no-default-features
100+
33101
build-unix:
34102
strategy:
35103
matrix:
@@ -85,6 +153,7 @@ jobs:
85153
SCCACHE_IDLE_TIMEOUT: 0
86154

87155
runs-on: ubuntu-22.04
156+
needs: [rustfmt-clippy, msrv]
88157

89158
steps:
90159
- uses: actions/checkout@v4
@@ -277,7 +346,7 @@ jobs:
277346
sccache --stop-server
278347
- name: Codecov upload
279348
if: matrix.conf == 'grcov-codecov'
280-
uses: codecov/codecov-action@v3
349+
uses: codecov/codecov-action@v4
281350
with:
282351
files: lcov.info
283352

@@ -308,6 +377,8 @@ jobs:
308377
SCCACHE_DIR: /Users/runner/Library/Caches/Mozilla.sccache
309378

310379
runs-on: macos-latest
380+
needs: [rustfmt-clippy, msrv]
381+
311382
steps:
312383
- uses: actions/checkout@v4
313384
- name: Install sccache
@@ -383,6 +454,8 @@ jobs:
383454
SCCACHE_DIR: C:\sccache
384455

385456
runs-on: windows-latest
457+
needs: [rustfmt-clippy, msrv]
458+
386459
steps:
387460
- uses: actions/checkout@v4
388461
- uses: ilammy/setup-nasm@v1

Cargo.lock

+9-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+10-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ num-derive = "0.4"
8989
paste = "1.0"
9090
noop_proc_macro = "0.3.0"
9191
serde = { version = "1.0", features = ["derive"], optional = true }
92-
dav1d-sys = { version = "0.6.0", package = "libdav1d-sys", optional = true }
92+
dav1d-sys = { version = "0.7.0", package = "libdav1d-sys", optional = true }
9393
aom-sys = { version = "0.3.3", optional = true }
9494
scan_fmt = { version = "0.2.6", optional = true, default-features = false }
9595
ivf = { version = "0.1", path = "ivf/", optional = true }
@@ -115,6 +115,7 @@ profiling = { version = "1" }
115115
tracing-subscriber = { version = "0.3.18", optional = true }
116116
tracing-chrome = { version = "0.7.1", optional = true }
117117
tracing = { version = "0.1.40", optional = true }
118+
aligned-vec = "0.5.0"
118119

119120
[dependencies.image]
120121
version = "0.24.8"
@@ -135,8 +136,6 @@ features = ["parallel"]
135136
signal-hook = { version = "0.3", optional = true }
136137

137138
[dev-dependencies]
138-
assert_cmd = "2.0"
139-
criterion = "0.5"
140139
pretty_assertions = "1.4.0"
141140
interpolate_name = "0.2.4"
142141
nom = "7.1.3"
@@ -145,6 +144,14 @@ rand = "0.8"
145144
rand_chacha = "0.3"
146145
semver = "1.0"
147146

147+
# Exclude dependencies and features that don't work on wasm32:
148+
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
149+
criterion = { version = "0.5", default-features = false }
150+
151+
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
152+
assert_cmd = "2.0"
153+
criterion = "0.5"
154+
148155
[target.'cfg(fuzzing)'.dependencies]
149156
arbitrary = "1.3"
150157
interpolate_name = "0.2.4"

build.rs

+38-38
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,25 @@ fn hash_changed(
7070

7171
#[cfg(feature = "asm")]
7272
fn build_nasm_files() {
73-
use std::fs::File;
74-
use std::io::Write;
75-
let out_dir = env::var("OUT_DIR").unwrap();
73+
let mut config = "
74+
%pragma preproc sane_empty_expansion true
75+
%define private_prefix rav1e
76+
%define ARCH_X86_32 0
77+
%define ARCH_X86_64 1
78+
%define PIC 1
79+
%define STACK_ALIGNMENT 16
80+
%define HAVE_AVX512ICL 1
81+
"
82+
.to_owned();
7683

77-
let dest_path = Path::new(&out_dir).join("config.asm");
78-
let mut config_file = File::create(&dest_path).unwrap();
79-
config_file.write(b" %define private_prefix rav1e\n").unwrap();
80-
config_file.write(b" %define ARCH_X86_32 0\n").unwrap();
81-
config_file.write(b" %define ARCH_X86_64 1\n").unwrap();
82-
config_file.write(b" %define PIC 1\n").unwrap();
83-
config_file.write(b" %define STACK_ALIGNMENT 16\n").unwrap();
84-
config_file.write(b" %define HAVE_AVX512ICL 1\n").unwrap();
8584
if env::var("CARGO_CFG_TARGET_VENDOR").unwrap() == "apple" {
86-
config_file.write(b" %define PREFIX 1\n").unwrap();
85+
config += "%define PREFIX 1\n";
8786
}
8887

88+
let out_dir = env::var("OUT_DIR").unwrap();
89+
let dest_path = Path::new(&out_dir).join("config.asm");
90+
std::fs::write(&dest_path, config).expect("can write config.asm");
91+
8992
let asm_files = &[
9093
"src/x86/cdef_avx2.asm",
9194
"src/x86/cdef_avx512.asm",
@@ -132,20 +135,17 @@ fn build_nasm_files() {
132135
if let Some((hash, hash_path)) =
133136
hash_changed(asm_files, &out_dir, &dest_path)
134137
{
135-
let mut config_include_arg = String::from("-I");
136-
config_include_arg.push_str(&out_dir);
137-
config_include_arg.push('/');
138-
let mut nasm = nasm_rs::Build::new();
139-
nasm.min_version(2, 14, 0);
140-
for file in asm_files {
141-
nasm.file(file);
142-
}
143-
nasm.flag(&config_include_arg);
144-
nasm.flag("-Isrc/");
145-
let obj = nasm.compile_objects().unwrap_or_else(|e| {
146-
println!("cargo:warning={e}");
147-
panic!("NASM build failed. Make sure you have nasm installed or disable the \"asm\" feature.\n\
148-
You can get NASM from https://nasm.us or your system's package manager.\n\nerror: {e}");
138+
let obj = nasm_rs::Build::new()
139+
.min_version(2, 15, 0)
140+
.include(&out_dir)
141+
.include("src")
142+
.files(asm_files)
143+
.compile_objects()
144+
.unwrap_or_else(|e| {
145+
panic!("NASM build failed. Make sure you have nasm installed or disable the \"asm\" feature.\n\
146+
You can get NASM from https://nasm.us or your system's package manager.\n\
147+
\n\
148+
error: {e}");
149149
});
150150

151151
// cc is better at finding the correct archiver
@@ -196,21 +196,21 @@ fn strip_command() -> Option<String> {
196196

197197
#[cfg(feature = "asm")]
198198
fn build_asm_files() {
199-
use std::fs::File;
200-
use std::io::Write;
201-
let out_dir = env::var("OUT_DIR").unwrap();
199+
let mut config = "
200+
#define PRIVATE_PREFIX rav1e_
201+
#define ARCH_AARCH64 1
202+
#define ARCH_ARM 0
203+
#define CONFIG_LOG 1
204+
#define HAVE_ASM 1
205+
"
206+
.to_owned();
202207

203-
let dest_path = Path::new(&out_dir).join("config.h");
204-
let mut config_file = File::create(&dest_path).unwrap();
205208
if env::var("CARGO_CFG_TARGET_VENDOR").unwrap() == "apple" {
206-
config_file.write(b" #define PREFIX 1\n").unwrap();
209+
config += "#define PREFIX 1\n";
207210
}
208-
config_file.write(b" #define PRIVATE_PREFIX rav1e_\n").unwrap();
209-
config_file.write(b" #define ARCH_AARCH64 1\n").unwrap();
210-
config_file.write(b" #define ARCH_ARM 0\n").unwrap();
211-
config_file.write(b" #define CONFIG_LOG 1 \n").unwrap();
212-
config_file.write(b" #define HAVE_ASM 1\n").unwrap();
213-
config_file.sync_all().unwrap();
211+
let out_dir = env::var("OUT_DIR").unwrap();
212+
let dest_path = Path::new(&out_dir).join("config.h");
213+
std::fs::write(&dest_path, config).expect("can write config.h");
214214

215215
let asm_files = &[
216216
"src/arm/64/cdef.S",

renovate.json

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
4-
"config:base",
4+
"config:recommended",
55
":automergeAll",
66
":automergePr",
77
":automergeRequireAllStatusChecks",
88
":enableVulnerabilityAlerts",
99
"group:allNonMajor",
1010
"schedule:earlyMondays"
1111
],
12-
"fetchReleaseNotes": true,
12+
"fetchChangeLogs": "pr",
1313
"lockFileMaintenance": {
1414
"enabled": true
15-
}
15+
},
16+
"packageRules": [
17+
{
18+
"matchPackageNames": [
19+
"clap",
20+
"clap_complete",
21+
"clap_builder",
22+
"clap_derive"
23+
],
24+
"allowedVersions": "<=4.4"
25+
},
26+
{
27+
"matchPackageNames": ["assert_cmd"],
28+
"allowedVersions": "<=2.0.13"
29+
}
30+
]
1631
}

src/activity.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ struct RsqrtOutput {
106106
}
107107

108108
/// Fixed point `rsqrt` for `ssim_boost`
109-
fn ssim_boost_rsqrt(x: u64) -> RsqrtOutput {
109+
const fn ssim_boost_rsqrt(x: u64) -> RsqrtOutput {
110110
const INSHIFT: u8 = 16;
111111
const OUTSHIFT: u8 = 14;
112112

113-
let k = ((ILog::ilog(x) - 1) >> 1) as i16;
113+
let k = (x.ilog2() >> 1) as i16;
114114
/*t is x in the range [0.25, 1) in QINSHIFT, or x*2^(-s).
115115
Shift by log2(x) - log2(0.25*(1 << INSHIFT)) to ensure 0.25 lower bound.*/
116116
let s: i16 = 2 * k - (INSHIFT as i16 - 2);
@@ -140,7 +140,7 @@ fn ssim_boost_rsqrt(x: u64) -> RsqrtOutput {
140140
Coefficients here, and the final result r, are Q14. */
141141
let rsqrt: i32 = 23557 + mult16_16_q15(n, -13490 + mult16_16_q15(n, 6711));
142142

143-
debug_assert!((16384..32768).contains(&rsqrt));
143+
debug_assert!(16384 <= rsqrt && rsqrt < 32768);
144144
RsqrtOutput { norm: rsqrt as u16, shift: rsqrt_shift }
145145
}
146146

@@ -156,7 +156,7 @@ pub fn ssim_boost(svar: u32, dvar: u32, bit_depth: usize) -> DistortionScale {
156156

157157
/// Apply ssim boost to a given input
158158
#[inline(always)]
159-
pub fn apply_ssim_boost(
159+
pub const fn apply_ssim_boost(
160160
input: u32, svar: u32, dvar: u32, bit_depth: usize,
161161
) -> u32 {
162162
let coeff_shift = bit_depth - 8;

src/asm/shared/dist/sse.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#[cfg(test)]
1111
pub mod test {
1212
use crate::config::CpuFeatureLevel;
13-
use crate::dist::rust;
1413
use crate::dist::*;
1514
use crate::frame::*;
1615
use crate::partition::BlockSize;

0 commit comments

Comments
 (0)