Commit dd4ec230 authored by Raphaël Zumer's avatar Raphaël Zumer
Browse files

Migrate Rust edition to 2018

parent c8cae860
......@@ -2,6 +2,7 @@
name = "rav1e"
version = "0.1.0"
authors = ["Thomas Daede <tdaede@xiph.org>"]
edition = "2018"
build = "build.rs"
include = ["/src/**", "/aom_build/**", "/Cargo.toml", "/build.rs"]
autobenches = false
......
......@@ -21,7 +21,7 @@ use rav1e::context::*;
use rav1e::partition::*;
use rav1e::predict::*;
use rav1e::rdo::rdo_cfl_alpha;
use transform::transform;
use crate::transform::transform;
use criterion::*;
use std::time::Duration;
......
......@@ -8,9 +8,9 @@
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
use criterion::*;
use partition::*;
use partition::BlockSize::*;
use plane::*;
use crate::partition::*;
use crate::partition::BlockSize::*;
use crate::plane::*;
use rand::{ChaChaRng, Rng, SeedableRng};
use rav1e::me;
......
......@@ -11,7 +11,7 @@ use criterion::*;
use rand::{ChaChaRng, Rng, RngCore, SeedableRng};
use rav1e::partition::BlockSize;
use rav1e::predict::{Block4x4, Intra};
use util::*;
use crate::util::*;
pub const BLOCK_SIZE: BlockSize = BlockSize::BLOCK_32X32;
......
......@@ -8,16 +8,16 @@
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
use bitstream_io::*;
use encoder::*;
use metrics::calculate_frame_psnr;
use partition::*;
use scenechange::SceneChangeDetector;
use crate::encoder::*;
use crate::metrics::calculate_frame_psnr;
use crate::partition::*;
use crate::scenechange::SceneChangeDetector;
use self::EncoderStatus::*;
use std::{cmp, fmt, io};
use std::collections::BTreeMap;
use std::sync::Arc;
use util::Fixed;
use crate::util::Fixed;
use std::collections::BTreeSet;
const LOOKAHEAD_FRAMES: u64 = 10;
......
......@@ -8,7 +8,7 @@
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
use clap::{App, Arg, ArgMatches};
use {ColorPrimaries, TransferCharacteristics, MatrixCoefficients};
use crate::{ColorPrimaries, TransferCharacteristics, MatrixCoefficients};
use rav1e::*;
use std::{fmt, io};
......
use std::io::Read;
use rav1e::Rational;
use decoder::DecodeError;
use decoder::Decoder;
use decoder::VideoDetails;
use encoder::ChromaSamplePosition;
use encoder::ChromaSampling;
use encoder::Frame;
use util::Fixed;
use crate::decoder::DecodeError;
use crate::decoder::Decoder;
use crate::decoder::VideoDetails;
use crate::encoder::ChromaSamplePosition;
use crate::encoder::ChromaSampling;
use crate::encoder::Frame;
use crate::util::Fixed;
impl Decoder for y4m::Decoder<'_, Box<dyn Read>> {
fn get_video_details(&self) -> VideoDetails {
......@@ -74,8 +74,8 @@ pub fn map_y4m_color_space(
color_space: y4m::Colorspace
) -> (ChromaSampling, ChromaSamplePosition) {
use y4m::Colorspace::*;
use ChromaSampling::*;
use ChromaSamplePosition::*;
use crate::ChromaSampling::*;
use crate::ChromaSamplePosition::*;
match color_space {
Cmono => (Cs400, Unknown),
C420jpeg | C420paldv => (Cs420, Unknown),
......
......@@ -8,7 +8,7 @@
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
use bitstream_io::{BitWriter, LittleEndian};
use decoder::VideoDetails;
use crate::decoder::VideoDetails;
use std::io;
use std::io::Write;
use std::slice;
......
......@@ -17,16 +17,16 @@ extern crate bitstream_io;
mod common;
mod decoder;
mod muxer;
use common::*;
use muxer::*;
use crate::common::*;
use crate::muxer::*;
use rav1e::*;
use std::io;
use std::io::Write;
use std::io::Read;
use std::sync::Arc;
use decoder::Decoder;
use decoder::VideoDetails;
use crate::decoder::Decoder;
use crate::decoder::VideoDetails;
fn read_frame_batch<D: Decoder>(ctx: &mut Context, decoder: &mut D, video_info: VideoDetails) {
loop {
......
......@@ -9,11 +9,11 @@
#![allow(safe_extern_statics)]
use context::*;
use Frame;
use FrameInvariants;
use plane::*;
use util::{clamp, msb};
use crate::context::*;
use crate::Frame;
use crate::FrameInvariants;
use crate::plane::*;
use crate::util::{clamp, msb};
use std::cmp;
......
......@@ -16,19 +16,19 @@
#![allow(clippy::needless_range_loop)]
#![allow(clippy::collapsible_if)]
use ec::Writer;
use encoder::{FrameInvariants, ReferenceMode};
use entropymode::*;
use partition::BlockSize::*;
use partition::PredictionMode::*;
use partition::TxSize::*;
use partition::TxType::*;
use partition::*;
use lrf::*;
use plane::*;
use scan_order::*;
use token_cdfs::*;
use util::{clamp, msb};
use crate::ec::Writer;
use crate::encoder::{FrameInvariants, ReferenceMode};
use crate::entropymode::*;
use crate::partition::BlockSize::*;
use crate::partition::PredictionMode::*;
use crate::partition::TxSize::*;
use crate::partition::TxType::*;
use crate::partition::*;
use crate::lrf::*;
use crate::plane::*;
use crate::scan_order::*;
use crate::token_cdfs::*;
use crate::util::{clamp, msb};
use std::*;
......@@ -276,7 +276,7 @@ pub const seg_feature_bits: [u32; SegLvl::SEG_LVL_MAX as usize] =
pub const seg_feature_is_signed: [bool; SegLvl::SEG_LVL_MAX as usize] =
[ true, true, true, true, true, false, false, false, ];
use context::TxClass::*;
use crate::context::TxClass::*;
static tx_type_to_class: [TxClass; TX_TYPES] = [
TX_CLASS_2D, // DCT_DCT
......@@ -1711,7 +1711,7 @@ impl CFLSign {
}
}
use context::CFLSign::*;
use crate::context::CFLSign::*;
const CFL_SIGNS: usize = 3;
static cfl_sign_value: [i16; CFL_SIGNS] = [ 0, -1, 1 ];
......
......@@ -9,17 +9,17 @@
#![allow(safe_extern_statics)]
use context::*;
use DeblockState;
use FrameInvariants;
use FrameState;
use FrameType;
use partition::*;
use partition::PredictionMode::*;
use plane::*;
use quantize::*;
use crate::context::*;
use crate::DeblockState;
use crate::FrameInvariants;
use crate::FrameState;
use crate::FrameType;
use crate::partition::*;
use crate::partition::PredictionMode::*;
use crate::plane::*;
use crate::quantize::*;
use std::cmp;
use util::{clamp, ILog};
use crate::util::{clamp, ILog};
fn deblock_adjusted_level(
deblock: &DeblockState, block: &Block, pli: usize, vertical: bool
......
......@@ -16,8 +16,8 @@
use bitstream_io::{BitWriter, BigEndian};
use std;
use std::io;
use util::ILog;
use util::msb;
use crate::util::ILog;
use crate::util::msb;
pub const OD_BITRES: u8 = 3;
const EC_PROB_SHIFT: u32 = 6;
......@@ -62,7 +62,7 @@ pub trait Writer {
/// Save current point in coding/recording to a checkpoint
fn checkpoint(&mut self) -> WriterCheckpoint;
/// Restore saved position in coding/recording from a checkpoint
fn rollback(&mut self, &WriterCheckpoint);
fn rollback(&mut self, _: &WriterCheckpoint);
}
/// StorageBackend is an internal trait used to tie a specific Writer
......@@ -77,7 +77,7 @@ pub trait StorageBackend {
/// Backend implementation of checkpoint to pass through Writer interface
fn checkpoint(&mut self) -> WriterCheckpoint;
/// Backend implementation of rollback to pass through Writer interface
fn rollback(&mut self, &WriterCheckpoint);
fn rollback(&mut self, _: &WriterCheckpoint);
}
#[derive(Debug, Clone)]
......
......@@ -7,22 +7,22 @@
// 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 api::*;
use cdef::*;
use context::*;
use deblock::*;
use ec::*;
use lrf::*;
use mc::*;
use me::*;
use partition::*;
use plane::*;
use quantize::*;
use rdo::*;
use segmentation::*;
use transform::*;
use util::*;
use partition::PartitionType::*;
use crate::api::*;
use crate::cdef::*;
use crate::context::*;
use crate::deblock::*;
use crate::ec::*;
use crate::lrf::*;
use crate::mc::*;
use crate::me::*;
use crate::partition::*;
use crate::plane::*;
use crate::quantize::*;
use crate::rdo::*;
use crate::segmentation::*;
use crate::transform::*;
use crate::util::*;
use crate::partition::PartitionType::*;
use bitstream_io::{BitWriter, BigEndian};
use std;
......
......@@ -9,8 +9,8 @@
#![allow(non_upper_case_globals)]
use context::*;
use partition::*;
use crate::context::*;
use crate::partition::*;
const PALATTE_BSIZE_CTXS: usize = 7;
const PALETTE_Y_MODE_CONTEXTS: usize = 3;
......
......@@ -50,8 +50,8 @@ pub mod scenechange;
mod api;
pub use api::*;
pub use encoder::*;
pub use crate::api::*;
pub use crate::encoder::*;
#[cfg(all(test, feature="decode_test"))]
mod test_encode_decode_aom;
......
......@@ -9,17 +9,17 @@
#![allow(safe_extern_statics)]
use encoder::Frame;
use encoder::FrameInvariants;
use context::ContextWriter;
use context::SuperBlockOffset;
use context::PLANES;
use context::MAX_SB_SIZE;
use plane::Plane;
use plane::PlaneOffset;
use plane::PlaneConfig;
use crate::encoder::Frame;
use crate::encoder::FrameInvariants;
use crate::context::ContextWriter;
use crate::context::SuperBlockOffset;
use crate::context::PLANES;
use crate::context::MAX_SB_SIZE;
use crate::plane::Plane;
use crate::plane::PlaneOffset;
use crate::plane::PlaneConfig;
use std::cmp;
use util::clamp;
use crate::util::clamp;
pub const RESTORATION_TILESIZE_MAX_LOG2: usize = 8;
......
......@@ -136,8 +136,8 @@ const SUBPEL_FILTERS: [[[i32; SUBPEL_FILTER_SIZE]; 16]; 6] = [
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))]
mod nasm {
use super::*;
use plane::*;
use util::*;
use crate::plane::*;
use crate::util::*;
use std::mem;
......@@ -370,8 +370,8 @@ mod nasm {
mod native {
use super::*;
use num_traits::*;
use plane::*;
use util::*;
use crate::plane::*;
use crate::util::*;
fn run_filter<T: AsPrimitive<i32>>(
src: &[T], stride: usize, filter: [i32; 8]
......
......@@ -11,17 +11,17 @@
pub use self::nasm::get_sad;
#[cfg(any(not(target_arch = "x86_64"), windows, not(feature = "nasm")))]
pub use self::native::get_sad;
use context::{BlockOffset, BLOCK_TO_PLANE_SHIFT, MI_SIZE};
use FrameInvariants;
use FrameState;
use partition::*;
use plane::*;
use rdo::get_lambda_sqrt;
use crate::context::{BlockOffset, BLOCK_TO_PLANE_SHIFT, MI_SIZE};
use crate::FrameInvariants;
use crate::FrameState;
use crate::partition::*;
use crate::plane::*;
use crate::rdo::get_lambda_sqrt;
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))]
mod nasm {
use plane::*;
use util::*;
use crate::plane::*;
use crate::util::*;
use libc;
......@@ -108,7 +108,7 @@ mod nasm {
}
mod native {
use plane::*;
use crate::plane::*;
#[inline(always)]
pub fn get_sad(
......@@ -420,8 +420,8 @@ pub fn estimate_motion_ss2(
#[cfg(test)]
pub mod test {
use super::*;
use partition::BlockSize;
use partition::BlockSize::*;
use crate::partition::BlockSize;
use crate::partition::BlockSize::*;
// Generate plane data for get_sad_same()
fn setup_sad() -> (Plane, Plane) {
......
......@@ -7,8 +7,8 @@
// 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 encoder::Frame;
use plane::Plane;
use crate::encoder::Frame;
use crate::plane::Plane;
/// Calculates the PSNR for a `Frame` by comparing the original (uncompressed) to the compressed
/// version of the frame. Higher PSNR is better--PSNR is capped at 100 in order to avoid skewed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment