Commit e03fb89a authored by Luca Barbato's avatar Luca Barbato Committed by Thomas Daede
Browse files

Ignore or remove the unused code

Some of it is a rust conversion of the specification and will be used in
the future, some is just dead code that wasn't seen as dead before the
visibility rework.
parent 679fa16a
......@@ -843,14 +843,6 @@ impl<T: Pixel> ContextInner<T> {
.as_ref().unwrap().as_ref().unwrap().clone()
}
pub fn get_frame_count(&self) -> u64 {
self.frame_count
}
pub fn set_limit(&mut self, limit: u64) {
self.limit = limit;
}
pub(crate) fn needs_more_lookahead(&self) -> bool {
self.needs_more_frames(self.frame_count) && self.frames_processed + LOOKAHEAD_FRAMES > self.frame_q.keys().last().cloned().unwrap_or(0)
}
......
......@@ -327,17 +327,6 @@ pub fn cdef_sb_padded_frame_copy<T: Pixel>(
out
}
pub fn cdef_empty_frame<T: Pixel, U: Pixel>(f: &Frame<T>) -> Frame<U> {
Frame {
planes: [
Plane::new(0, 0, f.planes[0].cfg.xdec, f.planes[0].cfg.ydec, 0, 0),
Plane::new(0, 0, f.planes[0].cfg.xdec, f.planes[0].cfg.ydec, 0, 0),
Plane::new(0, 0, f.planes[0].cfg.xdec, f.planes[0].cfg.ydec, 0, 0),
]
}
}
// We assume in is padded, and the area we'll write out is at least as
// large as the unpadded area of in
// cdef_index is taken from the block context
......
......@@ -853,6 +853,7 @@ pub static default_cfl_alpha_cdf: [[u16; cdf_size!(CFL_ALPHABET_SIZE)];
const SWITCHABLE_FILTERS: usize = 3;
const SWITCHABLE_FILTER_CONTEXTS: usize = (SWITCHABLE_FILTERS + 1) * 4;
#[allow(unused)]
pub static default_switchable_interp_cdf: [[u16;
cdf_size!(SWITCHABLE_FILTERS)];
SWITCHABLE_FILTER_CONTEXTS] = [
......@@ -912,9 +913,11 @@ pub static default_compound_mode_cdf: [[u16;
cdf!(13046, 23214, 24505, 25942, 27435, 28442, 29330)
];
#[allow(unused)]
pub static default_interintra_cdf: [[u16; cdf_size!(2)]; BLOCK_SIZE_GROUPS] =
[cdf!(16384), cdf!(26887), cdf!(27597), cdf!(30237)];
#[allow(unused)]
pub static default_interintra_mode_cdf: [[u16;
cdf_size!(InterIntraMode::INTERINTRA_MODES as usize)];
BLOCK_SIZE_GROUPS as usize] = [
......@@ -924,6 +927,7 @@ pub static default_interintra_mode_cdf: [[u16;
cdf!(4238, 11537, 25926)
];
#[allow(unused)]
pub static default_wedge_interintra_cdf: [[u16; cdf_size!(2)];
BlockSize::BLOCK_SIZES_ALL] = [
cdf!(16384),
......@@ -950,6 +954,7 @@ pub static default_wedge_interintra_cdf: [[u16; cdf_size!(2)];
cdf!(16384)
];
#[allow(unused)]
pub static default_compound_type_cdf: [[u16;
cdf_size!(CompoundType::COMPOUND_TYPES as usize - 1)];
BlockSize::BLOCK_SIZES_ALL as usize] = [
......@@ -977,6 +982,7 @@ pub static default_compound_type_cdf: [[u16;
cdf!(16384)
];
#[allow(unused)]
pub static default_wedge_idx_cdf: [[u16; cdf_size!(16)];
BlockSize::BLOCK_SIZES_ALL] = [
cdf!(
......@@ -1069,6 +1075,7 @@ pub static default_wedge_idx_cdf: [[u16; cdf_size!(16)];
)
];
#[allow(unused)]
pub static default_motion_mode_cdf: [[u16;
cdf_size!(MotionMode::MOTION_MODES as usize)];
BlockSize::BLOCK_SIZES_ALL as usize] = [
......@@ -1096,6 +1103,7 @@ pub static default_motion_mode_cdf: [[u16;
cdf!(29742, 31203)
];
#[allow(unused)]
pub static default_obmc_cdf: [[u16; cdf_size!(2)];
BlockSize::BLOCK_SIZES_ALL] = [
cdf!(16384),
......@@ -1132,6 +1140,7 @@ pub static default_comp_ref_type_cdf: [[u16; cdf_size!(2)];
COMP_REF_TYPE_CONTEXTS] =
[cdf!(1198), cdf!(2070), cdf!(9166), cdf!(7499), cdf!(22475)];
#[allow(unused)]
pub static default_uni_comp_ref_cdf: [[[u16; cdf_size!(2)];
UNIDIR_COMP_REFS - 1];
UNI_COMP_REF_CONTEXTS] = [
......@@ -1175,6 +1184,7 @@ pub static default_comp_bwdref_cdf: [[[u16; cdf_size!(2)]; BWD_REFS - 1];
[cdf!(30606), cdf!(30489)]
];
#[allow(unused)]
pub static default_palette_y_size_cdf: [[u16;
cdf_size!(PaletteSize::PALETTE_SIZES as usize)];
PALATTE_BSIZE_CTXS] = [
......@@ -1187,6 +1197,7 @@ pub static default_palette_y_size_cdf: [[u16;
cdf!(14940, 20797, 21678, 24186, 27033, 28999)
];
#[allow(unused)]
pub static default_palette_uv_size_cdf: [[u16;
cdf_size!(PaletteSize::PALETTE_SIZES as usize)];
PALATTE_BSIZE_CTXS] = [
......@@ -1199,6 +1210,7 @@ pub static default_palette_uv_size_cdf: [[u16;
cdf!(1269, 5435, 10433, 18963, 21700, 25865)
];
#[allow(unused)]
pub static default_palette_y_mode_cdf: [[[u16; cdf_size!(2)];
PALETTE_Y_MODE_CONTEXTS];
PALATTE_BSIZE_CTXS] = [
......@@ -1211,9 +1223,11 @@ pub static default_palette_y_mode_cdf: [[[u16; cdf_size!(2)];
[cdf!(32450), cdf!(7946), cdf!(129)]
];
#[allow(unused)]
pub static default_palette_uv_mode_cdf: [[u16; cdf_size!(2)];
PALETTE_UV_MODE_CONTEXTS] = [cdf!(32461), cdf!(21488)];
#[allow(unused)]
pub static default_palette_y_color_index_cdf: [[[u16;
cdf_size!(PaletteColor::PALETTE_COLORS as usize)];
PALETTE_COLOR_INDEX_CONTEXTS];
......@@ -1269,6 +1283,7 @@ pub static default_palette_y_color_index_cdf: [[[u16;
]
];
#[allow(unused)]
pub static default_palette_uv_color_index_cdf: [[[u16;
cdf_size!(PaletteColor::PALETTE_COLORS as usize)];
PALETTE_COLOR_INDEX_CONTEXTS];
......@@ -1324,6 +1339,7 @@ pub static default_palette_uv_color_index_cdf: [[[u16;
]
];
#[allow(unused)]
pub static default_txfm_partition_cdf: [[u16; cdf_size!(2)];
TXFM_PARTITION_CONTEXTS] = [
cdf!(28581),
......@@ -1352,13 +1368,16 @@ pub static default_txfm_partition_cdf: [[u16; cdf_size!(2)];
pub static default_skip_cdfs: [[u16; cdf_size!(2)]; SKIP_CONTEXTS] =
[cdf!(31671), cdf!(16515), cdf!(4576)];
#[allow(unused)]
pub static default_skip_mode_cdfs: [[u16; cdf_size!(2)]; SKIP_MODE_CONTEXTS] =
[cdf!(32621), cdf!(20708), cdf!(8127)];
#[allow(unused)]
pub static default_compound_idx_cdfs: [[u16; cdf_size!(2)];
COMP_INDEX_CONTEXTS] =
[cdf!(18244), cdf!(12865), cdf!(7053), cdf!(13259), cdf!(9334), cdf!(4644)];
#[allow(unused)]
pub static default_comp_group_idx_cdfs: [[u16; cdf_size!(2)];
COMP_GROUP_IDX_CONTEXTS] = [
cdf!(26607),
......@@ -1369,8 +1388,10 @@ pub static default_comp_group_idx_cdfs: [[u16; cdf_size!(2)];
cdf!(22674)
];
#[allow(unused)]
pub static default_intrabc_cdf: [u16; cdf_size!(2)] = cdf!(30531);
#[allow(unused)]
pub static default_filter_intra_mode_cdf: [u16;
cdf_size!(FilterIntraMode::FILTER_INTRA_MODES as usize)] =
cdf!(8949, 12776, 17211, 29558);
......@@ -1408,6 +1429,7 @@ pub static default_wiener_restore_cdf: [u16; cdf_size!(2)] = cdf!(11570);
pub static default_sgrproj_restore_cdf: [u16; cdf_size!(2)] = cdf!(16855);
#[allow(unused)]
pub static default_delta_q_cdf: [u16; cdf_size!(DELTA_Q_PROBS + 1)] =
cdf!(28160, 32120, 32677);
......@@ -1423,9 +1445,11 @@ pub static default_delta_lf_cdf: [u16; cdf_size!(DELTA_LF_PROBS + 1)] =
cdf!(28160, 32120, 32677);
// FIXME(someone) need real defaults here
#[allow(unused)]
pub static default_seg_tree_cdf: [u16; cdf_size!(MAX_SEGMENTS)] =
cdf!(4096, 8192, 12288, 16384, 20480, 24576, 28672);
#[allow(unused)]
pub static default_segment_pred_cdf: [[u16; cdf_size!(2)];
SEG_TEMPORAL_PRED_CTXS] =
[cdf!(128 * 128), cdf!(128 * 128), cdf!(128 * 128)];
......
......@@ -50,6 +50,7 @@ pub enum ReferenceMode {
}
#[allow(non_camel_case_types)]
#[allow(unused)]
pub enum ObuType {
OBU_SEQUENCE_HEADER = 1,
OBU_TEMPORAL_DELIMITER = 2,
......@@ -64,6 +65,7 @@ pub enum ObuType {
#[derive(Clone,Copy)]
#[allow(non_camel_case_types)]
#[allow(unused)]
pub enum ObuMetaType {
OBU_META_HDR_CLL = 1,
OBU_META_HDR_MDCV = 2,
......
......@@ -35,6 +35,7 @@ pub const RESTORE_SGRPROJ: u8 = 3;
pub const WIENER_TAPS_MIN: [i8; 3] = [ -5, -23, -17 ];
pub const WIENER_TAPS_MID: [i8; 3] = [ 3, -7, 15 ];
pub const WIENER_TAPS_MAX: [i8; 3] = [ 10, 8, 46 ];
#[allow(unused)]
pub const WIENER_TAPS_K: [i8; 3] = [ 1, 2, 3 ];
pub const WIENER_BITS: usize = 7;
......
......@@ -16,6 +16,7 @@ use crate::tiling::*;
use crate::util::Pixel;
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
#[allow(unused)]
pub enum FilterMode {
REGULAR = 0,
SMOOTH = 1,
......
......@@ -42,14 +42,6 @@ pub static RAV1E_INTRA_MODES: &'static [PredictionMode] = &[
PredictionMode::D63_PRED, */
];
// Intra prediction modes tested at high speed levels
#[rustfmt::skip]
pub static RAV1E_INTRA_MODES_MINIMAL: &'static [PredictionMode] = &[
PredictionMode::DC_PRED,
PredictionMode::H_PRED,
PredictionMode::V_PRED
];
pub static RAV1E_INTER_MODES_MINIMAL: &'static [PredictionMode] = &[
PredictionMode::NEARESTMV
];
......@@ -92,12 +84,14 @@ const NEED_LEFT: u8 = 1 << 1;
const NEED_ABOVE: u8 = 1 << 2;
const NEED_ABOVERIGHT: u8 = 1 << 3;
const NEED_ABOVELEFT: u8 = 1 << 4;
#[allow(unused)]
const NEED_BOTTOMLEFT: u8 = 1 << 5;
/*const INTRA_EDGE_FILT: usize = 3;
const INTRA_EDGE_TAPS: usize = 5;
const MAX_UPSAMPLE_SZ: usize = 16;*/
#[allow(unused)]
pub static extend_modes: [u8; INTRA_MODES] = [
NEED_ABOVE | NEED_LEFT, // DC
NEED_ABOVE, // V
......
......@@ -22,7 +22,9 @@ pub const FRAME_NSUBTYPES: usize = 4;
pub const FRAME_SUBTYPE_I: usize = 0;
pub const FRAME_SUBTYPE_P: usize = 1;
#[allow(unused)]
pub const FRAME_SUBTYPE_B0: usize = 2;
#[allow(unused)]
pub const FRAME_SUBTYPE_B1: usize = 3;
pub const FRAME_SUBTYPE_SEF: usize = 4;
......
pub const RDO_NUM_BINS: usize = 50;
#[allow(unused)]
pub const RDO_MAX_BIN: usize = 10000;
pub const RATE_EST_MAX_BIN: usize = 100_000;
pub const RDO_QUANT_BINS: usize = 8;
pub const RDO_QUANT_DIV: usize = 256/RDO_QUANT_BINS;
#[allow(unused)]
pub const RDO_BIN_SIZE: u64 = (RDO_MAX_BIN / RDO_NUM_BINS) as u64;
pub const RATE_EST_BIN_SIZE: u64 = (RATE_EST_MAX_BIN / RDO_NUM_BINS) as u64;
......
......@@ -52,6 +52,10 @@ pub fn UninitializedAlignedArray<ARRAY>() -> AlignedArray<ARRAY> {
#[test]
fn sanity() {
fn is_aligned<T>(ptr: *const T, n: usize) -> bool {
((ptr as usize) & ((1 << n) - 1)) == 0
}
let a: AlignedArray<_> = AlignedArray([0u8; 3]);
assert!(is_aligned(a.array.as_ptr(), 4));
}
......@@ -82,11 +86,6 @@ impl Fixed for usize {
}
}
/// Check alignment.
pub fn is_aligned<T>(ptr: *const T, n: usize) -> bool {
((ptr as usize) & ((1 << n) - 1)) == 0
}
pub fn clamp<T: PartialOrd>(input: T, min: T, max: T) -> T {
if input < min {
min
......
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