mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-01-01 03:12:16 +08:00
Coalesce rows by changing width/height and dropping into code instead of recursing. Improve coalesce by setting stride to 0 so it can be used even on odd width images. Reduce unittests to improve time to run emulators.
BUG=277 TEST=unittests all build and pass R=ryanpetrie@google.com Review URL: https://webrtc-codereview.appspot.com/2589004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@819 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
8be4b289c7
commit
095f33d870
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 818
|
||||
Version: 819
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 818
|
||||
#define LIBYUV_VERSION 819
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -148,7 +148,9 @@ LIBYUV_API
|
||||
uint64 ComputeSumSquareErrorPlane(const uint8* src_a, int stride_a,
|
||||
const uint8* src_b, int stride_b,
|
||||
int width, int height) {
|
||||
if (stride_a == width && stride_b == width) {
|
||||
// Coalesce rows.
|
||||
if (stride_a == width &&
|
||||
stride_b == width) {
|
||||
return ComputeSumSquareError(src_a, src_b, width * height);
|
||||
}
|
||||
uint32 (*SumSquareError)(const uint8* src_a, const uint8* src_b, int count) =
|
||||
|
||||
@ -369,20 +369,23 @@ static int X420ToI420(const uint8* src_y,
|
||||
dst_stride_u = -dst_stride_u;
|
||||
dst_stride_v = -dst_stride_v;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
int halfheight = (height + 1) >> 1;
|
||||
if (src_stride_y0 == width &&
|
||||
src_stride_y1 == width &&
|
||||
dst_stride_y == width) {
|
||||
width = width * height;
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y0 = src_stride_y1 = dst_stride_y = 0;
|
||||
}
|
||||
if (src_stride_uv == width &&
|
||||
dst_stride_u * 2 == width &&
|
||||
dst_stride_v * 2 == width) {
|
||||
halfwidth = halfwidth * halfheight;
|
||||
// Coalesce rows.
|
||||
if (src_stride_uv == halfwidth * 2 &&
|
||||
dst_stride_u * 2 == halfwidth &&
|
||||
dst_stride_v * 2 == halfwidth) {
|
||||
halfwidth *= halfheight;
|
||||
halfheight = 1;
|
||||
src_stride_uv = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*SplitUVRow)(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) =
|
||||
SplitUVRow_C;
|
||||
|
||||
@ -63,16 +63,14 @@ int I444ToARGB(const uint8* src_y, int src_stride_y,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
src_stride_u == width &&
|
||||
src_stride_v == width &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return I444ToARGB(src_y, 0,
|
||||
src_u, 0,
|
||||
src_v, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
||||
}
|
||||
void (*I444ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
@ -126,16 +124,14 @@ int I422ToARGB(const uint8* src_y, int src_stride_y,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
src_stride_u * 2 == width &&
|
||||
src_stride_v * 2 == width &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return I422ToARGB(src_y, 0,
|
||||
src_u, 0,
|
||||
src_v, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
||||
}
|
||||
void (*I422ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
@ -207,16 +203,14 @@ int I411ToARGB(const uint8* src_y, int src_stride_y,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
src_stride_u * 4 == width &&
|
||||
src_stride_v * 4 == width &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return I411ToARGB(src_y, 0,
|
||||
src_u, 0,
|
||||
src_v, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_argb = 0;
|
||||
}
|
||||
void (*I411ToARGBRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
@ -267,12 +261,12 @@ int I400ToARGB_Reference(const uint8* src_y, int src_stride_y,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return I400ToARGB_Reference(src_y, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = dst_stride_argb = 0;
|
||||
}
|
||||
void (*YToARGBRow)(const uint8* y_buf,
|
||||
uint8* rgb_buf,
|
||||
@ -317,12 +311,12 @@ int I400ToARGB(const uint8* src_y, int src_stride_y,
|
||||
src_y = src_y + (height - 1) * src_stride_y;
|
||||
src_stride_y = -src_stride_y;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return I400ToARGB(src_y, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = dst_stride_argb = 0;
|
||||
}
|
||||
void (*I400ToARGBRow)(const uint8* src_y, uint8* dst_argb, int pix) =
|
||||
I400ToARGBRow_C;
|
||||
@ -415,12 +409,12 @@ int RGB24ToARGB(const uint8* src_rgb24, int src_stride_rgb24,
|
||||
src_rgb24 = src_rgb24 + (height - 1) * src_stride_rgb24;
|
||||
src_stride_rgb24 = -src_stride_rgb24;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_rgb24 == width * 3 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return RGB24ToARGB(src_rgb24, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_rgb24 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*RGB24ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RGB24ToARGBRow_C;
|
||||
@ -464,12 +458,12 @@ int RAWToARGB(const uint8* src_raw, int src_stride_raw,
|
||||
src_raw = src_raw + (height - 1) * src_stride_raw;
|
||||
src_stride_raw = -src_stride_raw;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_raw == width * 3 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return RAWToARGB(src_raw, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_raw = dst_stride_argb = 0;
|
||||
}
|
||||
void (*RAWToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int pix) =
|
||||
RAWToARGBRow_C;
|
||||
@ -513,12 +507,12 @@ int RGB565ToARGB(const uint8* src_rgb565, int src_stride_rgb565,
|
||||
src_rgb565 = src_rgb565 + (height - 1) * src_stride_rgb565;
|
||||
src_stride_rgb565 = -src_stride_rgb565;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_rgb565 == width * 2 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return RGB565ToARGB(src_rgb565, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_rgb565 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*RGB565ToARGBRow)(const uint8* src_rgb565, uint8* dst_argb, int pix) =
|
||||
RGB565ToARGBRow_C;
|
||||
@ -562,12 +556,12 @@ int ARGB1555ToARGB(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
src_argb1555 = src_argb1555 + (height - 1) * src_stride_argb1555;
|
||||
src_stride_argb1555 = -src_stride_argb1555;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb1555 == width * 2 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGB1555ToARGB(src_argb1555, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb1555 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGB1555ToARGBRow)(const uint8* src_argb1555, uint8* dst_argb,
|
||||
int pix) = ARGB1555ToARGBRow_C;
|
||||
@ -611,12 +605,12 @@ int ARGB4444ToARGB(const uint8* src_argb4444, int src_stride_argb4444,
|
||||
src_argb4444 = src_argb4444 + (height - 1) * src_stride_argb4444;
|
||||
src_stride_argb4444 = -src_stride_argb4444;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb4444 == width * 2 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGB4444ToARGB(src_argb4444, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb4444 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGB4444ToARGBRow)(const uint8* src_argb4444, uint8* dst_argb,
|
||||
int pix) = ARGB4444ToARGBRow_C;
|
||||
@ -812,13 +806,13 @@ int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2;
|
||||
src_stride_yuy2 = -src_stride_yuy2;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (width * height <= kMaxStride &&
|
||||
src_stride_yuy2 == width * 2 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return YUY2ToARGB(src_yuy2, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_yuy2 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*YUY2ToARGBRow)(const uint8* src_yuy2, uint8* dst_argb, int pix) =
|
||||
YUY2ToARGBRow_C;
|
||||
@ -865,13 +859,13 @@ int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy,
|
||||
src_uyvy = src_uyvy + (height - 1) * src_stride_uyvy;
|
||||
src_stride_uyvy = -src_stride_uyvy;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (width * height <= kMaxStride &&
|
||||
src_stride_uyvy == width * 2 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return UYVYToARGB(src_uyvy, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_uyvy = dst_stride_argb = 0;
|
||||
}
|
||||
void (*UYVYToARGBRow)(const uint8* src_uyvy, uint8* dst_argb, int pix) =
|
||||
UYVYToARGBRow_C;
|
||||
|
||||
@ -237,16 +237,14 @@ int I422ToYUY2(const uint8* src_y, int src_stride_y,
|
||||
dst_yuy2 = dst_yuy2 + (height - 1) * dst_stride_yuy2;
|
||||
dst_stride_yuy2 = -dst_stride_yuy2;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
src_stride_u * 2 == width &&
|
||||
src_stride_v * 2 == width &&
|
||||
dst_stride_yuy2 == width * 2) {
|
||||
return I422ToYUY2(src_y, 0,
|
||||
src_u, 0,
|
||||
src_v, 0,
|
||||
dst_yuy2, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_yuy2 = 0;
|
||||
}
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
@ -343,16 +341,14 @@ int I422ToUYVY(const uint8* src_y, int src_stride_y,
|
||||
dst_uyvy = dst_uyvy + (height - 1) * dst_stride_uyvy;
|
||||
dst_stride_uyvy = -dst_stride_uyvy;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
src_stride_u * 2 == width &&
|
||||
src_stride_v * 2 == width &&
|
||||
dst_stride_uyvy == width * 2) {
|
||||
return I422ToUYVY(src_y, 0,
|
||||
src_u, 0,
|
||||
src_v, 0,
|
||||
dst_uyvy, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_uyvy = 0;
|
||||
}
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
@ -453,19 +449,22 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
|
||||
dst_stride_y = -dst_stride_y;
|
||||
dst_stride_uv = -dst_stride_uv;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
int halfheight = (height + 1) >> 1;
|
||||
if (src_stride_y == width &&
|
||||
dst_stride_y == width) {
|
||||
width = width * height;
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = dst_stride_y = 0;
|
||||
}
|
||||
if (src_stride_u * 2 == width &&
|
||||
src_stride_v * 2 == width &&
|
||||
dst_stride_uv == width) {
|
||||
halfwidth = halfwidth * halfheight;
|
||||
// Coalesce rows.
|
||||
if (src_stride_u == halfwidth &&
|
||||
src_stride_v == halfwidth &&
|
||||
dst_stride_uv == halfwidth * 2) {
|
||||
halfwidth *= halfheight;
|
||||
halfheight = 1;
|
||||
src_stride_u = src_stride_v = dst_stride_uv = 0;
|
||||
}
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
|
||||
@ -36,16 +36,14 @@ int ARGBToI444(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_y == width &&
|
||||
dst_stride_u == width &&
|
||||
dst_stride_v == width) {
|
||||
return ARGBToI444(src_argb, 0,
|
||||
dst_y, 0,
|
||||
dst_u, 0,
|
||||
dst_v, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_y = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
@ -111,16 +109,14 @@ int ARGBToI422(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_y == width &&
|
||||
dst_stride_u * 2 == width &&
|
||||
dst_stride_v * 2 == width) {
|
||||
return ARGBToI422(src_argb, 0,
|
||||
dst_y, 0,
|
||||
dst_u, 0,
|
||||
dst_v, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_y = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
@ -190,16 +186,14 @@ int ARGBToI411(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_y == width &&
|
||||
dst_stride_u * 4 == width &&
|
||||
dst_stride_v * 4 == width) {
|
||||
return ARGBToI411(src_argb, 0,
|
||||
dst_y, 0,
|
||||
dst_u, 0,
|
||||
dst_v, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_y = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*ARGBToUV411Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV411Row_C;
|
||||
@ -470,13 +464,13 @@ int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
|
||||
dst_yuy2 = dst_yuy2 + (height - 1) * dst_stride_yuy2;
|
||||
dst_stride_yuy2 = -dst_stride_yuy2;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (width * height <= kMaxStride &&
|
||||
src_stride_argb == width * 4 &&
|
||||
dst_stride_yuy2 == width * 2) {
|
||||
return ARGBToYUY2(src_argb, 0,
|
||||
dst_yuy2, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_yuy2 = 0;
|
||||
}
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
@ -566,13 +560,13 @@ int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
|
||||
dst_uyvy = dst_uyvy + (height - 1) * dst_stride_uyvy;
|
||||
dst_stride_uyvy = -dst_stride_uyvy;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (width * height <= kMaxStride &&
|
||||
src_stride_argb == width * 4 &&
|
||||
dst_stride_uyvy == width * 2) {
|
||||
return ARGBToUYVY(src_argb, 0,
|
||||
dst_uyvy, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_uyvy = 0;
|
||||
}
|
||||
void (*ARGBToUV422Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
int pix) = ARGBToUV422Row_C;
|
||||
@ -659,12 +653,12 @@ int ARGBToI400(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_y == width) {
|
||||
return ARGBToI400(src_argb, 0,
|
||||
dst_y, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_y = 0;
|
||||
}
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
|
||||
ARGBToYRow_C;
|
||||
@ -734,12 +728,12 @@ int ARGBToRGB24(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_rgb24 == width * 3) {
|
||||
return ARGBToRGB24(src_argb, 0,
|
||||
dst_rgb24, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_rgb24 = 0;
|
||||
}
|
||||
void (*ARGBToRGB24Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRGB24Row_C;
|
||||
@ -780,12 +774,12 @@ int ARGBToRAW(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_raw == width * 3) {
|
||||
return ARGBToRAW(src_argb, 0,
|
||||
dst_raw, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_raw = 0;
|
||||
}
|
||||
void (*ARGBToRAWRow)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRAWRow_C;
|
||||
@ -826,12 +820,12 @@ int ARGBToRGB565(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_rgb565 == width * 2) {
|
||||
return ARGBToRGB565(src_argb, 0,
|
||||
dst_rgb565, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_rgb565 = 0;
|
||||
}
|
||||
void (*ARGBToRGB565Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToRGB565Row_C;
|
||||
@ -873,12 +867,12 @@ int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb1555 == width * 2) {
|
||||
return ARGBToARGB1555(src_argb, 0,
|
||||
dst_argb1555, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb1555 = 0;
|
||||
}
|
||||
void (*ARGBToARGB1555Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToARGB1555Row_C;
|
||||
@ -920,12 +914,12 @@ int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb4444 == width * 2) {
|
||||
return ARGBToARGB4444(src_argb, 0,
|
||||
dst_argb4444, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb4444 = 0;
|
||||
}
|
||||
void (*ARGBToARGB4444Row)(const uint8* src_argb, uint8* dst_rgb, int pix) =
|
||||
ARGBToARGB4444Row_C;
|
||||
@ -1044,12 +1038,12 @@ int ARGBToJ400(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_yj == width) {
|
||||
return ARGBToJ400(src_argb, 0,
|
||||
dst_yj, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_yj = 0;
|
||||
}
|
||||
void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int pix) =
|
||||
ARGBToYJRow_C;
|
||||
|
||||
@ -28,13 +28,12 @@ LIBYUV_API
|
||||
void CopyPlane(const uint8* src_y, int src_stride_y,
|
||||
uint8* dst_y, int dst_stride_y,
|
||||
int width, int height) {
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
dst_stride_y == width) {
|
||||
CopyPlane(src_y, 0,
|
||||
dst_y, 0,
|
||||
width * height, 1);
|
||||
return;
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = dst_stride_y = 0;
|
||||
}
|
||||
void (*CopyRow)(const uint8* src, uint8* dst, int width) = CopyRow_C;
|
||||
#if defined(HAS_COPYROW_X86)
|
||||
@ -222,16 +221,14 @@ int YUY2ToI422(const uint8* src_yuy2, int src_stride_yuy2,
|
||||
src_yuy2 = src_yuy2 + (height - 1) * src_stride_yuy2;
|
||||
src_stride_yuy2 = -src_stride_yuy2;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_yuy2 == width * 2 &&
|
||||
dst_stride_y == width &&
|
||||
dst_stride_u * 2 == width &&
|
||||
dst_stride_v * 2 == width) {
|
||||
return YUY2ToI422(src_yuy2, 0,
|
||||
dst_y, 0,
|
||||
dst_u, 0,
|
||||
dst_v, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_yuy2 = dst_stride_y = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*YUY2ToUV422Row)(const uint8* src_yuy2,
|
||||
uint8* dst_u, uint8* dst_v, int pix);
|
||||
@ -302,16 +299,14 @@ int UYVYToI422(const uint8* src_uyvy, int src_stride_uyvy,
|
||||
src_uyvy = src_uyvy + (height - 1) * src_stride_uyvy;
|
||||
src_stride_uyvy = -src_stride_uyvy;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_uyvy == width * 2 &&
|
||||
dst_stride_y == width &&
|
||||
dst_stride_u * 2 == width &&
|
||||
dst_stride_v * 2 == width) {
|
||||
return UYVYToI422(src_uyvy, 0,
|
||||
dst_y, 0,
|
||||
dst_u, 0,
|
||||
dst_v, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_uyvy = dst_stride_y = dst_stride_u = dst_stride_v = 0;
|
||||
}
|
||||
void (*UYVYToUV422Row)(const uint8* src_uyvy,
|
||||
uint8* dst_u, uint8* dst_v, int pix);
|
||||
@ -509,14 +504,13 @@ int ARGBBlend(const uint8* src_argb0, int src_stride_argb0,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb0 == width * 4 &&
|
||||
src_stride_argb1 == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBBlend(src_argb0, 0,
|
||||
src_argb1, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb0 = src_stride_argb1 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBBlendRow)(const uint8* src_argb, const uint8* src_argb1,
|
||||
uint8* dst_argb, int width) = GetARGBBlend();
|
||||
@ -545,16 +539,14 @@ int ARGBMultiply(const uint8* src_argb0, int src_stride_argb0,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb0 == width * 4 &&
|
||||
src_stride_argb1 == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBMultiply(src_argb0, 0,
|
||||
src_argb1, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb0 = src_stride_argb1 = dst_stride_argb = 0;
|
||||
}
|
||||
|
||||
void (*ARGBMultiplyRow)(const uint8* src0, const uint8* src1, uint8* dst,
|
||||
int width) = ARGBMultiplyRow_C;
|
||||
#if defined(HAS_ARGBMULTIPLYROW_SSE2)
|
||||
@ -607,16 +599,14 @@ int ARGBAdd(const uint8* src_argb0, int src_stride_argb0,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb0 == width * 4 &&
|
||||
src_stride_argb1 == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBAdd(src_argb0, 0,
|
||||
src_argb1, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb0 = src_stride_argb1 = dst_stride_argb = 0;
|
||||
}
|
||||
|
||||
void (*ARGBAddRow)(const uint8* src0, const uint8* src1, uint8* dst,
|
||||
int width) = ARGBAddRow_C;
|
||||
#if defined(HAS_ARGBADDROW_SSE2) && defined(_MSC_VER)
|
||||
@ -674,16 +664,14 @@ int ARGBSubtract(const uint8* src_argb0, int src_stride_argb0,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb0 == width * 4 &&
|
||||
src_stride_argb1 == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBSubtract(src_argb0, 0,
|
||||
src_argb1, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb0 = src_stride_argb1 = dst_stride_argb = 0;
|
||||
}
|
||||
|
||||
void (*ARGBSubtractRow)(const uint8* src0, const uint8* src1, uint8* dst,
|
||||
int width) = ARGBSubtractRow_C;
|
||||
#if defined(HAS_ARGBSUBTRACTROW_SSE2)
|
||||
@ -739,16 +727,14 @@ int I422ToBGRA(const uint8* src_y, int src_stride_y,
|
||||
dst_bgra = dst_bgra + (height - 1) * dst_stride_bgra;
|
||||
dst_stride_bgra = -dst_stride_bgra;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
src_stride_u * 2 == width &&
|
||||
src_stride_v * 2 == width &&
|
||||
dst_stride_bgra == width * 4) {
|
||||
return I422ToBGRA(src_y, 0,
|
||||
src_u, 0,
|
||||
src_v, 0,
|
||||
dst_bgra, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_bgra = 0;
|
||||
}
|
||||
void (*I422ToBGRARow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
@ -810,16 +796,14 @@ int I422ToABGR(const uint8* src_y, int src_stride_y,
|
||||
dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr;
|
||||
dst_stride_abgr = -dst_stride_abgr;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
src_stride_u * 2 == width &&
|
||||
src_stride_v * 2 == width &&
|
||||
dst_stride_abgr == width * 4) {
|
||||
return I422ToABGR(src_y, 0,
|
||||
src_u, 0,
|
||||
src_v, 0,
|
||||
dst_abgr, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_abgr = 0;
|
||||
}
|
||||
void (*I422ToABGRRow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
@ -873,16 +857,14 @@ int I422ToRGBA(const uint8* src_y, int src_stride_y,
|
||||
dst_rgba = dst_rgba + (height - 1) * dst_stride_rgba;
|
||||
dst_stride_rgba = -dst_stride_rgba;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
src_stride_u * 2 == width &&
|
||||
src_stride_v * 2 == width &&
|
||||
dst_stride_rgba == width * 4) {
|
||||
return I422ToRGBA(src_y, 0,
|
||||
src_u, 0,
|
||||
src_v, 0,
|
||||
dst_rgba, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = src_stride_u = src_stride_v = dst_stride_rgba = 0;
|
||||
}
|
||||
void (*I422ToRGBARow)(const uint8* y_buf,
|
||||
const uint8* u_buf,
|
||||
@ -1016,12 +998,11 @@ LIBYUV_API
|
||||
void SetPlane(uint8* dst_y, int dst_stride_y,
|
||||
int width, int height,
|
||||
uint32 value) {
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (dst_stride_y == width) {
|
||||
SetPlane(dst_y, 0,
|
||||
width * height, 1,
|
||||
value);
|
||||
return;
|
||||
width *= height;
|
||||
height = 1;
|
||||
dst_stride_y = 0;
|
||||
}
|
||||
void (*SetRow)(uint8* dst, uint32 value, int pix) = SetRow_C;
|
||||
#if defined(HAS_SETROW_NEON)
|
||||
@ -1084,27 +1065,27 @@ int ARGBRect(uint8* dst_argb, int dst_stride_argb,
|
||||
dst_x < 0 || dst_y < 0) {
|
||||
return -1;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
dst_argb += dst_y * dst_stride_argb + dst_x * 4;
|
||||
// Coalesce rows.
|
||||
if (dst_stride_argb == width * 4) {
|
||||
return ARGBRect(dst_argb, dst_stride_argb,
|
||||
dst_x, dst_y,
|
||||
width * height, 1, value);
|
||||
width *= height;
|
||||
height = 1;
|
||||
dst_stride_argb = 0;
|
||||
}
|
||||
uint8* dst = dst_argb + dst_y * dst_stride_argb + dst_x * 4;
|
||||
#if defined(HAS_SETROW_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 16) &&
|
||||
IS_ALIGNED(dst, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
ARGBSetRows_NEON(dst, value, width, dst_stride_argb, height);
|
||||
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) {
|
||||
ARGBSetRows_NEON(dst_argb, value, width, dst_stride_argb, height);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_SETROW_X86)
|
||||
if (TestCpuFlag(kCpuHasX86)) {
|
||||
ARGBSetRows_X86(dst, value, width, dst_stride_argb, height);
|
||||
ARGBSetRows_X86(dst_argb, value, width, dst_stride_argb, height);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
ARGBSetRows_C(dst, value, width, dst_stride_argb, height);
|
||||
ARGBSetRows_C(dst_argb, value, width, dst_stride_argb, height);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1133,12 +1114,12 @@ int ARGBAttenuate(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBAttenuate(src_argb, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBAttenuateRow)(const uint8* src_argb, uint8* dst_argb,
|
||||
int width) = ARGBAttenuateRow_C;
|
||||
@ -1200,12 +1181,12 @@ int ARGBUnattenuate(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBUnattenuate(src_argb, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBUnattenuateRow)(const uint8* src_argb, uint8* dst_argb,
|
||||
int width) = ARGBUnattenuateRow_C;
|
||||
@ -1250,12 +1231,12 @@ int ARGBGrayTo(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBGrayTo(src_argb, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBGrayRow)(const uint8* src_argb, uint8* dst_argb,
|
||||
int width) = ARGBGrayRow_C;
|
||||
@ -1287,11 +1268,11 @@ int ARGBGray(uint8* dst_argb, int dst_stride_argb,
|
||||
if (!dst_argb || width <= 0 || height <= 0 || dst_x < 0 || dst_y < 0) {
|
||||
return -1;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (dst_stride_argb == width * 4) {
|
||||
return ARGBGray(dst_argb, dst_stride_argb,
|
||||
dst_x, dst_y,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBGrayRow)(const uint8* src_argb, uint8* dst_argb,
|
||||
int width) = ARGBGrayRow_C;
|
||||
@ -1320,11 +1301,11 @@ int ARGBSepia(uint8* dst_argb, int dst_stride_argb,
|
||||
if (!dst_argb || width <= 0 || height <= 0 || dst_x < 0 || dst_y < 0) {
|
||||
return -1;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (dst_stride_argb == width * 4) {
|
||||
return ARGBSepia(dst_argb, dst_stride_argb,
|
||||
dst_x, dst_y,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBSepiaRow)(uint8* dst_argb, int width) = ARGBSepiaRow_C;
|
||||
#if defined(HAS_ARGBSEPIAROW_SSSE3)
|
||||
@ -1360,13 +1341,12 @@ int ARGBColorMatrix(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBColorMatrix(src_argb, 0,
|
||||
dst_argb, 0,
|
||||
matrix_argb,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBColorMatrixRow)(const uint8* src_argb, uint8* dst_argb,
|
||||
const int8* matrix_argb, int width) = ARGBColorMatrixRow_C;
|
||||
@ -1432,12 +1412,11 @@ int ARGBColorTable(uint8* dst_argb, int dst_stride_argb,
|
||||
dst_x < 0 || dst_y < 0) {
|
||||
return -1;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (dst_stride_argb == width * 4) {
|
||||
return ARGBColorTable(dst_argb, dst_stride_argb,
|
||||
table_argb,
|
||||
dst_x, dst_y,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBColorTableRow)(uint8* dst_argb, const uint8* table_argb,
|
||||
int width) = ARGBColorTableRow_C;
|
||||
@ -1464,12 +1443,11 @@ int RGBColorTable(uint8* dst_argb, int dst_stride_argb,
|
||||
dst_x < 0 || dst_y < 0) {
|
||||
return -1;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (dst_stride_argb == width * 4) {
|
||||
return RGBColorTable(dst_argb, dst_stride_argb,
|
||||
table_argb,
|
||||
dst_x, dst_y,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
dst_stride_argb = 0;
|
||||
}
|
||||
void (*RGBColorTableRow)(uint8* dst_argb, const uint8* table_argb,
|
||||
int width) = RGBColorTableRow_C;
|
||||
@ -1503,12 +1481,11 @@ int ARGBQuantize(uint8* dst_argb, int dst_stride_argb,
|
||||
interval_size < 1 || interval_size > 255) {
|
||||
return -1;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (dst_stride_argb == width * 4) {
|
||||
return ARGBQuantize(dst_argb, dst_stride_argb,
|
||||
scale, interval_size, interval_offset,
|
||||
dst_x, dst_y,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBQuantizeRow)(uint8* dst_argb, int scale, int interval_size,
|
||||
int interval_offset, int width) = ARGBQuantizeRow_C;
|
||||
@ -1669,13 +1646,12 @@ int ARGBShade(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBShade(src_argb, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1,
|
||||
value);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBShadeRow)(const uint8* src_argb, uint8* dst_argb,
|
||||
int width, uint32 value) = ARGBShadeRow_C;
|
||||
@ -1700,8 +1676,6 @@ int ARGBShade(const uint8* src_argb, int src_stride_argb,
|
||||
}
|
||||
|
||||
// Interpolate 2 ARGB images by specified amount (0 to 255).
|
||||
// TODO(fbarchard): Consider selecting a specialization for interpolation so
|
||||
// row function doesn't need to check interpolation on each row.
|
||||
LIBYUV_API
|
||||
int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0,
|
||||
const uint8* src_argb1, int src_stride_argb1,
|
||||
@ -1716,15 +1690,13 @@ int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0,
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb0 == width * 4 &&
|
||||
src_stride_argb1 == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBInterpolate(src_argb0, 0,
|
||||
src_argb1, 0,
|
||||
dst_argb, 0,
|
||||
width * height, 1,
|
||||
interpolation);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb0 = src_stride_argb1 = dst_stride_argb = 0;
|
||||
}
|
||||
void (*InterpolateRow)(uint8* dst_ptr, const uint8* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
@ -1805,13 +1777,12 @@ int ARGBShuffle(const uint8* src_bgra, int src_stride_bgra,
|
||||
src_bgra = src_bgra + (height - 1) * src_stride_bgra;
|
||||
src_stride_bgra = -src_stride_bgra;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
// Coalesce rows.
|
||||
if (src_stride_bgra == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
return ARGBShuffle(src_bgra, 0,
|
||||
dst_argb, 0,
|
||||
shuffler,
|
||||
width * height, 1);
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_bgra = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBShuffleRow)(const uint8* src_bgra, uint8* dst_argb,
|
||||
const uint8* shuffler, int pix) = ARGBShuffleRow_C;
|
||||
@ -2040,12 +2011,12 @@ int ARGBPolynomial(const uint8* src_argb, int src_stride_argb,
|
||||
if (!src_argb || !dst_argb || !poly || width <= 0 || height <= 0) {
|
||||
return -1;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
if (src_stride_argb == width * 4 && dst_stride_argb == width * 4) {
|
||||
return ARGBPolynomial(src_argb, 0,
|
||||
dst_argb, 0,
|
||||
poly,
|
||||
width * height, 1);
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBPolynomialRow)(const uint8* src_argb,
|
||||
uint8* dst_argb, const float* poly,
|
||||
@ -2078,12 +2049,12 @@ int ARGBLumaColorTable(const uint8* src_argb, int src_stride_argb,
|
||||
if (!src_argb || !dst_argb || !luma || width <= 0 || height <= 0) {
|
||||
return -1;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
if (src_stride_argb == width * 4 && dst_stride_argb == width * 4) {
|
||||
return ARGBLumaColorTable(src_argb, 0,
|
||||
dst_argb, 0,
|
||||
luma,
|
||||
width * height, 1);
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb = 0;
|
||||
}
|
||||
void (*ARGBLumaColorTableRow)(const uint8* src_argb,
|
||||
uint8* dst_argb, const uint8* luma,
|
||||
@ -2106,8 +2077,6 @@ LIBYUV_API
|
||||
int ARGBCopyAlpha(const uint8* src_argb, int src_stride_argb,
|
||||
uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height) {
|
||||
// TODO(fbarchard): Consider macro for boiler plate checks, invert and/or
|
||||
// row coalesce.
|
||||
if (!src_argb || !dst_argb || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -2117,8 +2086,9 @@ int ARGBCopyAlpha(const uint8* src_argb, int src_stride_argb,
|
||||
src_argb = src_argb + (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
if (src_stride_argb == width * 4 && dst_stride_argb == width * 4) {
|
||||
// Coalesce rows.
|
||||
if (src_stride_argb == width * 4 &&
|
||||
dst_stride_argb == width * 4) {
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_argb = dst_stride_argb = 0;
|
||||
@ -2160,8 +2130,9 @@ int ARGBCopyYToAlpha(const uint8* src_y, int src_stride_y,
|
||||
src_y = src_y + (height - 1) * src_stride_y;
|
||||
src_stride_y = -src_stride_y;
|
||||
}
|
||||
// Coalesce contiguous rows.
|
||||
if (src_stride_y == width && dst_stride_argb == width * 4) {
|
||||
// Coalesce rows.
|
||||
if (src_stride_y == width &&
|
||||
dst_stride_argb == width * 4) {
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride_y = dst_stride_argb = 0;
|
||||
|
||||
@ -322,7 +322,7 @@ TEST_F(libyuvTest, Psnr) {
|
||||
free_aligned_buffer_64(src_b)
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, BenchmarkSsim_Opt) {
|
||||
TEST_F(libyuvTest, DISABLED_BenchmarkSsim_Opt) {
|
||||
align_buffer_64(src_a, benchmark_width_ * benchmark_height_)
|
||||
align_buffer_64(src_b, benchmark_width_ * benchmark_height_)
|
||||
for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
|
||||
|
||||
@ -987,7 +987,6 @@ TESTINTERPOLATE(64)
|
||||
TESTINTERPOLATE(128)
|
||||
TESTINTERPOLATE(192)
|
||||
TESTINTERPOLATE(255)
|
||||
TESTINTERPOLATE(85)
|
||||
|
||||
static int TestBlend(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
|
||||
@ -213,20 +213,18 @@ static int ARGBClipTestFilter(int src_width, int src_height,
|
||||
// Test a scale factor with 2 filters. Expect unfiltered to be exact, but
|
||||
// filtering is different fixed point implementations for SSSE3, Neon and C.
|
||||
#define TEST_FACTOR(name, hfactor, vfactor) \
|
||||
TEST_FACTOR1(name, None, hfactor, vfactor, 0) \
|
||||
TEST_FACTOR1(name, Bilinear, hfactor, vfactor, 2)
|
||||
|
||||
// TODO(fbarchard): ScaleDownBy1 should be lossless, but Box has error of 2.
|
||||
TEST_FACTOR(1, 1 / 1, 1 / 1)
|
||||
//TEST_FACTOR(1, 1 / 1, 1 / 1)
|
||||
TEST_FACTOR(2, 1 / 2, 1 / 2)
|
||||
TEST_FACTOR(4, 1 / 4, 1 / 4)
|
||||
TEST_FACTOR(5, 1 / 5, 1 / 5)
|
||||
TEST_FACTOR(8, 1 / 8, 1 / 8)
|
||||
TEST_FACTOR(16, 1 / 16, 1 / 16)
|
||||
TEST_FACTOR(2by3, 2 / 3, 2 / 3)
|
||||
//TEST_FACTOR(8, 1 / 8, 1 / 8)
|
||||
//TEST_FACTOR(16, 1 / 16, 1 / 16)
|
||||
//TEST_FACTOR(2by3, 2 / 3, 2 / 3)
|
||||
TEST_FACTOR(3by4, 3 / 4, 3 / 4)
|
||||
TEST_FACTOR(3by8, 3 / 8, 3 / 8)
|
||||
TEST_FACTOR(Vertical2by3, 1, 2 / 3)
|
||||
//TEST_FACTOR(3by8, 3 / 8, 3 / 8)
|
||||
//TEST_FACTOR(Vertical2by3, 1, 2 / 3)
|
||||
#undef TEST_FACTOR1
|
||||
#undef TEST_FACTOR
|
||||
|
||||
@ -259,11 +257,10 @@ TEST_FACTOR(Vertical2by3, 1, 2 / 3)
|
||||
// Test scale to a specified size with all 3 filters.
|
||||
#define TEST_SCALETO(name, width, height) \
|
||||
TEST_SCALETO1(name, width, height, None, 0) \
|
||||
TEST_SCALETO1(name, width, height, Bilinear, 2) \
|
||||
TEST_SCALETO1(name, width, height, Box, 2)
|
||||
TEST_SCALETO1(name, width, height, Bilinear, 2)
|
||||
|
||||
TEST_SCALETO(DISABLED_ARGBScale, 640, 360)
|
||||
TEST_SCALETO(ARGBScale, 853, 480)
|
||||
TEST_SCALETO(ARGBScale, 640, 360)
|
||||
TEST_SCALETO(DISABLED_ARGBScale, 853, 480)
|
||||
TEST_SCALETO(DISABLED_ARGBScale, 1280, 720)
|
||||
TEST_SCALETO(DISABLED_ARGBScale, 1280, 800)
|
||||
TEST_SCALETO(DISABLED_ARGBScale, 1366, 768)
|
||||
|
||||
@ -149,16 +149,15 @@ static int TestFilter(int src_width, int src_height,
|
||||
TEST_FACTOR1(name, Box, hfactor, vfactor, 2) \
|
||||
|
||||
// TODO(fbarchard): ScaleDownBy1 should be lossless, but Box has error of 2.
|
||||
TEST_FACTOR(1, 1 / 1, 1 / 1)
|
||||
//TEST_FACTOR(1, 1 / 1, 1 / 1)
|
||||
TEST_FACTOR(2, 1 / 2, 1 / 2)
|
||||
TEST_FACTOR(4, 1 / 4, 1 / 4)
|
||||
TEST_FACTOR(5, 1 / 5, 1 / 5)
|
||||
TEST_FACTOR(8, 1 / 8, 1 / 8)
|
||||
TEST_FACTOR(16, 1 / 16, 1 / 16)
|
||||
TEST_FACTOR(2by3, 2 / 3, 2 / 3)
|
||||
//TEST_FACTOR(8, 1 / 8, 1 / 8)
|
||||
//TEST_FACTOR(16, 1 / 16, 1 / 16)
|
||||
//TEST_FACTOR(2by3, 2 / 3, 2 / 3)
|
||||
TEST_FACTOR(3by4, 3 / 4, 3 / 4)
|
||||
TEST_FACTOR(3by8, 3 / 8, 3 / 8)
|
||||
TEST_FACTOR(Vertical2by3, 1, 2 / 3)
|
||||
//TEST_FACTOR(3by8, 3 / 8, 3 / 8)
|
||||
//TEST_FACTOR(Vertical2by3, 1, 2 / 3)
|
||||
#undef TEST_FACTOR1
|
||||
#undef TEST_FACTOR
|
||||
|
||||
@ -179,11 +178,10 @@ TEST_FACTOR(Vertical2by3, 1, 2 / 3)
|
||||
// Test scale to a specified size with all 3 filters.
|
||||
#define TEST_SCALETO(name, width, height) \
|
||||
TEST_SCALETO1(name, width, height, None, 0) \
|
||||
TEST_SCALETO1(name, width, height, Bilinear, 2) \
|
||||
TEST_SCALETO1(name, width, height, Box, 2)
|
||||
|
||||
TEST_SCALETO(DISABLED_Scale, 640, 360)
|
||||
TEST_SCALETO(Scale, 853, 480)
|
||||
TEST_SCALETO(Scale, 640, 360)
|
||||
TEST_SCALETO(DISABLED_Scale, 853, 480)
|
||||
TEST_SCALETO(DISABLED_Scale, 1280, 720)
|
||||
TEST_SCALETO(DISABLED_Scale, 1280, 800)
|
||||
TEST_SCALETO(DISABLED_Scale, 1366, 768)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user