aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2022-08-27 11:39:07 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2022-09-05 18:25:39 +0200
commit3c506c7a1c59ce83fea4fe8126ec05b098b7323d (patch)
treeb144f7889c694a54e7f400eed4f37c60a3d1830e
parentaa9bcf73e682c3836f6f2c4021396faec2e2ddf4 (diff)
downloadnihav-3c506c7a1c59ce83fea4fe8126ec05b098b7323d.tar.gz
h264/mc: add a stub for using optimised implementations
-rw-r--r--nihav-itu/src/codecs/h264/dsp/mc/debug.rs4
-rw-r--r--nihav-itu/src/codecs/h264/dsp/mc/mod.rs10
-rw-r--r--nihav-itu/src/codecs/h264/dsp/mc/release.rs4
3 files changed, 16 insertions, 2 deletions
diff --git a/nihav-itu/src/codecs/h264/dsp/mc/debug.rs b/nihav-itu/src/codecs/h264/dsp/mc/debug.rs
index 9f773ac..34d59da 100644
--- a/nihav-itu/src/codecs/h264/dsp/mc/debug.rs
+++ b/nihav-itu/src/codecs/h264/dsp/mc/debug.rs
@@ -251,3 +251,7 @@ pub const H264_LUMA_INTERP: &[[super::MCFunc; 16]; 3] = &[
h264_mc30_16, h264_mc31_16, h264_mc32_16, h264_mc33_16
]
];
+
+impl super::RegisterSIMD for super::H264MC {
+ fn register_simd(&mut self) {}
+}
diff --git a/nihav-itu/src/codecs/h264/dsp/mc/mod.rs b/nihav-itu/src/codecs/h264/dsp/mc/mod.rs
index 3ed248c..e2036cc 100644
--- a/nihav-itu/src/codecs/h264/dsp/mc/mod.rs
+++ b/nihav-itu/src/codecs/h264/dsp/mc/mod.rs
@@ -15,6 +15,10 @@ type MCFunc = fn (dst: &mut [u8], dstride: usize, src: &[u8], sstride: usize, h:
fn clip_u8(val: i16) -> u8 { val.max(0).min(255) as u8 }
+trait RegisterSIMD {
+ fn register_simd(&mut self);
+}
+
pub struct H264MC {
avg_buf: NAVideoBufferRef<u8>,
pub put_block_weighted: [fn (dst: &mut [u8], stride: usize, src: &[u8], h: usize, wparams: [i8; 3]); 4],
@@ -23,11 +27,13 @@ pub struct H264MC {
impl H264MC {
pub fn new(avg_buf: NAVideoBufferRef<u8>) -> Self {
- Self {
+ let mut obj = Self {
avg_buf,
put_block_weighted: [put_blk_w_2, put_blk_w_4, put_blk_w_8, put_blk_w_16],
put_block_weighted2: [put_blk_w2_2, put_blk_w2_4, put_blk_w2_8, put_blk_w2_16],
- }
+ };
+ obj.register_simd();
+ obj
}
pub fn do_mc(&mut self, frm: &mut NASimpleVideoFrame<u8>, refpic: NAVideoBufferRef<u8>, xpos: usize, ypos: usize, w: usize, h: usize, mv: MV) {
let mut ebuf = [0u8; 22 * 22];
diff --git a/nihav-itu/src/codecs/h264/dsp/mc/release.rs b/nihav-itu/src/codecs/h264/dsp/mc/release.rs
index 3a43500..0a521d0 100644
--- a/nihav-itu/src/codecs/h264/dsp/mc/release.rs
+++ b/nihav-itu/src/codecs/h264/dsp/mc/release.rs
@@ -323,3 +323,7 @@ pub const H264_LUMA_INTERP: &[[super::MCFunc; 16]; 3] = &[
h264_mc30_16, h264_mc31_16, h264_mc32_16, h264_mc33_16
]
];
+
+impl super::RegisterSIMD for super::H264MC {
+ fn register_simd(&mut self) {}
+}