Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-and-benchmark-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
with:
toolchain: 1.87.0 # specific version for consistent perf
target: x86_64-unknown-linux-gnu
components: clippy
- name: release build this PR
run: nice cargo +${{ steps.toolchain.outputs.name }} build --release
- name: release build main branch
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-aarch64-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
# aarch64 feature detection is stable
toolchain: stable
target: aarch64-linux-android
components: clippy
- name: cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: cargo build for aarch64-linux-android
Expand All @@ -33,4 +34,3 @@ jobs:
AR: llvm-ar
CC: aarch64-linux-android26-clang
RUSTFLAGS: "-C linker=aarch64-linux-android26-clang -L $ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/aarch64 -L $ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/26"

3 changes: 2 additions & 1 deletion .github/workflows/build-and-test-aarch64-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
uses: Swatinem/rust-cache@v2
- name: cargo ${{ matrix.build.name }} build for aarch64-apple-darwin
run: cargo +${{ steps.toolchain.outputs.name }} build ${{ matrix.build.cargo_flags }}
- name: Clippy
run: cargo +${{ steps.toolchain.outputs.name }} clippy -- -D warnings
- name: test ${{ matrix.build.name }} build without frame delay
run: |
.github/workflows/test.sh \
Expand Down Expand Up @@ -76,4 +78,3 @@ jobs:
name: meson-test-logs-aarch64-apple-darwin-${{ matrix.build.name }}
path: |
${{ github.workspace }}/build/meson-logs/testlog-*.txt

5 changes: 4 additions & 1 deletion .github/workflows/build-and-test-qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
packages: "g++-arm-linux-gnueabihf libc6-dev-armhf-cross"
# arm feature detection is unstable
# should be the same as rust-toolchain.toml
toolchain: nightly-2025-05-01
toolchain: nightly-2025-05-01
- target: "aarch64-unknown-linux-gnu"
linker: "aarch64-linux-gnu-gcc"
wrapper: "qemu-aarch64-static"
Expand Down Expand Up @@ -55,12 +55,15 @@ jobs:
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
components: clippy
- name: cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: cargo build for ${{ matrix.target }}
run: |
RUSTFLAGS="-C target-feature=+crt-static -C linker=${{ matrix.linker }}" \
cargo +${{ steps.toolchain.outputs.name }} build --release --target ${{ matrix.target }}
- name: Clippy
run: cargo +${{ steps.toolchain.outputs.name }} clippy -- -D warnings
- name: run tests
run: |
.github/workflows/test.sh -t 2 \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build-and-test-x86-extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
with:
toolchain: stable # x86_64 feature detection is stable
target: ${{ matrix.target }}
components: clippy
- name: cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: cache argon test vectors
Expand All @@ -53,6 +54,8 @@ jobs:
cargo +${{ steps.toolchain.outputs.name }} build --target ${{ matrix.target }} ${{ matrix.build.flags }}
env:
RUSTFLAGS: "-C overflow-checks=on"
- name: Clippy
run: cargo +${{ steps.toolchain.outputs.name }} clippy -- -D warnings
- name: download, check, and unpack argon test vectors
if: ${{ steps.cache-argon.outputs.cache-hit != 'true' }}
run: | # delete the downloaded .zip to avoid out-of-diskspace errors
Expand All @@ -68,4 +71,3 @@ jobs:
- name: run argon tests for ${{ matrix.target }} ${{ matrix.build.name }}
run: |
tests/dav1d_argon.bash -d target/${{ matrix.target }}/${{ matrix.build.name }}/dav1d -j `nproc`

3 changes: 3 additions & 0 deletions .github/workflows/build-and-test-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ jobs:
with:
toolchain: stable # x86 and x86_64 feature detection are stable
target: ${{ matrix.target }}
components: clippy
- name: cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: cargo build for ${{ matrix.target }} ${{ matrix.build.name }}
run: |
cargo +${{ steps.toolchain.outputs.name }} build --target ${{ matrix.target }} ${{ matrix.build.flags }}
- name: Clippy
run: cargo +${{ steps.toolchain.outputs.name }} clippy -- -D warnings
- name: meson test for ${{ matrix.target }} ${{ matrix.build.name }}
run: |
.github/workflows/test.sh \
Expand Down
71 changes: 66 additions & 5 deletions lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,74 @@
#![allow(non_upper_case_globals)]
#![cfg_attr(target_arch = "arm", feature(stdarch_arm_feature_detection))]
#![cfg_attr(
any(target_arch = "riscv32", target_arch = "riscv64"),
feature(stdarch_riscv_feature_detection)
)]
#![deny(unsafe_op_in_unsafe_fn)]
#![allow(clippy::all)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::missing_safety_doc)]
#![allow(clippy::derivable_impls, clippy::ptr_eq)]
#![expect(
non_upper_case_globals,
clippy::absurd_extreme_comparisons, // error by default
clippy::arc_with_non_send_sync,
clippy::borrow_deref_ref,
clippy::borrowed_box,
clippy::cast_abs_to_unsigned,
clippy::clone_on_copy,
clippy::collapsible_else_if,
clippy::collapsible_if,
clippy::doc_overindented_list_items,
clippy::duplicate_underscore_argument,
clippy::eq_op, // error by default,
clippy::erasing_op, // error by default
clippy::explicit_auto_deref,
clippy::identity_op,
clippy::incompatible_msrv,
clippy::int_plus_one,
clippy::into_iter_on_ref,
clippy::large_const_arrays,
clippy::large_enum_variant,
clippy::len_without_is_empty,
clippy::len_zero,
clippy::let_and_return,
clippy::let_underscore_lock,
clippy::manual_div_ceil,
clippy::manual_range_contains,
clippy::manual_saturating_arithmetic,
clippy::module_inception,
clippy::misrefactored_assign_op,
clippy::needless_borrow,
clippy::needless_late_init,
clippy::needless_lifetimes,
clippy::needless_option_as_deref,
clippy::needless_range_loop,
clippy::needless_return,
clippy::neg_multiply,
clippy::nonminimal_bool,
clippy::overly_complex_bool_expr, // error by default
clippy::option_map_unit_fn,
clippy::partialeq_to_none,
clippy::precedence,
clippy::redundant_closure,
clippy::redundant_pattern_matching,
clippy::redundant_static_lifetimes,
clippy::search_is_some,
clippy::too_many_arguments,
clippy::type_complexity,
clippy::unit_arg,
clippy::uninlined_format_args,
clippy::unnecessary_cast,
clippy::unnecessary_fallible_conversions,
clippy::unnecessary_map_on_constructor,
clippy::unnecessary_mut_passed,
clippy::unnecessary_lazy_evaluations,
clippy::unneeded_wildcard_pattern,
clippy::upper_case_acronyms,
clippy::useless_conversion,
clippy::zero_prefixed_literal,
)]
#![deny(
unsafe_op_in_unsafe_fn,
clippy::missing_safety_doc,
clippy::undocumented_unsafe_blocks
)]

#[cfg(not(any(feature = "bitdepth_8", feature = "bitdepth_16")))]
compile_error!("No bitdepths enabled. Enable one or more of the following features: `bitdepth_8`, `bitdepth_16`");
Expand Down
12 changes: 8 additions & 4 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,11 @@ pub(crate) struct TaskThreadDataDelayedFg {
pub grain: Grain,
}

// TODO(SJC): Remove when TaskThreadDataDelayedFg is thread-safe
// SAFETY:
// See discussion in https://github.com/memorysafety/rav1d/pull/1329
unsafe impl Send for TaskThreadDataDelayedFg {}
// TODO(SJC): Remove when TaskThreadDataDelayedFg is thread-safe
// SAFETY:
// See discussion in https://github.com/memorysafety/rav1d/pull/1329
unsafe impl Sync for TaskThreadDataDelayedFg {}

#[derive(Default)]
Expand Down Expand Up @@ -440,9 +442,11 @@ pub struct Rav1dContext {
pub(crate) picture_pool: Arc<MemPool<u8>>,
}

// TODO(SJC): Remove when Rav1dContext is thread-safe
// SAFETY:
// See discussion in https://github.com/memorysafety/rav1d/pull/1329
unsafe impl Send for Rav1dContext {}
// TODO(SJC): Remove when Rav1dContext is thread-safe
// SAFETY:
// See discussion in https://github.com/memorysafety/rav1d/pull/1329
unsafe impl Sync for Rav1dContext {}

#[derive(Default)]
Expand Down
Loading