[vlc-commits] Sepia8ySSE2(): remove forward declaration
Rafaël Carré
git at videolan.org
Wed Sep 14 00:34:29 CEST 2011
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Sep 13 18:32:39 2011 -0400| [364cb74d30b14bcdb8e5a9c3ca90d01857ab907b] | committer: Rafaël Carré
Sepia8ySSE2(): remove forward declaration
make the function static inline
don't compile it at all if we can't compile SSE2
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=364cb74d30b14bcdb8e5a9c3ca90d01857ab907b
---
modules/video_filter/sepia.c | 63 ++++++++++++++++++++---------------------
1 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/modules/video_filter/sepia.c b/modules/video_filter/sepia.c
index 7d4fb98..cdab59e 100644
--- a/modules/video_filter/sepia.c
+++ b/modules/video_filter/sepia.c
@@ -47,7 +47,6 @@ static void RVSepia( picture_t *, picture_t *, int );
static void PlanarI420Sepia( picture_t *, picture_t *, int);
static void PackedYUVSepia( picture_t *, picture_t *, int);
static picture_t *Filter( filter_t *, picture_t * );
-inline void Sepia8ySSE2( uint8_t *, const uint8_t *, int );
static const char *const ppsz_filter_options[] = {
"intensity", NULL
};
@@ -199,6 +198,37 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return CopyInfoAndRelease( p_outpic, p_pic );
}
+#if defined(CAN_COMPILE_SSE2)
+/*****************************************************************************
+ * Sepia8ySSE2
+ *****************************************************************************
+ * This function applies sepia effect to eight bytes of yellow using SSE4.1
+ * instructions. It copies those 8 bytes to 128b register and fills the gaps
+ * with zeroes and following operations are made with word-operating instructs.
+ *****************************************************************************/
+static inline void Sepia8ySSE2(uint8_t * dst, const uint8_t * src,
+ int i_intensity_spread)
+{
+ __asm__ volatile (
+ // y = y - y / 4 + i_intensity / 4
+ "movq (%1), %%xmm1\n"
+ "punpcklbw %%xmm7, %%xmm1\n"
+ "movq (%1), %%xmm2\n" // store bytes as words with 0s in between
+ "punpcklbw %%xmm7, %%xmm2\n"
+ "movd %2, %%xmm3\n"
+ "pshufd $0, %%xmm3, %%xmm3\n"
+ "psrlw $2, %%xmm2\n" // rotate right 2
+ "psubusb %%xmm1, %%xmm2\n" // subtract
+ "psrlw $2, %%xmm3\n"
+ "paddsb %%xmm1, %%xmm3\n" // add
+ "packuswb %%xmm2, %%xmm1\n" // pack back to bytes
+ "movq %%xmm1, (%0) \n" // load to dest
+ :
+ :"r" (dst), "r"(src), "r"(i_intensity_spread)
+ :"memory");
+}
+#endif
+
/*****************************************************************************
* PlanarI420Sepia: Applies sepia to one frame of the planar I420 video
*****************************************************************************
@@ -458,37 +488,6 @@ static void RVSepia( picture_t *p_pic, picture_t *p_outpic, int i_intensity )
#undef FIX
}
-/*****************************************************************************
- * Sepia8ySSE2
- *****************************************************************************
- * This function applies sepia effect to eight bytes of yellow using SSE4.1
- * instructions. It copies those 8 bytes to 128b register and fills the gaps
- * with zeroes and following operations are made with word-operating instructs.
- *****************************************************************************/
-inline void Sepia8ySSE2(uint8_t * dst, const uint8_t * src,
- int i_intensity_spread)
-{
-#if defined(CAN_COMPILE_SSE2)
- __asm__ volatile (
- // y = y - y / 4 + i_intensity / 4
- "movq (%1), %%xmm1\n"
- "punpcklbw %%xmm7, %%xmm1\n"
- "movq (%1), %%xmm2\n" // store bytes as words with 0s in between
- "punpcklbw %%xmm7, %%xmm2\n"
- "movd %2, %%xmm3\n"
- "pshufd $0, %%xmm3, %%xmm3\n"
- "psrlw $2, %%xmm2\n" // rotate right 2
- "psubusb %%xmm1, %%xmm2\n" // subtract
- "psrlw $2, %%xmm3\n"
- "paddsb %%xmm1, %%xmm3\n" // add
- "packuswb %%xmm2, %%xmm1\n" // pack back to bytes
- "movq %%xmm1, (%0) \n" // load to dest
- :
- :"r" (dst), "r"(src), "r"(i_intensity_spread)
- :"memory");
-#endif
-}
-
static int FilterCallback ( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data )
More information about the vlc-commits
mailing list