#![deny(bare_trait_objects)]
#![allow(clippy::cast_lossless)]
#![allow(clippy::cast_ptr_alignment)]
#![allow(clippy::cognitive_complexity)]
#![allow(clippy::needless_range_loop)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::verbose_bit_mask)]
#![allow(clippy::unreadable_literal)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::wrong_self_convention)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::comparison_chain)]
#![warn(clippy::expl_impl_clone_on_copy)]
#![warn(clippy::linkedlist)]
#![warn(clippy::map_flatten)]
#![warn(clippy::mem_forget)]
#![warn(clippy::mut_mut)]
#![warn(clippy::mutex_integer)]
#![warn(clippy::needless_borrow)]
#![warn(clippy::needless_continue)]
#![warn(clippy::path_buf_push_overwrite)]
#![warn(clippy::range_plus_one)]
#[cfg(test)]
#[macro_use]
extern crate pretty_assertions;
#[macro_use]
extern crate log;
mod serialize {
cfg_if::cfg_if! {
if #[cfg(feature="serialize")] {
pub use serde::*;
} else {
pub use noop_proc_macro::{Deserialize, Serialize};
}
}
}
mod hawktracer {
cfg_if::cfg_if! {
if #[cfg(feature="tracing")] {
pub use rust_hawktracer::*;
} else {
pub use noop_proc_macro::hawktracer;
}
}
}
mod wasm_bindgen {
cfg_if::cfg_if! {
if #[cfg(feature="wasm")] {
pub use wasm_bindgen::prelude::*;
} else {
pub use noop_proc_macro::wasm_bindgen;
}
}
}
mod rayon {
cfg_if::cfg_if! {
if #[cfg(target_arch="wasm32")] {
pub struct ThreadPoolBuilder ();
impl ThreadPoolBuilder {
pub fn new() -> ThreadPoolBuilder {
ThreadPoolBuilder()
}
pub fn build(self) -> Result<ThreadPool, ()> {
Ok(ThreadPool())
}
pub fn num_threads(self, _num_threads: usize) -> ThreadPoolBuilder {
ThreadPoolBuilder()
}
}
#[derive(Debug)]
pub struct ThreadPool ();
impl ThreadPool {
pub fn install<OP, R>(&self, op: OP) -> R where
OP: FnOnce() -> R + Send,
R: Send, {
op()
}
}
pub mod iter {
pub trait IntoParallelIterator {
type Iter: Iterator<Item = Self::Item>;
type Item: Send;
fn into_par_iter(self) -> Self::Iter;
}
impl<I: IntoIterator> IntoParallelIterator for I where
I::Item : Send {
type Item = I::Item;
type Iter = I::IntoIter;
fn into_par_iter(self) -> I::IntoIter {
self.into_iter()
}
}
pub trait IntoParallelRefMutIterator<'data> {
type Iter: IntoParallelIterator<Item = Self::Item>;
type Item: Send + 'data;
fn par_iter_mut(&'data mut self) -> Self::Iter;
}
impl<'data, I: 'data + ?Sized> IntoParallelRefMutIterator<'data> for I
where
&'data mut I: IntoParallelIterator,
{
type Iter = <&'data mut I as IntoParallelIterator>::Iter;
type Item = <&'data mut I as IntoParallelIterator>::Item;
fn par_iter_mut(&'data mut self) -> Self::Iter {
self.into_par_iter()
}
}
}
} else {
pub use rayon::*;
}
}
}
#[cfg(any(cargo_c, feature = "capi"))]
pub mod capi;
#[macro_use]
mod transform;
#[macro_use]
mod cpu_features;
mod activity;
pub(crate) mod asm;
mod dist;
mod ec;
mod partition;
mod predict;
mod quantize;
mod rdo;
mod rdo_tables;
#[macro_use]
mod util;
mod cdef;
mod context;
mod deblock;
mod encoder;
mod entropymode;
mod lrf;
mod mc;
mod me;
mod rate;
mod recon_intra;
mod scan_order;
mod scenechange;
mod segmentation;
mod stats;
mod tiling;
mod token_cdfs;
mod api;
mod frame;
mod header;
use crate::encoder::*;
pub use crate::api::{
Config, Context, EncoderConfig, EncoderStatus, InvalidConfig, Packet,
};
pub use crate::frame::Frame;
pub use crate::util::{CastFromPrimitive, Pixel, PixelType};
pub mod prelude {
pub use crate::api::*;
pub use crate::encoder::Tune;
pub use crate::frame::{
Frame, FrameParameters, FrameTypeOverride, Plane, PlaneConfig,
};
pub use crate::partition::BlockSize;
pub use crate::predict::PredictionMode;
pub use crate::transform::TxType;
pub use crate::util::{CastFromPrimitive, Pixel, PixelType};
}
pub mod data {
pub use crate::api::{
ChromaticityPoint, EncoderStatus, FrameType, Packet, Rational,
};
pub use crate::frame::{Frame, FrameParameters};
pub use crate::stats::EncoderStats;
pub use crate::util::{CastFromPrimitive, Pixel, PixelType};
}
pub use crate::api::color;
pub mod config {
pub use crate::api::{
Config, EncoderConfig, InvalidConfig, PredictionModesSetting,
RateControlConfig, RateControlError, RateControlSummary, SpeedSettings,
};
}
pub mod version {
pub fn major() -> u64 {
env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap()
}
pub fn minor() -> u64 {
env!("CARGO_PKG_VERSION_MINOR").parse().unwrap()
}
pub fn patch() -> u64 {
env!("CARGO_PKG_VERSION_PATCH").parse().unwrap()
}
pub fn short() -> String {
env!("CARGO_PKG_VERSION").to_string()
}
pub fn long() -> String {
let s = short();
let hash = hash();
if hash.is_empty() {
s
} else {
format!("{} - {}", s, hash)
}
}
pub fn hash() -> String {
env!("VERGEN_SHA_SHORT").to_string()
}
pub fn full() -> String {
let semver = env!("VERGEN_SEMVER_LIGHTWEIGHT");
format!("{} ({})", short(), semver)
}
}
#[cfg(all(
any(test, fuzzing),
any(feature = "decode_test", feature = "decode_test_dav1d")
))]
mod test_encode_decode;
#[cfg(feature = "bench")]
pub mod bench {
pub mod api {
pub use crate::api::*;
}
pub mod cdef {
pub use crate::cdef::*;
}
pub mod context {
pub use crate::context::*;
}
pub mod dist {
pub use crate::dist::*;
}
pub mod ec {
pub use crate::ec::*;
}
pub mod encoder {
pub use crate::encoder::*;
}
pub mod mc {
pub use crate::mc::*;
}
pub mod partition {
pub use crate::partition::*;
}
pub mod frame {
pub use crate::frame::*;
}
pub mod predict {
pub use crate::predict::*;
}
pub mod rdo {
pub use crate::rdo::*;
}
pub mod tiling {
pub use crate::tiling::*;
}
pub mod transform {
pub use crate::transform::*;
}
pub mod util {
pub use crate::util::*;
}
pub mod cpu_features {
pub use crate::cpu_features::*;
}
}
#[cfg(fuzzing)]
pub mod fuzzing;