X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;ds=sidebyside;f=nihav-realmedia%2Fsrc%2Fcodecs%2Frv40dsp.rs;h=403208e401153d9af12929a9513410eba70a683b;hb=f84129ed62be62e762f11202e8c78530a46be999;hp=c2841dfc1ec71d2f638e39e371aeec15a04ea27c;hpb=1a967e6bad5f17943b4de0607078eb940ad5adfe;p=nihav.git diff --git a/nihav-realmedia/src/codecs/rv40dsp.rs b/nihav-realmedia/src/codecs/rv40dsp.rs index c2841df..403208e 100644 --- a/nihav-realmedia/src/codecs/rv40dsp.rs +++ b/nihav-realmedia/src/codecs/rv40dsp.rs @@ -1,6 +1,6 @@ use nihav_core::frame::{FrameType, NAVideoBuffer}; -use nihav_core::codecs::MV; -use nihav_core::codecs::blockdsp::edge_emu; +use nihav_codec_support::codecs::MV; +use nihav_codec_support::codecs::blockdsp::edge_emu; use super::rv3040::{RV34DSP, RV34MBInfo}; fn clip8(a: i16) -> u8 { @@ -38,6 +38,12 @@ macro_rules! filter { -5 * el!($s, $o + 2 * $step) + el!($s, $o + 3 * $step) + 32) >> 6) as i16) ); + (33; $s: ident, $o: expr, $stride: expr) => ( + clip8((( el!($s, $o) + + el!($s, $o + 1) + + el!($s, $o + $stride) + + el!($s, $o + 1 + $stride) + 2) >> 2) as i16) + ); } macro_rules! mc_func { @@ -130,6 +136,15 @@ macro_rules! mc_func { $ofilt(dst, didx, dstride, &buf, 2*bstride, $size); } ); + (mc33; $name: ident, $size: expr) => ( + fn $name (dst: &mut [u8], mut didx: usize, dstride: usize, src: &[u8], mut sidx: usize, sstride: usize) { + for _ in 0..$size { + for x in 0..$size { dst[didx + x] = filter!(33; src, sidx + x, sstride); } + sidx += sstride; + didx += dstride; + } + } + ); } mc_func!(copy; copy_16, 16); mc_func!(copy; copy_8, 8); @@ -161,8 +176,8 @@ mc_func!(cm03; luma_mc_31_16, 16, luma_mc_01_16); mc_func!(cm03; luma_mc_31_8, 8, luma_mc_01_8); mc_func!(cm03; luma_mc_32_16, 16, luma_mc_02_16); mc_func!(cm03; luma_mc_32_8, 8, luma_mc_02_8); -mc_func!(cm03; luma_mc_33_16, 16, luma_mc_03_16); -mc_func!(cm03; luma_mc_33_8, 8, luma_mc_03_8); +mc_func!(mc33; luma_mc_33_16, 16); +mc_func!(mc33; luma_mc_33_8, 8); const RV40_CHROMA_BIAS: [[u16; 4]; 4] = [ [ 0, 4, 8, 4 ], @@ -299,6 +314,7 @@ fn rv40_weak_loop_filter4_h(pix: &mut [u8], off: usize, stride: usize, lim_p0q0: i16, lim_p1: i16, lim_q1: i16) { rv40_weak_loop_filter4(pix, off, stride, 1, filter_p1, filter_q1, alpha, beta, lim_p0q0, lim_p1, lim_q1); } +#[allow(clippy::eq_op)] fn rv40_weak_loop_filter4_v(pix: &mut [u8], off: usize, stride: usize, filter_p1: bool, filter_q1: bool, alpha: i16, beta: i16, lim_p0q0: i16, lim_p1: i16, lim_q1: i16) { @@ -364,7 +380,7 @@ fn sfilter(a: i16, b: i16, c: i16, d: i16, e: i16, dither: i16, clip: bool, lims } else if val > c + lims { c + lims } else { - c + val } } else { val @@ -457,6 +473,7 @@ fn rv40_loop_strength_h(pix: &[u8], off: usize, stride: usize, rv40_loop_strength(pix, off, stride, 1, beta, beta2, edge) } +#[allow(clippy::eq_op)] fn rv40_loop_strength_v(pix: &[u8], off: usize, stride: usize, beta: i16, beta2: i16, edge: bool) -> (bool, bool, bool) { let src = &pix[off - 3..][..stride * 3 + 3 + 3]; @@ -564,7 +581,7 @@ const RV40_EDGE1: [isize; 4] = [ 0, 2, 2, 2 ]; const RV40_EDGE2: [isize; 4] = [ 0, 3, 3, 3 ]; impl RV34DSP for RV40DSP { - fn loop_filter(&self, frame: &mut NAVideoBuffer, _ftype: FrameType, mbinfo: &[RV34MBInfo], mb_w: usize, row: usize) { + fn loop_filter(&self, frame: &mut NAVideoBuffer, _ftype: FrameType, mbinfo: &[RV34MBInfo], mb_w: usize, mb_h: usize, row: usize) { // todo proper B-frame filtering? let mut offs: [usize; 3] = [0; 3]; let mut stride: [usize; 3] = [0; 3];