Skip to content

Commit

Permalink
Remove noop_proc_macro dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
FreezyLemon committed Mar 5, 2024
1 parent 02bac05 commit a7e641c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 26 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ tracing = [
[dependencies]
num-traits = "0.2"
num-derive = "0.4"
noop_proc_macro = "0.3.0"
serde = { version = "1.0", features = ["derive"], optional = true }
profiling = { version = "1" }
tracing = { version = "0.1.40", optional = true }
Expand Down
7 changes: 5 additions & 2 deletions src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
use crate::math::*;
use crate::pixel::*;
use crate::plane::*;
use crate::serialize::{Deserialize, Serialize};

#[cfg(feature = "serialize")]
use serde::{Deserialize, Serialize};

/// Represents a raw video frame
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, Eq, PartialEq)]

Check warning on line 18 in src/frame.rs

View check run for this annotation

Codecov / codecov/patch

src/frame.rs#L18

Added line #L18 was not covered by tests
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
pub struct Frame<T: Pixel> {
/// Planes constituting the frame.
pub planes: [Plane<T>; 3],
Expand Down
16 changes: 0 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,6 @@ pub mod math;
pub mod pixel;
pub mod plane;

mod serialize {
#[cfg(feature = "serialize")]
pub use serde::*;

#[cfg(not(feature = "serialize"))]
pub use noop_proc_macro::{Deserialize, Serialize};
}

mod wasm_bindgen {
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
pub use wasm_bindgen::prelude::*;

#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
pub use noop_proc_macro::wasm_bindgen;
}

pub mod prelude {
pub use crate::math::*;
pub use crate::pixel::*;
Expand Down
12 changes: 8 additions & 4 deletions src/pixel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
// Media Patent License 1.0 was not distributed with this source code in the
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.

use crate::serialize::{Deserialize, Serialize};
use crate::wasm_bindgen::*;
#[cfg(feature = "serialize")]
use serde::{Serialize, Deserialize};

#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;

use num_derive::FromPrimitive;
use num_traits::{AsPrimitive, PrimInt, Signed};
Expand Down Expand Up @@ -146,8 +149,9 @@ impl Coefficient for i32 {
}

/// Chroma subsampling format
#[wasm_bindgen]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, FromPrimitive, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, FromPrimitive)]

Check warning on line 152 in src/pixel.rs

View check run for this annotation

Codecov / codecov/patch

src/pixel.rs#L152

Added line #L152 was not covered by tests
#[cfg_attr(feature = "wasm", wasm_bindgen)]
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
#[repr(C)]
pub enum ChromaSampling {
/// Both vertically and horizontally subsampled.
Expand Down
10 changes: 7 additions & 3 deletions src/plane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ use aligned_vec::{ABox, AVec, ConstAlign};

use crate::math::*;
use crate::pixel::*;
use crate::serialize::{Deserialize, Serialize};

#[cfg(feature = "serialize")]
use serde::{Deserialize, Serialize};

/// Plane-specific configuration.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq)]

Check warning on line 25 in src/plane.rs

View check run for this annotation

Codecov / codecov/patch

src/plane.rs#L25

Added line #L25 was not covered by tests
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
pub struct PlaneConfig {
/// Data stride.
pub stride: usize,
Expand Down Expand Up @@ -147,7 +150,8 @@ impl<T: Pixel> PlaneData<T> {
/// One data plane of a frame.
///
/// For example, a plane can be a Y luma plane or a U or V chroma plane.
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, PartialEq, Eq)]

Check warning on line 153 in src/plane.rs

View check run for this annotation

Codecov / codecov/patch

src/plane.rs#L153

Added line #L153 was not covered by tests
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
pub struct Plane<T: Pixel> {
// TODO: it is used by encoder to copy by plane and by tiling, make it
// private again once tiling is moved and a copy_plane fn is added.
Expand Down

0 comments on commit a7e641c

Please sign in to comment.