Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,

leading to unnecesary copy on writes and reduced performance.
This commit is contained in:
Juan Linietsky
2017-11-25 00:07:54 -03:00
parent 7dfba3cda9
commit bc2e8d99e5
62 changed files with 148 additions and 147 deletions

View File

@ -68,7 +68,7 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A
unsigned int local_rb_pos = buffer_pos;
AudioFrame *dst_buff = p_dst_frames;
AudioFrame *rb_buff = audio_buffer.ptr();
AudioFrame *rb_buff = audio_buffer.ptrw();
double delay_msec = v.delay;
unsigned int delay_frames = Math::fast_ftoi((delay_msec / 1000.0) * mix_rate);

View File

@ -82,8 +82,8 @@ void AudioEffectDelayInstance::_process_chunk(const AudioFrame *p_src_frames, Au
const AudioFrame *src = p_src_frames;
AudioFrame *dst = p_dst_frames;
AudioFrame *rb_buf = ring_buffer.ptr();
AudioFrame *fb_buf = feedback_buffer.ptr();
AudioFrame *rb_buf = ring_buffer.ptrw();
AudioFrame *fb_buf = feedback_buffer.ptrw();
for (int i = 0; i < p_frame_count; i++) {

View File

@ -33,9 +33,9 @@
void AudioEffectEQInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
int band_count = bands[0].size();
EQ::BandProcess *proc_l = bands[0].ptr();
EQ::BandProcess *proc_r = bands[1].ptr();
float *bgain = gains.ptr();
EQ::BandProcess *proc_l = bands[0].ptrw();
EQ::BandProcess *proc_r = bands[1].ptrw();
float *bgain = gains.ptrw();
for (int i = 0; i < band_count; i++) {
bgain[i] = Math::db2linear(base->gain[i]);
}