1
1
use crate :: api:: FrameQueue ;
2
+ use crate :: util:: Aligned ;
2
3
use crate :: EncoderStatus ;
3
4
use arrayvec:: ArrayVec ;
4
5
use ndarray:: { Array3 , ArrayView3 , ArrayViewMut3 } ;
@@ -8,7 +9,6 @@ use ndrustfft::{
8
9
use std:: collections:: { BTreeMap , VecDeque } ;
9
10
use std:: f64:: consts:: PI ;
10
11
use std:: iter:: once;
11
- use std:: marker:: PhantomData ;
12
12
use std:: mem:: size_of;
13
13
use std:: ptr:: copy_nonoverlapping;
14
14
use std:: sync:: Arc ;
@@ -43,10 +43,10 @@ where
43
43
pad_dimensions : ArrayVec < ( usize , usize ) , 3 > ,
44
44
effective_heights : ArrayVec < usize , 3 > ,
45
45
46
- hw : [ f32 ; BLOCK_VOLUME ] ,
47
- dftgc : [ Complex < f32 > ; COMPLEX_COUNT ] ,
46
+ hw : Aligned < [ f32 ; BLOCK_VOLUME ] > ,
47
+ dftgc : Aligned < [ Complex < f32 > ; COMPLEX_COUNT ] > ,
48
48
fft : ( R2cFftHandler < f32 > , FftHandler < f32 > , FftHandler < f32 > ) ,
49
- sigmas : [ f32 ; CCNT2 ] ,
49
+ sigmas : Aligned < [ f32 ; CCNT2 ] > ,
50
50
51
51
// This stores a copy of the unfiltered previous frame,
52
52
// since in `frame_q` it will be filtered already.
55
55
// code changes.
56
56
frame_buffer : VecDeque < Arc < Frame < T > > > ,
57
57
pub ( crate ) cur_frameno : u64 ,
58
-
59
- _t : PhantomData < T > ,
60
58
}
61
59
62
60
impl < T > DftDenoiser < T >
95
93
effective_heights. push ( e_h) ;
96
94
}
97
95
98
- let hw = Self :: create_window ( ) ;
99
- let mut dftgr = [ 0f32 ; BLOCK_VOLUME ] ;
96
+ let hw = Aligned :: new ( Self :: create_window ( ) ) ;
97
+ let mut dftgr = Aligned :: new ( [ 0f32 ; BLOCK_VOLUME ] ) ;
100
98
101
99
let fft = (
102
100
R2cFftHandler :: new ( SB_SIZE ) ,
@@ -111,7 +109,7 @@ where
111
109
}
112
110
let wscale = 1.0 / wscale;
113
111
114
- let mut sigmas = [ 0f32 ; CCNT2 ] ;
112
+ let mut sigmas = Aligned :: new ( [ 0f32 ; CCNT2 ] ) ;
115
113
sigmas. fill ( sigma / wscale) ;
116
114
117
115
let mut denoiser = DftDenoiser {
@@ -124,13 +122,12 @@ where
124
122
hw,
125
123
fft,
126
124
sigmas,
127
- dftgc : [ Complex :: default ( ) ; COMPLEX_COUNT ] ,
125
+ dftgc : Aligned :: new ( [ Complex :: default ( ) ; COMPLEX_COUNT ] ) ,
128
126
frame_buffer : VecDeque :: with_capacity ( TB_MIDPOINT ) ,
129
127
cur_frameno : 0 ,
130
- _t : PhantomData :: < T > :: default ( ) ,
131
128
} ;
132
129
133
- let mut dftgc = [ Complex :: default ( ) ; COMPLEX_COUNT ] ;
130
+ let mut dftgc = Aligned :: new ( [ Complex :: default ( ) ; COMPLEX_COUNT ] ) ;
134
131
denoiser. real_to_complex_3d ( & dftgr, & mut dftgc) ;
135
132
denoiser. dftgc = dftgc;
136
133
0 commit comments