mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
Fix constant in rowposix, remove addrow and minor cleanups
BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/637013 git-svn-id: http://libyuv.googlecode.com/svn/trunk@286 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
bac5f2c3ee
commit
ee2208885f
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 285
|
Version: 286
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -201,33 +201,27 @@ int ARGBToI422(const uint8* src_frame, int src_stride_frame,
|
|||||||
int I420Rect(uint8* dst_y, int dst_stride_y,
|
int I420Rect(uint8* dst_y, int dst_stride_y,
|
||||||
uint8* dst_u, int dst_stride_u,
|
uint8* dst_u, int dst_stride_u,
|
||||||
uint8* dst_v, int dst_stride_v,
|
uint8* dst_v, int dst_stride_v,
|
||||||
int x, int y,
|
int x, int y, int width, int height,
|
||||||
int width, int height,
|
|
||||||
int value_y, int value_u, int value_v);
|
int value_y, int value_u, int value_v);
|
||||||
|
|
||||||
// Draw a rectangle into ARGB.
|
// Draw a rectangle into ARGB.
|
||||||
int ARGBRect(uint8* dst_argb, int dst_stride_argb,
|
int ARGBRect(uint8* dst_argb, int dst_stride_argb,
|
||||||
int x, int y,
|
int x, int y, int width, int height, uint32 value);
|
||||||
int width, int height,
|
|
||||||
uint32 value);
|
|
||||||
|
|
||||||
// Make a rectangle of ARGB gray scale.
|
// Make a rectangle of ARGB gray scale.
|
||||||
int ARGBGray(uint8* dst_argb, int dst_stride_argb,
|
int ARGBGray(uint8* dst_argb, int dst_stride_argb,
|
||||||
int x, int y,
|
int x, int y, int width, int height);
|
||||||
int width, int height);
|
|
||||||
|
|
||||||
// Make a rectangle of ARGB Sepia tone.
|
// Make a rectangle of ARGB Sepia tone.
|
||||||
int ARGBSepia(uint8* dst_argb, int dst_stride_argb,
|
int ARGBSepia(uint8* dst_argb, int dst_stride_argb,
|
||||||
int x, int y,
|
int x, int y, int width, int height);
|
||||||
int width, int height);
|
|
||||||
|
|
||||||
// Copy ARGB to ARGB.
|
// Copy ARGB to ARGB.
|
||||||
int ARGBCopy(const uint8* src_argb, int src_stride_argb,
|
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);
|
||||||
|
|
||||||
typedef void (*ARGBBlendRow)(const uint8* src_argb0,
|
typedef void (*ARGBBlendRow)(const uint8* src_argb0, const uint8* src_argb1,
|
||||||
const uint8* src_argb1,
|
|
||||||
uint8* dst_argb, int width);
|
uint8* dst_argb, int width);
|
||||||
|
|
||||||
// Get function to Alpha Blend ARGB pixels and store to destination.
|
// Get function to Alpha Blend ARGB pixels and store to destination.
|
||||||
@ -263,17 +257,10 @@ int ARGBUnattenuate(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);
|
||||||
|
|
||||||
// Get function to add or subtract rows of bytes to a 16 bit buffer. For blur.
|
|
||||||
typedef void (*AddRow)(const uint8* src, uint16* dst, int width);
|
|
||||||
AddRow GetAddRow(uint16* dst, int width);
|
|
||||||
AddRow GetSubRow(uint16* dst, int width);
|
|
||||||
|
|
||||||
// Convert MJPG to ARGB.
|
// Convert MJPG to ARGB.
|
||||||
int MJPGToARGB(const uint8* sample,
|
int MJPGToARGB(const uint8* sample, size_t sample_size,
|
||||||
size_t sample_size,
|
|
||||||
uint8* argb, int argb_stride,
|
uint8* argb, int argb_stride,
|
||||||
int w, int h,
|
int w, int h, int dw, int dh);
|
||||||
int dw, int dh);
|
|
||||||
|
|
||||||
// Computes table of cumulative sum for image where the value is the sum
|
// Computes table of cumulative sum for image where the value is the sum
|
||||||
// of all values above and to the left of the entry. Used by ARGBBlur.
|
// of all values above and to the left of the entry. Used by ARGBBlur.
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 285
|
#define LIBYUV_VERSION 286
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
|
|||||||
@ -1424,32 +1424,6 @@ int ARGBUnattenuate(const uint8* src_argb, int src_stride_argb,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddRow is useful for summing up rows of an image, when implementing a
|
|
||||||
// box filter or blur effect.
|
|
||||||
AddRow GetAddRow(uint16* dst, int width) {
|
|
||||||
AddRow AddRowF = AddRow_C;
|
|
||||||
#if defined(HAS_ADDROW_SSE2)
|
|
||||||
if (TestCpuFlag(kCpuHasSSE2) &&
|
|
||||||
IS_ALIGNED(dst, 16) && IS_ALIGNED(width, 16)) {
|
|
||||||
AddRowF = AddRow_SSE2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return AddRowF;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SubRow is useful when a sum of rows exists and the caller wants to
|
|
||||||
// remove a row and add a new row without recomputing the full sum of rows.
|
|
||||||
AddRow GetSubRow(uint16* dst, int width) {
|
|
||||||
AddRow SubRowF = SubRow_C;
|
|
||||||
#if defined(HAS_ADDROW_SSE2)
|
|
||||||
if (TestCpuFlag(kCpuHasSSE2) &&
|
|
||||||
IS_ALIGNED(dst, 16) && IS_ALIGNED(width, 16)) {
|
|
||||||
SubRowF = SubRow_SSE2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return SubRowF;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make a rectangle of ARGB gray scale.
|
// Make a rectangle of ARGB gray scale.
|
||||||
int ARGBGray(uint8* dst_argb, int dst_stride_argb,
|
int ARGBGray(uint8* dst_argb, int dst_stride_argb,
|
||||||
int dst_x, int dst_y,
|
int dst_x, int dst_y,
|
||||||
|
|||||||
@ -64,7 +64,6 @@ extern "C" {
|
|||||||
#define HAS_I400TOARGBROW_SSE2
|
#define HAS_I400TOARGBROW_SSE2
|
||||||
#define HAS_MIRRORROW_SSSE3
|
#define HAS_MIRRORROW_SSSE3
|
||||||
#define HAS_MIRRORROWUV_SSSE3
|
#define HAS_MIRRORROWUV_SSSE3
|
||||||
#define HAS_ADDROW_SSE2
|
|
||||||
#define HAS_RAWTOARGBROW_SSSE3
|
#define HAS_RAWTOARGBROW_SSSE3
|
||||||
#define HAS_RGB24TOARGBROW_SSSE3
|
#define HAS_RGB24TOARGBROW_SSSE3
|
||||||
#define HAS_RGB565TOARGBROW_SSE2
|
#define HAS_RGB565TOARGBROW_SSE2
|
||||||
@ -177,11 +176,6 @@ void MirrorRowUV_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v, int width);
|
|||||||
void MirrorRowUV_NEON(const uint8* src, uint8* dst_u, uint8* dst_v, int width);
|
void MirrorRowUV_NEON(const uint8* src, uint8* dst_u, uint8* dst_v, int width);
|
||||||
void MirrorRowUV_C(const uint8* src, uint8* dst_u, uint8* dst_v, int width);
|
void MirrorRowUV_C(const uint8* src, uint8* dst_u, uint8* dst_v, int width);
|
||||||
|
|
||||||
void AddRow_SSE2(const uint8* src, uint16* dst, int width);
|
|
||||||
void SubRow_SSE2(const uint8* src, uint16* dst, int width);
|
|
||||||
void AddRow_C(const uint8* src, uint16* dst, int width);
|
|
||||||
void SubRow_C(const uint8* src, uint16* dst, int width);
|
|
||||||
|
|
||||||
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
||||||
void SplitUV_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
void SplitUV_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
||||||
void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
||||||
|
|||||||
@ -521,30 +521,6 @@ void MirrorRowUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddRow_C(const uint8* src, uint16* dst, int width) {
|
|
||||||
for (int x = 0; x < width - 1; x += 2) {
|
|
||||||
dst[0] += static_cast<uint16>(src[0]);
|
|
||||||
dst[1] += static_cast<uint16>(src[1]);
|
|
||||||
src += 2;
|
|
||||||
dst += 2;
|
|
||||||
}
|
|
||||||
if (width & 1) {
|
|
||||||
dst[0] += static_cast<uint16>(src[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SubRow_C(const uint8* src, uint16* dst, int width) {
|
|
||||||
for (int x = 0; x < width - 1; x += 2) {
|
|
||||||
dst[0] -= static_cast<uint16>(src[0]);
|
|
||||||
dst[1] -= static_cast<uint16>(src[1]);
|
|
||||||
src += 2;
|
|
||||||
dst += 2;
|
|
||||||
}
|
|
||||||
if (width & 1) {
|
|
||||||
dst[0] -= static_cast<uint16>(src[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) {
|
void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) {
|
||||||
for (int x = 0; x < width - 1; x += 2) {
|
for (int x = 0; x < width - 1; x += 2) {
|
||||||
dst_u[x] = src_uv[0];
|
dst_u[x] = src_uv[0];
|
||||||
|
|||||||
@ -1977,70 +1977,6 @@ void MirrorRowUV_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v,
|
|||||||
}
|
}
|
||||||
#endif // HAS_MIRRORROW_UV_SSSE3
|
#endif // HAS_MIRRORROW_UV_SSSE3
|
||||||
|
|
||||||
#ifdef HAS_ADDROW_SSE2
|
|
||||||
// dst and width aligned to 16
|
|
||||||
void AddRow_SSE2(const uint8* src, uint16* dst, int width) {
|
|
||||||
asm volatile (
|
|
||||||
"pxor %%xmm4,%%xmm4 \n"
|
|
||||||
".p2align 4 \n"
|
|
||||||
"1: \n"
|
|
||||||
"movdqu (%0),%%xmm2 \n"
|
|
||||||
"lea 0x10(%0),%0 \n"
|
|
||||||
"movdqa (%1),%%xmm0 \n"
|
|
||||||
"movdqa 0x10(%1),%%xmm1 \n"
|
|
||||||
"movdqa %%xmm2,%%xmm3 \n"
|
|
||||||
"punpcklbw %%xmm4,%%xmm2 \n"
|
|
||||||
"punpckhbw %%xmm4,%%xmm3 \n"
|
|
||||||
"paddusw %%xmm2,%%xmm0 \n"
|
|
||||||
"paddusw %%xmm3,%%xmm1 \n"
|
|
||||||
"sub $0x10,%2 \n"
|
|
||||||
"movdqa %%xmm0,(%1) \n"
|
|
||||||
"movdqa %%xmm1,0x10(%1) \n"
|
|
||||||
"lea 0x20(%1),%1 \n"
|
|
||||||
"jg 1b \n"
|
|
||||||
: "+r"(src), // %0
|
|
||||||
"+r"(dst), // %1
|
|
||||||
"+r"(width) // %2
|
|
||||||
:
|
|
||||||
: "memory", "cc"
|
|
||||||
#if defined(__SSE2__)
|
|
||||||
, "xmm0", "xmm1", "xmm2", "xmm3", "xmm4"
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// dst and width aligned to 16
|
|
||||||
void SubRow_SSE2(const uint8* src, uint16* dst, int width) {
|
|
||||||
asm volatile (
|
|
||||||
"pxor %%xmm4,%%xmm4 \n"
|
|
||||||
".p2align 4 \n"
|
|
||||||
"1: \n"
|
|
||||||
"movdqu (%0),%%xmm2 \n"
|
|
||||||
"lea 0x10(%0),%0 \n"
|
|
||||||
"movdqa (%1),%%xmm0 \n"
|
|
||||||
"movdqa 0x10(%1),%%xmm1 \n"
|
|
||||||
"movdqa %%xmm2,%%xmm3 \n"
|
|
||||||
"punpcklbw %%xmm4,%%xmm2 \n"
|
|
||||||
"punpckhbw %%xmm4,%%xmm3 \n"
|
|
||||||
"psubusw %%xmm2,%%xmm0 \n"
|
|
||||||
"psubusw %%xmm3,%%xmm1 \n"
|
|
||||||
"sub $0x10,%2 \n"
|
|
||||||
"movdqa %%xmm0,(%1) \n"
|
|
||||||
"movdqa %%xmm1,0x10(%1) \n"
|
|
||||||
"lea 0x20(%1),%1 \n"
|
|
||||||
"jg 1b \n"
|
|
||||||
: "+r"(src), // %0
|
|
||||||
"+r"(dst), // %1
|
|
||||||
"+r"(width) // %2
|
|
||||||
:
|
|
||||||
: "memory", "cc"
|
|
||||||
#if defined(__SSE2__)
|
|
||||||
, "xmm0", "xmm1", "xmm2", "xmm3", "xmm4"
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#endif // HAS_ADDROW_SSE2
|
|
||||||
|
|
||||||
#ifdef HAS_SPLITUV_SSE2
|
#ifdef HAS_SPLITUV_SSE2
|
||||||
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {
|
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {
|
||||||
asm volatile (
|
asm volatile (
|
||||||
@ -2436,7 +2372,7 @@ void ARGBBlendRow_SSE2(const uint8* src_argb0, const uint8* src_argb1,
|
|||||||
"jge 10b \n"
|
"jge 10b \n"
|
||||||
|
|
||||||
"19: \n"
|
"19: \n"
|
||||||
"add $1-$4,%3 \n"
|
"add $1-4,%3 \n"
|
||||||
"jl 49f \n"
|
"jl 49f \n"
|
||||||
|
|
||||||
// 8 pixel loop.
|
// 8 pixel loop.
|
||||||
@ -2592,7 +2528,7 @@ void ARGBBlendRow_SSSE3(const uint8* src_argb0, const uint8* src_argb1,
|
|||||||
"jge 10b \n"
|
"jge 10b \n"
|
||||||
|
|
||||||
"19: \n"
|
"19: \n"
|
||||||
"add $1-$4,%3 \n"
|
"add $1-4,%3 \n"
|
||||||
"jl 49f \n"
|
"jl 49f \n"
|
||||||
|
|
||||||
// 8 pixel loop.
|
// 8 pixel loop.
|
||||||
|
|||||||
@ -2059,65 +2059,6 @@ void MirrorRowUV_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v,
|
|||||||
}
|
}
|
||||||
#endif // HAS_MIRRORROW_UV_SSSE3
|
#endif // HAS_MIRRORROW_UV_SSSE3
|
||||||
|
|
||||||
#ifdef HAS_ADDROW_SSE2
|
|
||||||
// dst and width aligned to 16
|
|
||||||
__declspec(naked) __declspec(align(16))
|
|
||||||
void AddRow_SSE2(const uint8* src, uint16* dst, int width) {
|
|
||||||
__asm {
|
|
||||||
mov eax, [esp + 4] // src
|
|
||||||
mov edx, [esp + 8] // dst
|
|
||||||
mov ecx, [esp + 12] // width
|
|
||||||
pxor xmm4, xmm4
|
|
||||||
|
|
||||||
align 16
|
|
||||||
convertloop:
|
|
||||||
movdqu xmm2, [eax] // read 16 bytes
|
|
||||||
lea eax, [eax + 16]
|
|
||||||
movdqa xmm0, [edx] // read first 8 words
|
|
||||||
movdqa xmm1, [edx + 16] // read next 8 words
|
|
||||||
movdqa xmm3, xmm2
|
|
||||||
punpcklbw xmm2, xmm4
|
|
||||||
punpckhbw xmm3, xmm4
|
|
||||||
paddusw xmm0, xmm2 // add 16 words
|
|
||||||
paddusw xmm1, xmm3
|
|
||||||
sub ecx, 16
|
|
||||||
movdqa [edx], xmm0 // store 16 words
|
|
||||||
movdqa [edx + 16], xmm1
|
|
||||||
lea edx, [edx + 32]
|
|
||||||
jg convertloop
|
|
||||||
ret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__declspec(naked) __declspec(align(16))
|
|
||||||
void SubRow_SSE2(const uint8* src, uint16* dst, int width) {
|
|
||||||
__asm {
|
|
||||||
mov eax, [esp + 4] // src
|
|
||||||
mov edx, [esp + 8] // dst
|
|
||||||
mov ecx, [esp + 12] // width
|
|
||||||
pxor xmm4, xmm4
|
|
||||||
|
|
||||||
align 16
|
|
||||||
convertloop:
|
|
||||||
movdqu xmm2, [eax] // read 16 bytes
|
|
||||||
lea eax, [eax + 16]
|
|
||||||
movdqa xmm0, [edx] // read first 8 words
|
|
||||||
movdqa xmm1, [edx + 16] // read next 8 words
|
|
||||||
movdqa xmm3, xmm2
|
|
||||||
punpcklbw xmm2, xmm4
|
|
||||||
punpckhbw xmm3, xmm4
|
|
||||||
psubusw xmm0, xmm2 // sub 16 words
|
|
||||||
psubusw xmm1, xmm3
|
|
||||||
sub ecx, 16
|
|
||||||
movdqa [edx], xmm0 // store 16 words
|
|
||||||
movdqa [edx + 16], xmm1
|
|
||||||
lea edx, [edx + 32]
|
|
||||||
jg convertloop
|
|
||||||
ret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // HAS_ADDROW_SSE2
|
|
||||||
|
|
||||||
#ifdef HAS_SPLITUV_SSE2
|
#ifdef HAS_SPLITUV_SSE2
|
||||||
__declspec(naked) __declspec(align(16))
|
__declspec(naked) __declspec(align(16))
|
||||||
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {
|
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user