Skip to content

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
chikuzen committed Sep 13, 2015
1 parent 6864051 commit 7e2a182
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions avisynth/src/edge_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ static inline void line_copy(float* dstp, const float* srcp, int width)
}


static inline __m128 mm_abs_ps(const __m128& val)
static __forceinline __m128 mm_abs_ps(const __m128& val)
{
const __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF));
return _mm_and_ps(val, mask);
}


static inline __m128 mm_ivtsign_ps(const __m128& val)
static __forceinline __m128 mm_ivtsign_ps(const __m128& val)
{
const __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x80000000));
return _mm_xor_ps(val, mask);
}


static inline __m128 mm_rcp_hq_ps(const __m128& xmm0)
static __forceinline __m128 mm_rcp_hq_ps(const __m128& xmm0)
{
__m128 rcp = _mm_rcp_ps(xmm0);
__m128 xmm1 = _mm_mul_ps(_mm_mul_ps(xmm0, rcp), rcp);
Expand All @@ -61,7 +61,7 @@ static inline __m128 mm_rcp_hq_ps(const __m128& xmm0)
}


static inline __m128i mm_calc_dir(const __m128& gx, const __m128& gy)
static __forceinline __m128i mm_calc_dir(const __m128& gx, const __m128& gy)
{
static const float t0225 = (float)(sqrt(2.0) - 1.0); // tan(pi/8)
static const float t0675 = (float)(sqrt(2.0) + 1.0); // tan(3*pi/8)
Expand Down Expand Up @@ -132,13 +132,13 @@ void __stdcall TCannyM::standerd_operator(int width, int height)

gx = _mm_add_ps(_mm_mul_ps(gx, gx), _mm_mul_ps(gy, gy));
gx = _mm_sqrt_ps(gx);
_mm_store_ps(dstp + x + i * 4, gx);
_mm_stream_ps(dstp + x + i * 4, gx);
}

d[0] = _mm_packs_epi32(d[0], d[1]);
d[1] = _mm_packs_epi32(d[2], d[3]);
d[0] = _mm_packs_epi16(d[0], d[1]);
_mm_store_si128((__m128i*)(dir + x), d[0]);
_mm_stream_si128((__m128i*)(dir + x), d[0]);
}
dstp += frame_pitch;
dir += frame_pitch;
Expand Down Expand Up @@ -191,13 +191,13 @@ void __stdcall TCannyM::sobel_operator(int width, int height)

gx = _mm_add_ps(_mm_mul_ps(gx, gx), _mm_mul_ps(gy, gy));
gx = _mm_sqrt_ps(gx);
_mm_store_ps(dstp + x + i * 4, gx);
_mm_stream_ps(dstp + x + i * 4, gx);
}

d[0] = _mm_packs_epi32(d[0], d[1]);
d[1] = _mm_packs_epi32(d[2], d[3]);
d[0] = _mm_packs_epi16(d[0], d[1]);
_mm_store_si128((__m128i*)(dir + x), d[0]);
_mm_stream_si128((__m128i*)(dir + x), d[0]);
}
dstp += frame_pitch;
dir += frame_pitch;
Expand Down
10 changes: 5 additions & 5 deletions avisynth/src/gaussian_blur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ convert_to_float(int width, int height, const uint8_t* srcp, float* dstp,
__m128i xmm1 = _mm_unpackhi_epi8(xmm0, zero);
xmm0 = _mm_unpacklo_epi8(xmm0, zero);

_mm_store_ps(dstp + x, _mm_cvtepi32_ps(_mm_unpacklo_epi16(xmm0, zero)));
_mm_store_ps(dstp + x + 4, _mm_cvtepi32_ps(_mm_unpackhi_epi16(xmm0, zero)));
_mm_store_ps(dstp + x + 8, _mm_cvtepi32_ps(_mm_unpacklo_epi16(xmm1, zero)));
_mm_store_ps(dstp + x + 12, _mm_cvtepi32_ps(_mm_unpackhi_epi16(xmm1, zero)));
_mm_stream_ps(dstp + x, _mm_cvtepi32_ps(_mm_unpacklo_epi16(xmm0, zero)));
_mm_stream_ps(dstp + x + 4, _mm_cvtepi32_ps(_mm_unpackhi_epi16(xmm0, zero)));
_mm_stream_ps(dstp + x + 8, _mm_cvtepi32_ps(_mm_unpacklo_epi16(xmm1, zero)));
_mm_stream_ps(dstp + x + 12, _mm_cvtepi32_ps(_mm_unpackhi_epi16(xmm1, zero)));
}
srcp += src_pitch;
dstp += dst_pitch;
Expand Down Expand Up @@ -74,7 +74,7 @@ horizontal_blur(float* srcp, const int radius, const int length, int width,
__m128 xmm0 = _mm_loadu_ps(srcp + x + i);
sum = _mm_add_ps(sum, _mm_mul_ps(xmm0, k));
}
_mm_store_ps(dstp + x, sum);
_mm_stream_ps(dstp + x, sum);
}
}

Expand Down
2 changes: 1 addition & 1 deletion avisynth/src/tcannymod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "write_frame.h"


#define TCANNY_M_VERSION "0.1.1"
#define TCANNY_M_VERSION "0.2.0"

#define GB_MAX_LENGTH 17

Expand Down
4 changes: 2 additions & 2 deletions avisynth/src/write_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ write_edge_direction(const float* edgep, const uint8_t* dir, float th_max,
xmm0 = _mm_packs_epi16(_mm_packs_epi32(xmm0, xmm1), _mm_packs_epi32(xmm2, xmm3));
xmm1 = _mm_load_si128((__m128i*)(dir + x));
xmm0 = _mm_and_si128(xmm0, xmm1);
_mm_store_si128((__m128i*)(dstp + x), xmm0);
_mm_stream_si128((__m128i*)(dstp + x), xmm0);
}
edgep += frame_pitch;
dir += frame_pitch;
Expand All @@ -104,7 +104,7 @@ write_binary_mask(const float* srcp, float th_max, int width, int height,
__m128i xmm2 = _mm_castps_si128(_mm_cmpge_ps(_mm_load_ps(srcp + x + 8), tmax));
__m128i xmm3 = _mm_castps_si128(_mm_cmpge_ps(_mm_load_ps(srcp + x + 12), tmax));
xmm0 = _mm_packs_epi16(_mm_packs_epi32(xmm0, xmm1), _mm_packs_epi32(xmm2, xmm3));
_mm_store_si128((__m128i*)(dstp + x), xmm0);
_mm_stream_si128((__m128i*)(dstp + x), xmm0);
}
srcp += src_pitch;
dstp += dst_pitch;
Expand Down

0 comments on commit 7e2a182

Please sign in to comment.