-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
503 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (c) Radzivon Bartoshyk. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
use crate::convolution::{HorizontalConvolutionPass, VerticalConvolutionPass}; | ||
use crate::convolve_naive_f32::{ | ||
convolve_horizontal_rgb_native_row, convolve_horizontal_rgba_4_row_f32, | ||
}; | ||
use crate::dispatch_group_f32::{convolve_horizontal_dispatch_f32, convolve_vertical_dispatch_f32}; | ||
use crate::filter_weights::{FilterBounds, FilterWeights}; | ||
use crate::rgb_f32::convolve_vertical_rgb_native_row_f32; | ||
use crate::ImageStore; | ||
use rayon::ThreadPool; | ||
|
||
impl<'a> HorizontalConvolutionPass<f32, 1> for ImageStore<'a, f32, 1> { | ||
#[inline(always)] | ||
fn convolve_horizontal( | ||
&self, | ||
filter_weights: FilterWeights<f32>, | ||
destination: &mut ImageStore<f32, 1>, | ||
pool: &Option<ThreadPool>, | ||
) { | ||
let _dispatcher_4_rows: Option< | ||
fn(usize, usize, &FilterWeights<f32>, *const f32, usize, *mut f32, usize), | ||
> = Some(convolve_horizontal_rgba_4_row_f32::<f32, 1>); | ||
let _dispatcher_row: fn(usize, usize, &FilterWeights<f32>, *const f32, *mut f32) = | ||
convolve_horizontal_rgb_native_row::<f32, 1>; | ||
convolve_horizontal_dispatch_f32( | ||
self, | ||
filter_weights, | ||
destination, | ||
pool, | ||
_dispatcher_4_rows, | ||
_dispatcher_row, | ||
); | ||
} | ||
} | ||
|
||
impl<'a> VerticalConvolutionPass<f32, 1> for ImageStore<'a, f32, 1> { | ||
fn convolve_vertical( | ||
&self, | ||
filter_weights: FilterWeights<f32>, | ||
destination: &mut ImageStore<f32, 1>, | ||
pool: &Option<ThreadPool>, | ||
) { | ||
let _dispatcher: fn(usize, &FilterBounds, *const f32, *mut f32, usize, *const f32) = | ||
convolve_vertical_rgb_native_row_f32::<f32, 1>; | ||
convolve_vertical_dispatch_f32(self, filter_weights, destination, pool, _dispatcher); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright (c) Radzivon Bartoshyk. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
use rayon::ThreadPool; | ||
|
||
use crate::convolution::{HorizontalConvolutionPass, VerticalConvolutionPass}; | ||
use crate::convolve_naive_u8::convolve_horizontal_rgba_native_row; | ||
use crate::dispatch_group_u8::{convolve_horizontal_dispatch_u8, convolve_vertical_dispatch_u8}; | ||
use crate::filter_weights::{FilterBounds, FilterWeights}; | ||
use crate::rgb_u8::convolve_vertical_rgb_native_row_u8; | ||
use crate::ImageStore; | ||
|
||
impl<'a> HorizontalConvolutionPass<u8, 1> for ImageStore<'a, u8, 1> { | ||
fn convolve_horizontal( | ||
&self, | ||
filter_weights: FilterWeights<f32>, | ||
destination: &mut ImageStore<u8, 1>, | ||
_pool: &Option<ThreadPool>, | ||
) { | ||
let _dispatcher_4_rows: Option< | ||
fn(usize, usize, &FilterWeights<i16>, *const u8, usize, *mut u8, usize), | ||
> = None; | ||
let _dispatcher_1_row: fn(usize, usize, &FilterWeights<i16>, *const u8, *mut u8) = | ||
convolve_horizontal_rgba_native_row::<1>; | ||
convolve_horizontal_dispatch_u8( | ||
self, | ||
filter_weights, | ||
destination, | ||
_pool, | ||
_dispatcher_4_rows, | ||
_dispatcher_1_row, | ||
); | ||
} | ||
} | ||
|
||
impl<'a> VerticalConvolutionPass<u8, 1> for ImageStore<'a, u8, 1> { | ||
fn convolve_vertical( | ||
&self, | ||
filter_weights: FilterWeights<f32>, | ||
destination: &mut ImageStore<u8, 1>, | ||
pool: &Option<ThreadPool>, | ||
) { | ||
let _dispatcher: fn( | ||
dst_width: usize, | ||
bounds: &FilterBounds, | ||
unsafe_source_ptr_0: *const u8, | ||
unsafe_destination_ptr_0: *mut u8, | ||
src_stride: usize, | ||
weight_ptr: *const i16, | ||
) = convolve_vertical_rgb_native_row_u8::<1>; | ||
convolve_vertical_dispatch_u8(self, filter_weights, destination, pool, _dispatcher); | ||
} | ||
} |
Oops, something went wrong.