Last active
February 14, 2020 00:44
-
-
Save lu-zero/b13880c6c9a3d15e6657809d1b13dd37 to your computer and use it in GitHub Desktop.
Make cdef_filter_superblock not care about fi, while keeping the generated code tiny.
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
diff --git a/src/cdef.rs b/src/cdef.rs | |
index 6d55b195..a1f1df50 100644 | |
--- a/src/cdef.rs | |
+++ b/src/cdef.rs | |
@@ -425,17 +425,40 @@ pub fn cdef_sb_padded_frame_copy<T: Pixel>( | |
// We assume in is padded, and the area we'll write out is at least as | |
// large as the unpadded area of in | |
// cdef_index is taken from the block context | |
-pub fn cdef_filter_superblock<T: Pixel>( | |
- fi: &FrameInvariants<T>, in_frame: &Frame<u16>, out_frame: &mut Frame<T>, | |
+pub fn cdef_filter_superblock<T: Pixel, F: Pixel>( | |
+ fi: &FrameInvariants<F>, in_frame: &Frame<u16>, out_frame: &mut Frame<T>, | |
blocks: &TileBlocks<'_>, sbo: TileSuperBlockOffset, | |
sbo_global: TileSuperBlockOffset, cdef_index: u8, | |
cdef_dirs: &CdefDirections, | |
) { | |
let bit_depth = fi.sequence.bit_depth; | |
- let coeff_shift = fi.sequence.bit_depth as i32 - 8; | |
let cdef_damping = fi.cdef_damping as i32; | |
let cdef_y_strength = fi.cdef_y_strengths[cdef_index as usize]; | |
let cdef_uv_strength = fi.cdef_uv_strengths[cdef_index as usize]; | |
+ | |
+ cdef_filter_superblock_frame( | |
+ in_frame, | |
+ out_frame, | |
+ blocks, | |
+ sbo, | |
+ sbo_global, | |
+ cdef_dirs, | |
+ bit_depth, | |
+ cdef_damping, | |
+ cdef_y_strength, | |
+ cdef_uv_strength, | |
+ fi.cpu_feature_level, | |
+ ) | |
+} | |
+ | |
+fn cdef_filter_superblock_frame<T: Pixel>( | |
+ in_frame: &Frame<u16>, out_frame: &mut Frame<T>, blocks: &TileBlocks<'_>, | |
+ sbo: TileSuperBlockOffset, sbo_global: TileSuperBlockOffset, | |
+ cdef_dirs: &CdefDirections, bit_depth: usize, cdef_damping: i32, | |
+ cdef_y_strength: u8, cdef_uv_strength: u8, | |
+ cpu_feature_level: CpuFeatureLevel, | |
+) { | |
+ let coeff_shift = bit_depth as i32 - 8; | |
let cdef_pri_y_strength = (cdef_y_strength / CDEF_SEC_STRENGTHS) as i32; | |
let mut cdef_sec_y_strength = (cdef_y_strength % CDEF_SEC_STRENGTHS) as i32; | |
let cdef_pri_uv_strength = (cdef_uv_strength / CDEF_SEC_STRENGTHS) as i32; | |
@@ -526,7 +549,7 @@ pub fn cdef_filter_superblock<T: Pixel>( | |
bit_depth, | |
xdec, | |
ydec, | |
- fi.cpu_feature_level, | |
+ cpu_feature_level, | |
); | |
} | |
} else { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment