From 1c4fcd8c3120bd9c84fbfc740ac3ebe249db198e Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 20 May 2024 16:37:26 +0200 Subject: [PATCH] Fix clippy lints --- src/api/color.rs | 8 ++++---- src/api/internal.rs | 10 +++++----- src/api/util.rs | 2 +- src/asm/aarch64/cdef.rs | 12 ++++++------ src/bin/stats.rs | 2 +- src/ec.rs | 2 +- src/encoder.rs | 20 ++++++++++---------- src/rdo.rs | 2 +- src/scenechange/mod.rs | 4 ++-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/api/color.rs b/src/api/color.rs index c0bb23a548..1146ee0bd0 100644 --- a/src/api/color.rs +++ b/src/api/color.rs @@ -171,19 +171,19 @@ pub enum MatrixCoefficients { BT601, /// SMPTE 240 M SMPTE240, - /// YCgCo + /// `YCgCo` YCgCo, - /// BT.2020 non-constant luminance, BT.2100 YCbCr + /// BT.2020 non-constant luminance, BT.2100 `YCbCr` BT2020NCL, /// BT.2020 constant luminance BT2020CL, - /// SMPTE ST 2085 YDzDx + /// SMPTE ST 2085 `YDzDx` SMPTE2085, /// Chromaticity-derived non-constant luminance ChromatNCL, /// Chromaticity-derived constant luminance ChromatCL, - /// BT.2020 ICtCp + /// BT.2020 `ICtCp` ICtCp, } diff --git a/src/api/internal.rs b/src/api/internal.rs index ffaf27c1e0..39d696a303 100644 --- a/src/api/internal.rs +++ b/src/api/internal.rs @@ -54,7 +54,7 @@ pub struct InterConfig { group_output_len: u64, /// Interval between consecutive S-frames. /// Keyframes reset this interval. - /// This MUST be a multiple of group_input_len. + /// This MUST be a multiple of `group_input_len`. pub(crate) switch_frame_interval: u64, } @@ -229,12 +229,12 @@ pub(crate) struct ContextInner { pub(crate) output_frameno: u64, pub(super) inter_cfg: InterConfig, pub(super) frames_processed: u64, - /// Maps *input_frameno* to frames + /// Maps *`input_frameno`* to frames pub(super) frame_q: FrameQueue, - /// Maps *output_frameno* to frame data + /// Maps *`output_frameno`* to frame data pub(super) frame_data: FrameDataQueue, - /// A list of the input_frameno for keyframes in this encode. - /// Needed so that we don't need to keep all of the frame_invariants in + /// A list of the `input_frameno` for keyframes in this encode. + /// Needed so that we don't need to keep all of the `frame_invariants` in /// memory for the whole life of the encode. // TODO: Is this needed at all? keyframes: BTreeSet, diff --git a/src/api/util.rs b/src/api/util.rs index ad41006ad0..9480be283c 100644 --- a/src/api/util.rs +++ b/src/api/util.rs @@ -142,7 +142,7 @@ impl fmt::Display for FrameType { pub struct T35 { /// Country code. pub country_code: u8, - /// Country code extension bytes (if country_code == 0xFF) + /// Country code extension bytes (if `country_code` == 0xFF) pub country_code_extension_byte: u8, /// T.35 payload. pub data: Box<[u8]>, diff --git a/src/asm/aarch64/cdef.rs b/src/asm/aarch64/cdef.rs index 2a48e42867..8025c71ba5 100644 --- a/src/asm/aarch64/cdef.rs +++ b/src/asm/aarch64/cdef.rs @@ -132,10 +132,10 @@ pub(crate) unsafe fn cdef_filter_block( // rows (that is, src.x, src.y-2). It does _not_ point to // src.x-2, src.y-2. (pad)( - tmp.data.as_mut_ptr().offset(2 * tmpstride + 8) as *mut u16, + tmp.data.as_mut_ptr().offset(2 * tmpstride + 8), src as *const u8, T::to_asm_stride(src_stride as usize), - left.data.as_ptr() as *const [u8; 2], + left.data.as_ptr(), top as *const u8, bottom as *const u8, 8 >> ydec, @@ -145,7 +145,7 @@ pub(crate) unsafe fn cdef_filter_block( (func)( dst.data_ptr_mut() as *mut u8, T::to_asm_stride(dst.plane_cfg.stride), - tmp.data.as_ptr().offset(2 * tmpstride + 8) as *const u16, + tmp.data.as_ptr().offset(2 * tmpstride + 8), pri_strength, sec_strength, dir as i32, @@ -187,10 +187,10 @@ pub(crate) unsafe fn cdef_filter_block( } (pad)( - tmp.data.as_mut_ptr().offset(2 * tmpstride + 8) as *mut u16, + tmp.data.as_mut_ptr().offset(2 * tmpstride + 8), src as *const u16, T::to_asm_stride(src_stride as usize), - left.data.as_ptr() as *const [u16; 2], + left.data.as_ptr(), top as *const u16, bottom as *const u16, 8 >> ydec, @@ -200,7 +200,7 @@ pub(crate) unsafe fn cdef_filter_block( (func)( dst.data_ptr_mut() as *mut u16, T::to_asm_stride(dst.plane_cfg.stride), - tmp.data.as_ptr().offset(2 * tmpstride + 8) as *const u16, + tmp.data.as_ptr().offset(2 * tmpstride + 8), pri_strength, sec_strength, dir as i32, diff --git a/src/bin/stats.rs b/src/bin/stats.rs index ea41e11ca2..7a592cbd4c 100644 --- a/src/bin/stats.rs +++ b/src/bin/stats.rs @@ -721,7 +721,7 @@ pub struct QualityMetrics { pub ssim: Option, /// Multi-Scale Structural Similarity pub ms_ssim: Option, - /// CIEDE 2000 color difference algorithm: https://en.wikipedia.org/wiki/Color_difference#CIEDE2000 + /// CIEDE 2000 [color difference algorithm](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000) pub ciede: Option, /// Aligned Peak Signal-to-Noise Ratio for Y, U, and V planes pub apsnr: Option, diff --git a/src/ec.rs b/src/ec.rs index 870185251c..a6c9563ff7 100644 --- a/src/ec.rs +++ b/src/ec.rs @@ -121,7 +121,7 @@ pub struct WriterBase { #[cfg(feature = "desync_finder")] /// Debug enable flag debug: bool, - /// Extra offset added to tell() and tell_frac() to approximate costs + /// Extra offset added to `tell()` and `tell_frac()` to approximate costs /// of actually coding a symbol fake_bits_frac: u32, /// Use-specific storage diff --git a/src/encoder.rs b/src/encoder.rs index 5d2cb1de19..864665e319 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -146,11 +146,11 @@ pub struct Sequence { pub still_picture: bool, /// Use reduced header for still picture pub reduced_still_picture_hdr: bool, - /// enables/disables filter_intra + /// enables/disables `filter_intra` pub enable_filter_intra: bool, /// enables/disables corner/edge filtering and upsampling pub enable_intra_edge_filter: bool, - /// enables/disables interintra_compound + /// enables/disables `interintra_compound` pub enable_interintra_compound: bool, /// enables/disables masked compound pub enable_masked_compound: bool, @@ -158,9 +158,9 @@ pub struct Sequence { /// 1 - enable vert/horiz filter selection pub enable_dual_filter: bool, /// 0 - disable order hint, and related tools - /// jnt_comp, ref_frame_mvs, frame_sign_bias - /// if 0, enable_jnt_comp and - /// enable_ref_frame_mvs must be set zs 0. + /// `jnt_comp`, `ref_frame_mvs`, `frame_sign_bias` + /// if 0, `enable_jnt_comp` and + /// `enable_ref_frame_mvs` must be set zs 0. pub enable_order_hint: bool, /// 0 - disable joint compound modes /// 1 - enable it @@ -190,7 +190,7 @@ pub struct Sequence { pub display_model_info_present_flag: bool, pub decoder_model_info_present_flag: bool, pub level_idx: [u8; MAX_NUM_OPERATING_POINTS], - /// seq_tier in the spec. One bit: 0 or 1. + /// `seq_tier` in the spec. One bit: 0 or 1. pub tier: [usize; MAX_NUM_OPERATING_POINTS], pub film_grain_params_present: bool, pub timing_info_present: bool, @@ -700,9 +700,9 @@ pub struct CodedFrameData { /// indicating how much future frames depend on the block (for example, via /// inter-prediction). pub block_importances: Box<[f32]>, - /// Pre-computed distortion_scale. + /// Pre-computed `distortion_scale`. pub distortion_scales: Box<[DistortionScale]>, - /// Pre-computed activity_scale. + /// Pre-computed `activity_scale`. pub activity_scales: Box<[DistortionScale]>, pub activity_mask: ActivityMask, /// Combined metric of activity and distortion @@ -772,7 +772,7 @@ impl CodedFrameData { for scale in self.distortion_scales.iter_mut() { *scale *= inv_mean; } - self.spatiotemporal_scores = self.distortion_scales.clone(); + self.spatiotemporal_scores.clone_from(&self.distortion_scales); inv_mean.blog64() >> 1 } @@ -986,7 +986,7 @@ impl FrameInvariants { let show_existing_frame = inter_cfg.get_show_existing_frame(fi.idx_in_group_output); if !show_existing_frame { - fi.coded_frame_data = previous_coded_fi.coded_frame_data.clone(); + fi.coded_frame_data.clone_from(&previous_coded_fi.coded_frame_data); } fi.order_hint = diff --git a/src/rdo.rs b/src/rdo.rs index bc08e40614..c2410adfd0 100644 --- a/src/rdo.rs +++ b/src/rdo.rs @@ -2003,7 +2003,7 @@ pub fn rdo_partition_decision( if rd < best_rd { best_rd = rd; best_partition = partition; - best_pred_modes = child_modes.clone(); + best_pred_modes.clone_from(&child_modes); } } cw.rollback(&cw_checkpoint); diff --git a/src/scenechange/mod.rs b/src/scenechange/mod.rs index b2c89af3d0..6974a03468 100644 --- a/src/scenechange/mod.rs +++ b/src/scenechange/mod.rs @@ -65,7 +65,7 @@ pub struct SceneChangeDetector { scale_func: Option>, /// Frame buffer for scaled frames downscaled_frame_buffer: Option<[Plane; 2]>, - /// Buffer for FrameMEStats for cost scenecut + /// Buffer for `FrameMEStats` for cost scenecut frame_me_stats_buffer: Option, /// Deque offset for current lookahead_offset: usize, @@ -84,7 +84,7 @@ pub struct SceneChangeDetector { /// Calculated intra costs for each input frame. /// These are cached for reuse later in rav1e. pub(crate) intra_costs: BTreeMap>, - /// Temporary buffer used by estimate_intra_costs. + /// Temporary buffer used by `estimate_intra_costs`. pub(crate) temp_plane: Option>, }