Skip to content

Commit f1cd984

Browse files
committed
refactor: fix a bunch of simple warnings
1 parent 82cde68 commit f1cd984

16 files changed

+9
-72
lines changed

src/celt/celt_encoder.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ unsafe fn compute_mdcts(
430430
CC: i32,
431431
LM: i32,
432432
upsample: i32,
433-
arch: i32,
434433
) {
435434
let overlap: i32 = (*mode).overlap;
436435
let mut N: i32 = 0;
@@ -464,7 +463,7 @@ unsafe fn compute_mdcts(
464463
),
465464
std::slice::from_raw_parts_mut(
466465
out.offset((b + c * N * B) as isize),
467-
(mdct_n / 2 * B as usize),
466+
mdct_n / 2 * B as usize,
468467
),
469468
(*mode).window,
470469
overlap as usize,
@@ -2296,7 +2295,6 @@ pub unsafe fn celt_encode_with_ec(
22962295
CC,
22972296
LM,
22982297
(*st).upsample,
2299-
(*st).arch,
23002298
);
23012299
compute_band_energies(
23022300
mode,
@@ -2331,7 +2329,6 @@ pub unsafe fn celt_encode_with_ec(
23312329
CC,
23322330
LM,
23332331
(*st).upsample,
2334-
(*st).arch,
23352332
);
23362333
assert!(
23372334
!(*freq.as_mut_ptr().offset(0 as isize) != *freq.as_mut_ptr().offset(0 as isize))
@@ -2574,7 +2571,6 @@ pub unsafe fn celt_encode_with_ec(
25742571
CC,
25752572
LM,
25762573
(*st).upsample,
2577-
(*st).arch,
25782574
);
25792575
compute_band_energies(
25802576
mode,

src/celt/modes.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ pub mod stddef_h {
3737
pub mod static_modes_float_h;
3838

3939
pub use self::arch_h::opus_val16;
40-
pub use self::static_modes_float_h::{
41-
cache_bits50, cache_caps50, cache_index50, fft_bitrev120, fft_bitrev240, fft_bitrev480,
42-
fft_bitrev60, fft_twiddles48000_960, logN400, static_mode_list, window120,
43-
};
40+
pub use self::static_modes_float_h::static_mode_list;
4441
pub use self::stddef_h::NULL;
4542
use crate::celt::mdct::mdct_lookup;
4643
use crate::src::opus_defines::{OPUS_BAD_ARG, OPUS_OK};

src/celt/quant_bands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static mut e_prob_model: [[[u8; 42]; 2]; 4] = [
109109
],
110110
],
111111
];
112-
static mut small_energy_icdf: [u8; 3] = [2, 1, 0];
112+
static small_energy_icdf: [u8; 3] = [2, 1, 0];
113113
unsafe fn loss_distortion(
114114
eBands: *const opus_val16,
115115
oldEBands: *mut opus_val16,

src/celt/vq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::celt::bands::SPREAD_NONE;
2-
use std::f32::consts::PI;
32

43
pub mod arch_h {
54
pub type opus_val16 = f32;

src/silk/check_control_input.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ pub mod errors_h {
1111
pub const SILK_ENC_FS_NOT_SUPPORTED: i32 = -(102);
1212
}
1313

14+
// I still am on the fence on whether I should handle user or just panic
15+
// these should stay until I decide
16+
#[allow(unused)]
1417
pub use self::errors_h::{
1518
SILK_ENC_FS_NOT_SUPPORTED, SILK_ENC_INVALID_CBR_SETTING, SILK_ENC_INVALID_COMPLEXITY_SETTING,
1619
SILK_ENC_INVALID_DTX_SETTING, SILK_ENC_INVALID_INBAND_FEC_SETTING, SILK_ENC_INVALID_LOSS_RATE,

src/silk/control_codec.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
pub mod xmmintrin_h {
2-
#[cfg(target_arch = "x86")]
3-
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
4-
#[cfg(target_arch = "x86_64")]
5-
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
6-
}
71
pub mod errors_h {
82
pub const SILK_ENC_PACKET_SIZE_NOT_SUPPORTED: i32 = -(103);
93
pub const SILK_NO_ERROR: i32 = 0;
@@ -41,7 +35,6 @@ pub mod typedef_h {
4135
pub const silk_int16_MAX: i32 = i16::MAX as i32;
4236
}
4337
use self::errors_h::{SILK_ENC_PACKET_SIZE_NOT_SUPPORTED, SILK_NO_ERROR};
44-
pub use self::typedef_h::{silk_int16_MAX, silk_int16_MIN};
4538
pub use self::SigProc_FLP_h::{silk_float2short_array, silk_short2float_array};
4639
use crate::externs::memset;
4740
use crate::silk::control_audio_bandwidth::silk_control_audio_bandwidth;

src/silk/float/find_LPC_FLP.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ pub mod typedef_h {
99
pub mod internal {
1010
pub const __FLT_MAX__: f32 = 3.40282347e+38f32;
1111
}
12-
pub use self::float_h::FLT_MAX;
13-
pub use self::internal::__FLT_MAX__;
1412
pub use self::typedef_h::silk_float_MAX;
1513
use crate::silk::define::MAX_NB_SUBFR;
1614
use crate::silk::float::burg_modified_FLP::silk_burg_modified_FLP;

src/silk/float/pitch_analysis_core_FLP.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
pub mod arch_h {
22
pub type opus_val32 = f32;
33
}
4-
pub mod xmmintrin_h {
5-
#[cfg(target_arch = "x86")]
6-
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
7-
#[cfg(target_arch = "x86_64")]
8-
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
9-
}
104
pub mod SigProc_FLP_h {
115
#[inline]
126
pub unsafe fn silk_float2short_array(out: *mut i16, in_0: *const f32, length: i32) {

src/silk/float/wrappers_FLP.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
use crate::silk::A2NLSF::silk_A2NLSF;
22
use crate::silk::NLSF2A::silk_NLSF2A;
33

4-
pub mod xmmintrin_h {
5-
#[cfg(target_arch = "x86")]
6-
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
7-
#[cfg(target_arch = "x86_64")]
8-
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
9-
}
104
pub mod SigProc_FLP_h {
115
#[inline]
126
pub unsafe fn silk_float2int(x: f32) -> i32 {

src/silk/resampler/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ enum ResamplerMode {
101101
DownFir(ResamplerDownFirParams, ResamplerDownFirState),
102102
}
103103

104-
#[derive(Copy, Clone)]
105-
#[repr(C)]
106-
pub union sFIR_union {
107-
pub i32_0: [i32; SILK_RESAMPLER_MAX_FIR_ORDER],
108-
pub i16_0: [i16; SILK_RESAMPLER_MAX_FIR_ORDER],
109-
}
110-
111104
pub fn silk_resampler_init(Fs_Hz_in: i32, Fs_Hz_out: i32, forEnc: i32) -> ResamplerState {
112105
let inputDelay = if forEnc != 0 {
113106
if !matches!(Fs_Hz_in, 8000 | 12000 | 16000 | 24000 | 48000)

src/src/analysis.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ pub const ANALYSIS_BUF_SIZE: i32 = 720;
6666
pub const DETECT_SIZE: i32 = 100;
6767
pub const NB_FRAMES: i32 = 8;
6868
pub const NB_TBANDS: i32 = 18;
69-
pub mod xmmintrin_h {
70-
#[cfg(target_arch = "x86")]
71-
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
72-
#[cfg(target_arch = "x86_64")]
73-
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
74-
}
7569
pub mod math_h {
7670
pub const M_PI: f64 = 3.14159265358979323846f64;
7771
}

src/src/mapping_matrix.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ pub mod arch_h {
22
pub type opus_val16 = f32;
33
pub type opus_val32 = f32;
44
}
5-
pub mod xmmintrin_h {
6-
#[cfg(target_arch = "x86")]
7-
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
8-
#[cfg(target_arch = "x86_64")]
9-
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
10-
}
11-
pub use self::arch_h::{opus_val16, opus_val32};
5+
use self::arch_h::{opus_val16, opus_val32};
126
use crate::celt::float_cast::FLOAT2INT16;
137
use crate::src::opus_private::align;
148

src/src/opus_decoder.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ pub mod stddef_h {
88
pub type size_t = u64;
99
pub const NULL: i32 = 0;
1010
}
11-
pub mod xmmintrin_h {
12-
#[cfg(target_arch = "x86")]
13-
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
14-
#[cfg(target_arch = "x86_64")]
15-
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
16-
}
1711
pub mod cpu_support_h {
1812
#[inline]
1913
pub unsafe fn opus_select_arch() -> i32 {

src/src/opus_encoder.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ pub mod stddef_h {
1212
pub type size_t = u64;
1313
pub const NULL: i32 = 0;
1414
}
15-
pub mod xmmintrin_h {
16-
#[cfg(target_arch = "x86")]
17-
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
18-
#[cfg(target_arch = "x86_64")]
19-
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
20-
}
2115
pub mod cpu_support_h {
2216
#[inline]
2317
pub unsafe fn opus_select_arch() -> i32 {

src/src/opus_multistream_decoder.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ pub mod stddef_h {
2525
pub type size_t = u64;
2626
pub const NULL: i32 = 0;
2727
}
28-
pub mod xmmintrin_h {
29-
#[cfg(target_arch = "x86")]
30-
pub use core::arch::x86::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
31-
#[cfg(target_arch = "x86_64")]
32-
pub use core::arch::x86_64::{__m128, _mm_cvt_ss2si, _mm_cvtss_si32, _mm_set_ss};
33-
}
3428
use self::arch_h::opus_val16;
3529
pub use self::stddef_h::{size_t, NULL};
3630
use crate::celt::float_cast::FLOAT2INT16;

unsafe-libopus-tools/src/demo/backend.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
use ::unsafe_libopus::varargs::VarArgs;
55

6-
pub struct Encoder([u8; 1]);
7-
pub struct Decoder([u8; 1]);
6+
pub struct Encoder(());
7+
pub struct Decoder(());
88

99
pub trait OpusBackend {
1010
unsafe fn opus_encoder_create(

0 commit comments

Comments
 (0)