mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
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
This commit is contained in:
parent
75df30c1da
commit
45b9ef0f6a
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 110
|
Version: 112
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -189,6 +189,11 @@ int ARGBCopy(const uint8* src_argb, int src_stride_argb,
|
|||||||
uint8* dst_argb, int dst_stride_argb,
|
uint8* dst_argb, int dst_stride_argb,
|
||||||
int width, int height);
|
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
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
} // namespace libyuv
|
} // namespace libyuv
|
||||||
|
|||||||
@ -211,9 +211,10 @@ void CopyRow_C(const uint8* src, uint8* dst, int count) {
|
|||||||
memcpy(dst, src, count);
|
memcpy(dst, src, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyPlane(const uint8* src_y, int src_stride_y,
|
// Copy a plane of data
|
||||||
uint8* dst_y, int dst_stride_y,
|
void CopyPlane(const uint8* src_y, int src_stride_y,
|
||||||
int width, int height) {
|
uint8* dst_y, int dst_stride_y,
|
||||||
|
int width, int height) {
|
||||||
void (*CopyRow)(const uint8* src, uint8* dst, int width);
|
void (*CopyRow)(const uint8* src, uint8* dst, int width);
|
||||||
#if defined(HAS_COPYROW_SSE2)
|
#if defined(HAS_COPYROW_SSE2)
|
||||||
if (TestCpuFlag(kCpuHasSSE2) &&
|
if (TestCpuFlag(kCpuHasSSE2) &&
|
||||||
|
|||||||
@ -867,7 +867,7 @@ __asm {
|
|||||||
por xmm0, xmm1
|
por xmm0, xmm1
|
||||||
pshuflw xmm0, xmm0, 0x1b // swap words
|
pshuflw xmm0, xmm0, 0x1b // swap words
|
||||||
pshufhw xmm0, xmm0, 0x1b
|
pshufhw xmm0, xmm0, 0x1b
|
||||||
pshufd xmm0, xmm0, 0x4e
|
pshufd xmm0, xmm0, 0x4e // swap qwords
|
||||||
movdqa [edx], xmm0
|
movdqa [edx], xmm0
|
||||||
lea edx, [edx + 16]
|
lea edx, [edx + 16]
|
||||||
sub ecx, 16
|
sub ecx, 16
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "libyuv/cpu_id.h"
|
#include "libyuv/cpu_id.h"
|
||||||
|
#include "libyuv/planar_functions.h" // For CopyPlane
|
||||||
#include "row.h"
|
#include "row.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#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,
|
static void ScalePlane(const uint8* src, int src_stride,
|
||||||
int src_width, int src_height,
|
int src_width, int src_height,
|
||||||
uint8* dst, int dst_stride,
|
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()
|
// For example, all the 1/2 scalings will use ScalePlaneDown2()
|
||||||
if (dst_width == src_width && dst_height == src_height) {
|
if (dst_width == src_width && dst_height == src_height) {
|
||||||
// Straight copy.
|
// Straight copy.
|
||||||
CopyPlane(src_width, src_height, dst_width, dst_height, src_stride,
|
CopyPlane(src, src_stride, dst, dst_stride, dst_width, dst_height);
|
||||||
dst_stride, src, dst);
|
|
||||||
} else if (dst_width <= src_width && dst_height <= src_height) {
|
} else if (dst_width <= src_width && dst_height <= src_height) {
|
||||||
// Scale down.
|
// Scale down.
|
||||||
if (use_ref) {
|
if (use_ref) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user