Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2012-02-15 00:48:05 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2012-02-15 00:48:05 +0400
commitb0b1cde5b83eba10d384aa9e8f7f5dbcd5228754 (patch)
tree9c9cdaf08f9ab8649ab179e20965ff1910291da2 /decoder/LAVVideo/pixconv
parent2e03b2b2b285adb5a343c29e7dce1e881fb9bc85 (diff)
Add a SSE2 optimized NV12 -> NV12 copy
Diffstat (limited to 'decoder/LAVVideo/pixconv')
-rw-r--r--decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp b/decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp
index fd624ebe..a74b9a4e 100644
--- a/decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp
+++ b/decoder/LAVVideo/pixconv/yuv2yuv_unscaled.cpp
@@ -488,3 +488,46 @@ DECLARE_CONV_FUNC_IMPL(convert_nv12_yv12)
return S_OK;
}
+
+DECLARE_CONV_FUNC_IMPL(convert_nv12_nv12)
+{
+ const uint8_t *y = src[0];
+ const uint8_t *uv = src[1];
+
+ const int inStride = srcStride[0];
+ const int outStride = dstStride;
+ const int chromaHeight = (height >> 1);
+
+ uint8_t *dstY = dst;
+ uint8_t *dstUV = dstY + height * outStride;
+
+ int line, i;
+ __m128i xmm0;
+
+ _mm_sfence();
+
+ // Copy the data
+ for (line = 0; line < height; line++) {
+ __m128i *dstY128 = (__m128i *)(dstY + outStride * line);
+
+ for (i = 0; i < width; i+=16) {
+ PIXCONV_LOAD_PIXEL8_ALIGNED(xmm0, y+i+0);
+ _mm_stream_si128(dstY128++, xmm0);
+ }
+
+ y += inStride;
+ }
+
+ for (line = 0; line < chromaHeight; line++) {
+ __m128i *dstUV128 = (__m128i *)(dstUV + outStride * line);
+
+ for (i = 0; i < width; i+=16) {
+ PIXCONV_LOAD_PIXEL8_ALIGNED(xmm0, uv+i+0);
+ _mm_stream_si128(dstUV128++, xmm0);
+ }
+
+ uv += inStride;
+ }
+
+ return S_OK;
+}