Commit 5155f460 authored by Adrien Maglo's avatar Adrien Maglo Committed by Thomas Daede

motion estimation: Use a macro to declare ASM SAD functions

parent 70005e35
......@@ -31,88 +31,38 @@ mod nasm {
use libc;
extern {
fn rav1e_sad_4x4_hbd_ssse3(
src: *const u16, src_stride: libc::ptrdiff_t, dst: *const u16,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad_8x8_hbd10_ssse3(
src: *const u16, src_stride: libc::ptrdiff_t, dst: *const u16,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad_16x16_hbd_ssse3(
src: *const u16, src_stride: libc::ptrdiff_t, dst: *const u16,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad_32x32_hbd10_ssse3(
src: *const u16, src_stride: libc::ptrdiff_t, dst: *const u16,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad_64x64_hbd10_ssse3(
src: *const u16, src_stride: libc::ptrdiff_t, dst: *const u16,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad_128x128_hbd10_ssse3(
src: *const u16, src_stride: libc::ptrdiff_t, dst: *const u16,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad4x4_sse2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad8x8_sse2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad16x16_sse2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad32x32_sse2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad64x64_sse2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad128x128_sse2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad16x16_avx2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad32x32_avx2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad64x64_avx2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
fn rav1e_sad128x128_avx2(
src: *const u8, src_stride: libc::ptrdiff_t, dst: *const u8,
dst_stride: libc::ptrdiff_t
) -> u32;
macro_rules! declare_asm_sad {
($(($name: ident, $T: ident)),+) => (
$(
extern { fn $name (
src: *const $T, src_stride: libc::ptrdiff_t, dst: *const $T,
dst_stride: libc::ptrdiff_t
) -> u32; }
)+
)
}
declare_asm_sad![
(rav1e_sad_4x4_hbd_ssse3, u16),
(rav1e_sad_8x8_hbd10_ssse3, u16),
(rav1e_sad_16x16_hbd_ssse3, u16),
(rav1e_sad_32x32_hbd10_ssse3, u16),
(rav1e_sad_64x64_hbd10_ssse3, u16),
(rav1e_sad_128x128_hbd10_ssse3, u16),
(rav1e_sad4x4_sse2, u8),
(rav1e_sad8x8_sse2, u8),
(rav1e_sad16x16_sse2, u8),
(rav1e_sad32x32_sse2, u8),
(rav1e_sad64x64_sse2, u8),
(rav1e_sad128x128_sse2, u8),
(rav1e_sad16x16_avx2, u8),
(rav1e_sad32x32_avx2, u8),
(rav1e_sad64x64_avx2, u8),
(rav1e_sad128x128_avx2, u8)
];
#[target_feature(enable = "ssse3")]
unsafe fn sad_hbd_ssse3(
plane_org: &PlaneSlice<'_, u16>, plane_ref: &PlaneSlice<'_, u16>, blk_h: usize,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment