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

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
......
......@@ -12,12 +12,12 @@
use self::BlockSize::*;
use self::TxSize::*;
use context::*;
use encoder::{ChromaSampling, FrameInvariants};
use mc::*;
use plane::*;
use predict::*;
use util::*;
use crate::context::*;
use crate::encoder::{ChromaSampling, FrameInvariants};
use crate::mc::*;
use crate::plane::*;
use crate::predict::*;
use crate::util::*;
pub const NONE_FRAME: usize = 8;
pub const INTRA_FRAME: usize = 0;
......
......@@ -12,7 +12,7 @@
use std::iter::FusedIterator;
use std::fmt::{Debug, Formatter};
use util::*;
use crate::util::*;
/// Plane-specific configuration.
#[derive(Debug, Clone)]
......
......@@ -11,9 +11,9 @@
#![allow(clippy::cast_lossless)]
#![allow(clippy::needless_range_loop)]
use context::{INTRA_MODES, MAX_TX_SIZE};
use partition::*;
use util::*;
use crate::context::{INTRA_MODES, MAX_TX_SIZE};
use crate::partition::*;
use crate::util::*;
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))]
use libc;
......
......@@ -10,7 +10,7 @@
#![allow(clippy::cast_lossless)]
#![allow(non_upper_case_globals)]
use partition::TxSize;
use crate::partition::TxSize;
use num_traits::*;
use std::convert::Into;
......@@ -98,7 +98,7 @@ fn divu_pair(x: i32, d: (u32, u32, u32)) -> i32 {
#[cfg(test)]
mod test {
use super::*;
use partition::TxSize::*;
use crate::partition::TxSize::*;
#[test]
fn test_divu_pair() {
......
......@@ -11,31 +11,31 @@
#![allow(non_camel_case_types)]
#![allow(clippy::cast_lossless)]
use api::PredictionModesSetting;
use cdef::*;
use context::*;
use ec::{OD_BITRES, Writer, WriterCounter};
use encoder::{ChromaSampling, ReferenceMode};
use encode_block_a;
use encode_block_b;
use encode_block_with_modes;
use FrameInvariants;
use FrameState;
use FrameType;
use luma_ac;
use me::*;
use motion_compensate;
use partition::*;
use plane::*;
use predict::{RAV1E_INTRA_MODES, RAV1E_INTER_MODES_MINIMAL, RAV1E_INTER_COMPOUND_MODES};
use quantize::dc_q;
use Tune;
use write_tx_blocks;
use write_tx_tree;
use crate::api::PredictionModesSetting;
use crate::cdef::*;
use crate::context::*;
use crate::ec::{OD_BITRES, Writer, WriterCounter};
use crate::encoder::{ChromaSampling, ReferenceMode};
use crate::encode_block_a;
use crate::encode_block_b;
use crate::encode_block_with_modes;
use crate::FrameInvariants;
use crate::FrameState;
use crate::FrameType;
use crate::luma_ac;
use crate::me::*;
use crate::motion_compensate;
use crate::partition::*;
use crate::plane::*;
use crate::predict::{RAV1E_INTRA_MODES, RAV1E_INTER_MODES_MINIMAL, RAV1E_INTER_COMPOUND_MODES};
use crate::quantize::dc_q;
use crate::Tune;
use crate::write_tx_blocks;
use crate::write_tx_tree;
use std;
use std::vec::Vec;
use partition::PartitionType::*;
use crate::partition::PartitionType::*;
#[derive(Clone)]
pub struct RDOOutput {
......
......@@ -14,7 +14,7 @@
const MAX_NEIGHBORS: usize = 2;
use partition::*;
use crate::partition::*;
#[repr(C)]
pub struct SCAN_ORDER {
......
......@@ -7,7 +7,7 @@
// 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 crate::encoder::Frame;
use std::sync::Arc;
......
......@@ -9,9 +9,9 @@
#![allow(safe_extern_statics)]
use context::*;
use FrameInvariants;
use FrameState;
use crate::context::*;
use crate::FrameInvariants;
use crate::FrameState;
pub fn segmentation_optimize(_fi: &FrameInvariants, fs: &mut FrameState) {
fs.segmentation.enabled = false;
......
......@@ -9,8 +9,8 @@
#![allow(non_upper_case_globals)]
use context::*;
use partition::*;
use crate::context::*;
use crate::partition::*;
const TOKEN_CDF_Q_CTXS: usize = 4;
......
......@@ -8,7 +8,7 @@
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
use super::*;
use partition::{TxSize, TxType};
use crate::partition::{TxSize, TxType};
type TxfmShift = [i8; 3];
type TxfmShifts = [TxfmShift; 3];
......@@ -65,7 +65,7 @@ use std::ops::*;
trait TxOperations:
Copy + Default + Add<Output = Self> + Sub<Output = Self>
{
fn tx_mul(self, (i32, i32)) -> Self;
fn tx_mul(self, _: (i32, i32)) -> Self;
fn add_avg(self, b: Self) -> Self;
fn sub_avg(self, b: Self) -> Self;
fn rshift1(self) -> Self;
......
......@@ -16,7 +16,7 @@ pub use self::native::*;
use super::*;
use num_traits::*;
use partition::TxType;
use crate::partition::TxType;
static COSPI_INV: [i32; 64] = [
4096, 4095, 4091, 4085, 4076, 4065, 4052, 4036, 4017, 3996, 3973, 3948,
......@@ -1509,7 +1509,7 @@ static INV_TXFM_FNS: [[fn(&[i32], &mut [i32], usize); 5]; 4] = [
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))]
mod nasm {
use super::*;
use partition::TxType;
use crate::partition::TxType;
type InvTxfmFunc =
unsafe extern fn(*mut u8, libc::ptrdiff_t, *const i16, i32);
......@@ -1675,8 +1675,8 @@ mod nasm {
mod native {
use super::*;
use partition::TxType;
use util::clamp;
use crate::partition::TxType;
use crate::util::clamp;
use std::cmp;
......
......@@ -10,9 +10,9 @@
pub use self::forward::*;
pub use self::inverse::*;
use partition::{TxSize, TxType, TX_TYPES};
use predict::*;
use util::*;
use crate::partition::{TxSize, TxType, TX_TYPES};
use crate::predict::*;
use crate::util::*;
mod forward;
mod inverse;
......@@ -263,8 +263,8 @@ mod test {
#[test]
fn roundtrips() {
use partition::TxSize::*;
use partition::TxType::*;
use crate::partition::TxSize::*;
use crate::partition::TxType::*;
let combinations = [
(TX_4X4, DCT_DCT, 0),
(TX_4X4, ADST_DCT, 0),
......
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