Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
up-sampler: Take fixed sizes slices to ensure write is in bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
etemesi254 committed Jul 2, 2022
1 parent cf96e8b commit 1f92bac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/upsampler/avx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ pub unsafe fn upsample_hv_avx(input: &[i16], output_len: usize) -> Vec<i16>

let cn = _mm256_srai_epi16::<2>(_mm256_add_epi16(an, bn));

_mm256_storeu_si256(output.get_mut(output_position+$stride..).unwrap().as_mut_ptr().cast(), cn);
_mm256_storeu_si256(output.get_mut(output_position+$stride..output_position+$stride+16).unwrap().as_mut_ptr().cast(), cn);


let nn = _mm256_blend_epi16::<0b1010_1010>(prev_hi, next_hi);
Expand All @@ -190,7 +190,7 @@ pub unsafe fn upsample_hv_avx(input: &[i16], output_len: usize) -> Vec<i16>

let cn = _mm256_srai_epi16::<2>(_mm256_add_epi16(an, bn));
// hi is stored one output width lower.
_mm256_storeu_si256(output.get_mut(output_position+$stride+16..).unwrap().as_mut_ptr().cast(), cn);
_mm256_storeu_si256(output.get_mut(output_position+$stride+16..output_position+$stride+32).unwrap().as_mut_ptr().cast(), cn);


};
Expand Down

0 comments on commit 1f92bac

Please sign in to comment.