Skip to content

Commit

Permalink
Mark ffimage and ffimage-yuv #![no_std]
Browse files Browse the repository at this point in the history
Fix remaining clippy warnings while we're at it.

Signed-off-by: Christopher N. Hesse <[email protected]>
  • Loading branch information
raymanfx committed Oct 28, 2023
1 parent 3cc0227 commit 2d791b7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions ffimage-yuv/src/yuv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ where
let d = u - 128;
let e = v - 128;

let r = ((298 * c + 409 * e + 128) >> 8).min(255).max(0);
let g = ((298 * c - 100 * d - 208 * e + 128) >> 8).min(255).max(0);
let b = ((298 * c + 516 * d + 128) >> 8).min(255).max(0);
let r = ((298 * c + 409 * e + 128) >> 8).clamp(0, 255);
let g = ((298 * c - 100 * d - 208 * e + 128) >> 8).clamp(0, 255);
let b = ((298 * c + 516 * d + 128) >> 8).clamp(0, 255);

let mut rgb = Rgb::<T, R, G, B>::default();
rgb[R] = T::from_i32(r).unwrap();
Expand Down
12 changes: 4 additions & 8 deletions ffimage-yuv/src/yuv422.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,10 @@ where
T: Copy,
{
fn from(pix: Yuv422<T, Y0, Y1, U, V>) -> Self {
let sub1 = Yuv {
0: [pix[Y0], pix[U], pix[V]],
};
let sub2 = Yuv {
0: [pix[Y1], pix[U], pix[V]],
};

[sub1, sub2]
[
Yuv([pix[Y0], pix[U], pix[V]]),
Yuv([pix[Y1], pix[U], pix[V]]),
]
}
}

Expand Down
2 changes: 1 addition & 1 deletion ffimage-yuv/tests/convert.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::ops::RangeInclusive;
use core::ops::RangeInclusive;

use ffimage::color::Rgb;

Expand Down
2 changes: 2 additions & 0 deletions ffimage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
//! .collect();
//!```

#![no_std]

/// Generic pixel attributes
pub trait Pixel {
/// Number of channels for this pixel
Expand Down

0 comments on commit 2d791b7

Please sign in to comment.