Commit 3a96bab9 authored by Thomas Daede's avatar Thomas Daede

Call assembly functions on Windows.

parent 753ef48b
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
// Media Patent License 1.0 was not distributed with this source code in the // Media Patent License 1.0 was not distributed with this source code in the
// PATENTS file, you can obtain it at www.aomedia.org/license/patent. // PATENTS file, you can obtain it at www.aomedia.org/license/patent.
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
pub use self::nasm::*; pub use self::nasm::*;
#[cfg(any(not(target_arch = "x86_64"), windows, not(feature = "nasm")))] #[cfg(any(not(target_arch = "x86_64"), not(feature = "nasm")))]
pub use self::native::*; pub use self::native::*;
use crate::util::Pixel; use crate::util::Pixel;
...@@ -135,7 +135,7 @@ const SUBPEL_FILTERS: [[[i32; SUBPEL_FILTER_SIZE]; 16]; 6] = [ ...@@ -135,7 +135,7 @@ const SUBPEL_FILTERS: [[[i32; SUBPEL_FILTER_SIZE]; 16]; 6] = [
] ]
]; ];
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
mod nasm { mod nasm {
use super::*; use super::*;
use crate::plane::*; use crate::plane::*;
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
// Media Patent License 1.0 was not distributed with this source code in the // Media Patent License 1.0 was not distributed with this source code in the
// PATENTS file, you can obtain it at www.aomedia.org/license/patent. // PATENTS file, you can obtain it at www.aomedia.org/license/patent.
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
pub use self::nasm::get_sad; pub use self::nasm::get_sad;
#[cfg(any(not(target_arch = "x86_64"), windows, not(feature = "nasm")))] #[cfg(any(not(target_arch = "x86_64"), not(feature = "nasm")))]
pub use self::native::get_sad; pub use self::native::get_sad;
use crate::context::{BlockOffset, BLOCK_TO_PLANE_SHIFT, MI_SIZE}; use crate::context::{BlockOffset, BLOCK_TO_PLANE_SHIFT, MI_SIZE};
use crate::encoder::ReferenceFrame; use crate::encoder::ReferenceFrame;
...@@ -21,7 +21,7 @@ use crate::util::Pixel; ...@@ -21,7 +21,7 @@ use crate::util::Pixel;
use std::sync::Arc; use std::sync::Arc;
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
mod nasm { mod nasm {
use crate::plane::*; use crate::plane::*;
use crate::util::*; use crate::util::*;
...@@ -169,7 +169,7 @@ mod nasm { ...@@ -169,7 +169,7 @@ mod nasm {
plane_org: &PlaneSlice<'_, T>, plane_ref: &PlaneSlice<'_, T>, blk_h: usize, plane_org: &PlaneSlice<'_, T>, plane_ref: &PlaneSlice<'_, T>, blk_h: usize,
blk_w: usize, bit_depth: usize blk_w: usize, bit_depth: usize
) -> u32 { ) -> u32 {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if mem::size_of::<T>() == 2 && is_x86_feature_detected!("ssse3") && blk_h >= 4 && blk_w >= 4 { if mem::size_of::<T>() == 2 && is_x86_feature_detected!("ssse3") && blk_h >= 4 && blk_w >= 4 {
return unsafe { return unsafe {
......
...@@ -14,14 +14,14 @@ use crate::partition::*; ...@@ -14,14 +14,14 @@ use crate::partition::*;
use crate::plane::*; use crate::plane::*;
use crate::util::*; use crate::util::*;
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
use libc; use libc;
#[cfg(target_arch = "x86")] #[cfg(target_arch = "x86")]
use std::arch::x86::*; use std::arch::x86::*;
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*; use std::arch::x86_64::*;
use std::mem::*; use std::mem::*;
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
use std::ptr; use std::ptr;
pub static RAV1E_INTRA_MODES: &'static [PredictionMode] = &[ pub static RAV1E_INTRA_MODES: &'static [PredictionMode] = &[
...@@ -157,7 +157,7 @@ fn get_scaled_luma_q0(alpha_q3: i16, ac_pred_q3: i16) -> i32 { ...@@ -157,7 +157,7 @@ fn get_scaled_luma_q0(alpha_q3: i16, ac_pred_q3: i16) -> i32 {
} }
} }
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
macro_rules! decl_angular_ipred_fn { macro_rules! decl_angular_ipred_fn {
($f:ident) => { ($f:ident) => {
extern { extern {
...@@ -169,28 +169,28 @@ macro_rules! decl_angular_ipred_fn { ...@@ -169,28 +169,28 @@ macro_rules! decl_angular_ipred_fn {
}; };
} }
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_dc_avx2); decl_angular_ipred_fn!(rav1e_ipred_dc_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_dc_128_avx2); decl_angular_ipred_fn!(rav1e_ipred_dc_128_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_dc_left_avx2); decl_angular_ipred_fn!(rav1e_ipred_dc_left_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_dc_top_avx2); decl_angular_ipred_fn!(rav1e_ipred_dc_top_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_h_avx2); decl_angular_ipred_fn!(rav1e_ipred_h_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_v_avx2); decl_angular_ipred_fn!(rav1e_ipred_v_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_paeth_avx2); decl_angular_ipred_fn!(rav1e_ipred_paeth_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_smooth_avx2); decl_angular_ipred_fn!(rav1e_ipred_smooth_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_smooth_h_avx2); decl_angular_ipred_fn!(rav1e_ipred_smooth_h_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_angular_ipred_fn!(rav1e_ipred_smooth_v_avx2); decl_angular_ipred_fn!(rav1e_ipred_smooth_v_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
macro_rules! decl_cfl_pred_fn { macro_rules! decl_cfl_pred_fn {
($f:ident) => { ($f:ident) => {
extern { extern {
...@@ -203,13 +203,13 @@ macro_rules! decl_cfl_pred_fn { ...@@ -203,13 +203,13 @@ macro_rules! decl_cfl_pred_fn {
}; };
} }
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_cfl_pred_fn!(rav1e_ipred_cfl_avx2); decl_cfl_pred_fn!(rav1e_ipred_cfl_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_cfl_pred_fn!(rav1e_ipred_cfl_128_avx2); decl_cfl_pred_fn!(rav1e_ipred_cfl_128_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_cfl_pred_fn!(rav1e_ipred_cfl_left_avx2); decl_cfl_pred_fn!(rav1e_ipred_cfl_left_avx2);
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
decl_cfl_pred_fn!(rav1e_ipred_cfl_top_avx2); decl_cfl_pred_fn!(rav1e_ipred_cfl_top_avx2);
pub trait Intra<T>: Dim pub trait Intra<T>: Dim
...@@ -217,7 +217,7 @@ where ...@@ -217,7 +217,7 @@ where
T: Pixel, T: Pixel,
{ {
fn pred_dc(output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T]) { fn pred_dc(output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T]) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -245,7 +245,7 @@ where ...@@ -245,7 +245,7 @@ where
} }
fn pred_dc_128(output: &mut PlaneMutSlice<'_, T>, bit_depth: usize) { fn pred_dc_128(output: &mut PlaneMutSlice<'_, T>, bit_depth: usize) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -269,7 +269,7 @@ where ...@@ -269,7 +269,7 @@ where
} }
fn pred_dc_left(output: &mut PlaneMutSlice<'_, T>, _above: &[T], left: &[T]) { fn pred_dc_left(output: &mut PlaneMutSlice<'_, T>, _above: &[T], left: &[T]) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -292,7 +292,7 @@ where ...@@ -292,7 +292,7 @@ where
} }
fn pred_dc_top(output: &mut PlaneMutSlice<'_, T>, above: &[T], _left: &[T]) { fn pred_dc_top(output: &mut PlaneMutSlice<'_, T>, above: &[T], _left: &[T]) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -315,7 +315,7 @@ where ...@@ -315,7 +315,7 @@ where
} }
fn pred_h(output: &mut PlaneMutSlice<'_, T>, left: &[T]) { fn pred_h(output: &mut PlaneMutSlice<'_, T>, left: &[T]) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -340,7 +340,7 @@ where ...@@ -340,7 +340,7 @@ where
} }
fn pred_v(output: &mut PlaneMutSlice<'_, T>, above: &[T]) { fn pred_v(output: &mut PlaneMutSlice<'_, T>, above: &[T]) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -364,7 +364,7 @@ where ...@@ -364,7 +364,7 @@ where
output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T], output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T],
above_left: T above_left: T
) { ) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -407,7 +407,7 @@ where ...@@ -407,7 +407,7 @@ where
fn pred_smooth( fn pred_smooth(
output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T] output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T]
) { ) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -471,7 +471,7 @@ where ...@@ -471,7 +471,7 @@ where
fn pred_smooth_h( fn pred_smooth_h(
output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T] output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T]
) { ) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -521,7 +521,7 @@ where ...@@ -521,7 +521,7 @@ where
fn pred_smooth_v( fn pred_smooth_v(
output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T] output: &mut PlaneMutSlice<'_, T>, above: &[T], left: &[T]
) { ) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -657,7 +657,7 @@ where ...@@ -657,7 +657,7 @@ where
output: &mut PlaneMutSlice<'_, T>, ac: &[i16], alpha: i16, bit_depth: usize, output: &mut PlaneMutSlice<'_, T>, ac: &[i16], alpha: i16, bit_depth: usize,
above: &[T], left: &[T] above: &[T], left: &[T]
) { ) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -680,7 +680,7 @@ where ...@@ -680,7 +680,7 @@ where
fn pred_cfl_128( fn pred_cfl_128(
output: &mut PlaneMutSlice<'_, T>, ac: &[i16], alpha: i16, bit_depth: usize output: &mut PlaneMutSlice<'_, T>, ac: &[i16], alpha: i16, bit_depth: usize
) { ) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -704,7 +704,7 @@ where ...@@ -704,7 +704,7 @@ where
output: &mut PlaneMutSlice<'_, T>, ac: &[i16], alpha: i16, bit_depth: usize, output: &mut PlaneMutSlice<'_, T>, ac: &[i16], alpha: i16, bit_depth: usize,
above: &[T], left: &[T] above: &[T], left: &[T]
) { ) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
...@@ -728,7 +728,7 @@ where ...@@ -728,7 +728,7 @@ where
output: &mut PlaneMutSlice<'_, T>, ac: &[i16], alpha: i16, bit_depth: usize, output: &mut PlaneMutSlice<'_, T>, ac: &[i16], alpha: i16, bit_depth: usize,
above: &[T], left: &[T] above: &[T], left: &[T]
) { ) {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
{ {
if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") { if size_of::<T>() == 1 && is_x86_feature_detected!("avx2") {
return unsafe { return unsafe {
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
// Media Patent License 1.0 was not distributed with this source code in the // Media Patent License 1.0 was not distributed with this source code in the
// PATENTS file, you can obtain it at www.aomedia.org/license/patent. // PATENTS file, you can obtain it at www.aomedia.org/license/patent.
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
pub use self::nasm::*; pub use self::nasm::*;
#[cfg(any(not(target_arch = "x86_64"), windows, not(feature = "nasm")))] #[cfg(any(not(target_arch = "x86_64"), not(feature = "nasm")))]
pub use self::native::*; pub use self::native::*;
// TODO: move 1d txfm code to native module. // TODO: move 1d txfm code to native module.
...@@ -1506,7 +1506,7 @@ static INV_TXFM_FNS: [[fn(&[i32], &mut [i32], usize); 5]; 4] = [ ...@@ -1506,7 +1506,7 @@ static INV_TXFM_FNS: [[fn(&[i32], &mut [i32], usize); 5]; 4] = [
[av1_iidentity4, av1_iidentity8, av1_iidentity16, av1_iidentity32, |_, _, _| unimplemented!()] [av1_iidentity4, av1_iidentity8, av1_iidentity16, av1_iidentity32, |_, _, _| unimplemented!()]
]; ];
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))] #[cfg(all(target_arch = "x86_64", feature = "nasm"))]
mod nasm { mod nasm {
use super::*; use super::*;
use crate::partition::TxType; use crate::partition::TxType;
......
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