Commit 45b9ef0f authored by fbarchard@google.com's avatar fbarchard@google.com

scale call copyplane in planarfunctions

BUG=none
TEST=none
Review URL: http://webrtc-codereview.appspot.com/335002

git-svn-id: http://libyuv.googlecode.com/svn/trunk@112 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 75df30c1
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 110
Version: 112
License: BSD
License File: LICENSE
......
......@@ -189,6 +189,11 @@ int ARGBCopy(const uint8* src_argb, int src_stride_argb,
uint8* dst_argb, int dst_stride_argb,
int width, int height);
// Copy a plane of data
void CopyPlane(const uint8* src_y, int src_stride_y,
uint8* dst_y, int dst_stride_y,
int width, int height);
#ifdef __cplusplus
} // extern "C"
} // namespace libyuv
......
......@@ -211,9 +211,10 @@ void CopyRow_C(const uint8* src, uint8* dst, int count) {
memcpy(dst, src, count);
}
static void CopyPlane(const uint8* src_y, int src_stride_y,
uint8* dst_y, int dst_stride_y,
int width, int height) {
// Copy a plane of data
void CopyPlane(const uint8* src_y, int src_stride_y,
uint8* dst_y, int dst_stride_y,
int width, int height) {
void (*CopyRow)(const uint8* src, uint8* dst, int width);
#if defined(HAS_COPYROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2) &&
......
......@@ -867,7 +867,7 @@ __asm {
por xmm0, xmm1
pshuflw xmm0, xmm0, 0x1b // swap words
pshufhw xmm0, xmm0, 0x1b
pshufd xmm0, xmm0, 0x4e
pshufd xmm0, xmm0, 0x4e // swap qwords
movdqa [edx], xmm0
lea edx, [edx + 16]
sub ecx, 16
......
......@@ -14,6 +14,7 @@
#include <string.h>
#include "libyuv/cpu_id.h"
#include "libyuv/planar_functions.h" // For CopyPlane
#include "row.h"
#ifdef __cplusplus
......@@ -3570,33 +3571,6 @@ static void ScalePlaneDown(int src_width, int src_height,
}
}
/**
* Copy plane, no scaling
*
* This simply copies the given plane without scaling.
* The current implementation is ~115 times faster
* compared to the reference implementation.
*
*/
static void CopyPlane(int src_width, int src_height,
int dst_width, int dst_height,
int src_stride, int dst_stride,
const uint8* src_ptr, uint8* dst_ptr) {
if (src_stride == src_width && dst_stride == dst_width) {
// All contiguous, so can use REALLY fast path.
memcpy(dst_ptr, src_ptr, src_width * src_height);
} else {
// Not all contiguous; must copy scanlines individually
const uint8* src = src_ptr;
uint8* dst = dst_ptr;
for (int i = 0; i < src_height; ++i) {
memcpy(dst, src, src_width);
dst += dst_stride;
src += src_stride;
}
}
}
static void ScalePlane(const uint8* src, int src_stride,
int src_width, int src_height,
uint8* dst, int dst_stride,
......@@ -3606,8 +3580,7 @@ static void ScalePlane(const uint8* src, int src_stride,
// For example, all the 1/2 scalings will use ScalePlaneDown2()
if (dst_width == src_width && dst_height == src_height) {
// Straight copy.
CopyPlane(src_width, src_height, dst_width, dst_height, src_stride,
dst_stride, src, dst);
CopyPlane(src, src_stride, dst, dst_stride, dst_width, dst_height);
} else if (dst_width <= src_width && dst_height <= src_height) {
// Scale down.
if (use_ref) {
......
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