Skip to content

Commit

Permalink
refactor: fix a bunch of simple warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DCNick3 committed Jun 24, 2024
1 parent 82cde68 commit f1cd984
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 72 deletions.
6 changes: 1 addition & 5 deletions src/celt/celt_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ unsafe fn compute_mdcts(
CC: i32,
LM: i32,
upsample: i32,
arch: i32,
) {
let overlap: i32 = (*mode).overlap;
let mut N: i32 = 0;
Expand Down Expand Up @@ -464,7 +463,7 @@ unsafe fn compute_mdcts(
),
std::slice::from_raw_parts_mut(
out.offset((b + c * N * B) as isize),
(mdct_n / 2 * B as usize),
mdct_n / 2 * B as usize,
),
(*mode).window,
overlap as usize,
Expand Down Expand Up @@ -2296,7 +2295,6 @@ pub unsafe fn celt_encode_with_ec(
CC,
LM,
(*st).upsample,
(*st).arch,
);
compute_band_energies(
mode,
Expand Down Expand Up @@ -2331,7 +2329,6 @@ pub unsafe fn celt_encode_with_ec(
CC,
LM,
(*st).upsample,
(*st).arch,
);
assert!(
!(*freq.as_mut_ptr().offset(0 as isize) != *freq.as_mut_ptr().offset(0 as isize))
Expand Down Expand Up @@ -2574,7 +2571,6 @@ pub unsafe fn celt_encode_with_ec(
CC,
LM,
(*st).upsample,
(*st).arch,
);
compute_band_energies(
mode,
Expand Down
5 changes: 1 addition & 4 deletions src/celt/modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ pub mod stddef_h {
pub mod static_modes_float_h;

pub use self::arch_h::opus_val16;
pub use self::static_modes_float_h::{
cache_bits50, cache_caps50, cache_index50, fft_bitrev120, fft_bitrev240, fft_bitrev480,
fft_bitrev60, fft_twiddles48000_960, logN400, static_mode_list, window120,
};
pub use self::static_modes_float_h::static_mode_list;
pub use self::stddef_h::NULL;
use crate::celt::mdct::mdct_lookup;
use crate::src::opus_defines::{OPUS_BAD_ARG, OPUS_OK};
Expand Down
2 changes: 1 addition & 1 deletion src/celt/quant_bands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static mut e_prob_model: [[[u8; 42]; 2]; 4] = [
],
],
];
static mut small_energy_icdf: [u8; 3] = [2, 1, 0];
static small_energy_icdf: [u8; 3] = [2, 1, 0];
unsafe fn loss_distortion(
eBands: *const opus_val16,
oldEBands: *mut opus_val16,
Expand Down
1 change: 0 additions & 1 deletion src/celt/vq.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::celt::bands::SPREAD_NONE;
use std::f32::consts::PI;

pub mod arch_h {
pub type opus_val16 = f32;
Expand Down
3 changes: 3 additions & 0 deletions src/silk/check_control_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ pub mod errors_h {
pub const SILK_ENC_FS_NOT_SUPPORTED: i32 = -(102);
}

// I still am on the fence on whether I should handle user or just panic
// these should stay until I decide
#[allow(unused)]
pub use self::errors_h::{
SILK_ENC_FS_NOT_SUPPORTED, SILK_ENC_INVALID_CBR_SETTING, SILK_ENC_INVALID_COMPLEXITY_SETTING,
SILK_ENC_INVALID_DTX_SETTING, SILK_ENC_INVALID_INBAND_FEC_SETTING, SILK_ENC_INVALID_LOSS_RATE,
Expand Down
7 changes: 0 additions & 7 deletions src/silk/control_codec.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
pub mod xmmintrin_h {
#[cfg(target_arch = "x86")]
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
#[cfg(target_arch = "x86_64")]
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
}
pub mod errors_h {
pub const SILK_ENC_PACKET_SIZE_NOT_SUPPORTED: i32 = -(103);
pub const SILK_NO_ERROR: i32 = 0;
Expand Down Expand Up @@ -41,7 +35,6 @@ pub mod typedef_h {
pub const silk_int16_MAX: i32 = i16::MAX as i32;
}
use self::errors_h::{SILK_ENC_PACKET_SIZE_NOT_SUPPORTED, SILK_NO_ERROR};
pub use self::typedef_h::{silk_int16_MAX, silk_int16_MIN};
pub use self::SigProc_FLP_h::{silk_float2short_array, silk_short2float_array};
use crate::externs::memset;
use crate::silk::control_audio_bandwidth::silk_control_audio_bandwidth;
Expand Down
2 changes: 0 additions & 2 deletions src/silk/float/find_LPC_FLP.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ pub mod typedef_h {
pub mod internal {
pub const __FLT_MAX__: f32 = 3.40282347e+38f32;
}
pub use self::float_h::FLT_MAX;
pub use self::internal::__FLT_MAX__;
pub use self::typedef_h::silk_float_MAX;
use crate::silk::define::MAX_NB_SUBFR;
use crate::silk::float::burg_modified_FLP::silk_burg_modified_FLP;
Expand Down
6 changes: 0 additions & 6 deletions src/silk/float/pitch_analysis_core_FLP.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
pub mod arch_h {
pub type opus_val32 = f32;
}
pub mod xmmintrin_h {
#[cfg(target_arch = "x86")]
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
#[cfg(target_arch = "x86_64")]
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
}
pub mod SigProc_FLP_h {
#[inline]
pub unsafe fn silk_float2short_array(out: *mut i16, in_0: *const f32, length: i32) {
Expand Down
6 changes: 0 additions & 6 deletions src/silk/float/wrappers_FLP.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
use crate::silk::A2NLSF::silk_A2NLSF;
use crate::silk::NLSF2A::silk_NLSF2A;

pub mod xmmintrin_h {
#[cfg(target_arch = "x86")]
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
#[cfg(target_arch = "x86_64")]
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
}
pub mod SigProc_FLP_h {
#[inline]
pub unsafe fn silk_float2int(x: f32) -> i32 {
Expand Down
7 changes: 0 additions & 7 deletions src/silk/resampler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ enum ResamplerMode {
DownFir(ResamplerDownFirParams, ResamplerDownFirState),
}

#[derive(Copy, Clone)]
#[repr(C)]
pub union sFIR_union {
pub i32_0: [i32; SILK_RESAMPLER_MAX_FIR_ORDER],
pub i16_0: [i16; SILK_RESAMPLER_MAX_FIR_ORDER],
}

pub fn silk_resampler_init(Fs_Hz_in: i32, Fs_Hz_out: i32, forEnc: i32) -> ResamplerState {
let inputDelay = if forEnc != 0 {
if !matches!(Fs_Hz_in, 8000 | 12000 | 16000 | 24000 | 48000)
Expand Down
6 changes: 0 additions & 6 deletions src/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ pub const ANALYSIS_BUF_SIZE: i32 = 720;
pub const DETECT_SIZE: i32 = 100;
pub const NB_FRAMES: i32 = 8;
pub const NB_TBANDS: i32 = 18;
pub mod xmmintrin_h {
#[cfg(target_arch = "x86")]
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
#[cfg(target_arch = "x86_64")]
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
}
pub mod math_h {
pub const M_PI: f64 = 3.14159265358979323846f64;
}
Expand Down
8 changes: 1 addition & 7 deletions src/src/mapping_matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ pub mod arch_h {
pub type opus_val16 = f32;
pub type opus_val32 = f32;
}
pub mod xmmintrin_h {
#[cfg(target_arch = "x86")]
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
#[cfg(target_arch = "x86_64")]
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
}
pub use self::arch_h::{opus_val16, opus_val32};
use self::arch_h::{opus_val16, opus_val32};
use crate::celt::float_cast::FLOAT2INT16;
use crate::src::opus_private::align;

Expand Down
6 changes: 0 additions & 6 deletions src/src/opus_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ pub mod stddef_h {
pub type size_t = u64;
pub const NULL: i32 = 0;
}
pub mod xmmintrin_h {
#[cfg(target_arch = "x86")]
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
#[cfg(target_arch = "x86_64")]
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
}
pub mod cpu_support_h {
#[inline]
pub unsafe fn opus_select_arch() -> i32 {
Expand Down
6 changes: 0 additions & 6 deletions src/src/opus_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ pub mod stddef_h {
pub type size_t = u64;
pub const NULL: i32 = 0;
}
pub mod xmmintrin_h {
#[cfg(target_arch = "x86")]
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
#[cfg(target_arch = "x86_64")]
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
}
pub mod cpu_support_h {
#[inline]
pub unsafe fn opus_select_arch() -> i32 {
Expand Down
6 changes: 0 additions & 6 deletions src/src/opus_multistream_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ pub mod stddef_h {
pub type size_t = u64;
pub const NULL: i32 = 0;
}
pub mod xmmintrin_h {
#[cfg(target_arch = "x86")]
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
#[cfg(target_arch = "x86_64")]
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
}
use self::arch_h::opus_val16;
pub use self::stddef_h::{size_t, NULL};
use crate::celt::float_cast::FLOAT2INT16;
Expand Down
4 changes: 2 additions & 2 deletions unsafe-libopus-tools/src/demo/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

use ::unsafe_libopus::varargs::VarArgs;

pub struct Encoder([u8; 1]);
pub struct Decoder([u8; 1]);
pub struct Encoder(());
pub struct Decoder(());

pub trait OpusBackend {
unsafe fn opus_encoder_create(
Expand Down

0 comments on commit f1cd984

Please sign in to comment.