mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
gargantuan width support on ARGBScale
BUG=302 TEST=libyuv ARGBScale tests with LIBYUV_WIDTH=90000 R=tpsiaki@google.com Review URL: https://webrtc-codereview.appspot.com/6519005 git-svn-id: http://libyuv.googlecode.com/svn/trunk@944 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
ac9b96c076
commit
6dc80ab585
@ -144,6 +144,8 @@ void ScaleARGBColsUp2_C(uint8* dst_argb, const uint8* src_argb,
|
|||||||
int dst_width, int, int);
|
int dst_width, int, int);
|
||||||
void ScaleARGBFilterCols_C(uint8* dst_argb, const uint8* src_argb,
|
void ScaleARGBFilterCols_C(uint8* dst_argb, const uint8* src_argb,
|
||||||
int dst_width, int x, int dx);
|
int dst_width, int x, int dx);
|
||||||
|
void ScaleARGBFilterCols64_C(uint8* dst_argb, const uint8* src_argb,
|
||||||
|
int dst_width, int x, int dx);
|
||||||
|
|
||||||
void ScaleRowDown2_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
|
void ScaleRowDown2_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
|
||||||
uint8* dst_ptr, int dst_width);
|
uint8* dst_ptr, int dst_width);
|
||||||
|
|||||||
@ -162,7 +162,7 @@ static void ScaleARGBDownEven(int src_width, int src_height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Scale ARGB down with bilinear interpolation.
|
// Scale ARGB down with bilinear interpolation.
|
||||||
static void ScaleARGBBilinearDown(int src_height,
|
static void ScaleARGBBilinearDown(int src_width, int src_height,
|
||||||
int dst_width, int dst_height,
|
int dst_width, int dst_height,
|
||||||
int src_stride, int dst_stride,
|
int src_stride, int dst_stride,
|
||||||
const uint8* src_argb, uint8* dst_argb,
|
const uint8* src_argb, uint8* dst_argb,
|
||||||
@ -230,9 +230,10 @@ static void ScaleARGBBilinearDown(int src_height,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb,
|
void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb,
|
||||||
int dst_width, int x, int dx) = ScaleARGBFilterCols_C;
|
int dst_width, int x, int dx) =
|
||||||
|
(src_width >= 32768) ? ScaleARGBFilterCols64_C : ScaleARGBFilterCols_C;
|
||||||
#if defined(HAS_SCALEARGBFILTERCOLS_SSSE3)
|
#if defined(HAS_SCALEARGBFILTERCOLS_SSSE3)
|
||||||
if (TestCpuFlag(kCpuHasSSSE3)) {
|
if (TestCpuFlag(kCpuHasSSSE3) && src_width < 32768) {
|
||||||
ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3;
|
ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -321,13 +322,16 @@ static void ScaleARGBBilinearUp(int src_width, int src_height,
|
|||||||
void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb,
|
void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb,
|
||||||
int dst_width, int x, int dx) =
|
int dst_width, int x, int dx) =
|
||||||
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
|
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
|
||||||
|
if (filtering && src_width >= 32768) {
|
||||||
|
ScaleARGBFilterCols = ScaleARGBFilterCols64_C;
|
||||||
|
}
|
||||||
#if defined(HAS_SCALEARGBFILTERCOLS_SSSE3)
|
#if defined(HAS_SCALEARGBFILTERCOLS_SSSE3)
|
||||||
if (filtering && TestCpuFlag(kCpuHasSSSE3)) {
|
if (filtering && TestCpuFlag(kCpuHasSSSE3) && src_width < 32768) {
|
||||||
ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3;
|
ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAS_SCALEARGBCOLS_SSE2)
|
#if defined(HAS_SCALEARGBCOLS_SSE2)
|
||||||
if (!filtering && TestCpuFlag(kCpuHasSSE2)) {
|
if (!filtering && TestCpuFlag(kCpuHasSSE2) && src_width < 32768) {
|
||||||
ScaleARGBFilterCols = ScaleARGBCols_SSE2;
|
ScaleARGBFilterCols = ScaleARGBCols_SSE2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -500,13 +504,34 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height,
|
|||||||
InterpolateRow = InterpolateRow_MIPS_DSPR2;
|
InterpolateRow = InterpolateRow_MIPS_DSPR2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb,
|
void (*ScaleARGBFilterCols)(uint8* dst_argb, const uint8* src_argb,
|
||||||
int dst_width, int x, int dx) = ScaleARGBFilterCols_C;
|
int dst_width, int x, int dx) =
|
||||||
|
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
|
||||||
|
if (filtering && src_width >= 32768) {
|
||||||
|
ScaleARGBFilterCols = ScaleARGBFilterCols64_C;
|
||||||
|
}
|
||||||
#if defined(HAS_SCALEARGBFILTERCOLS_SSSE3)
|
#if defined(HAS_SCALEARGBFILTERCOLS_SSSE3)
|
||||||
if (TestCpuFlag(kCpuHasSSSE3)) {
|
if (filtering && TestCpuFlag(kCpuHasSSSE3) && src_width < 32768) {
|
||||||
ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3;
|
ScaleARGBFilterCols = ScaleARGBFilterCols_SSSE3;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAS_SCALEARGBCOLS_SSE2)
|
||||||
|
if (!filtering && TestCpuFlag(kCpuHasSSE2) && src_width < 32768) {
|
||||||
|
ScaleARGBFilterCols = ScaleARGBCols_SSE2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (!filtering && src_width * 2 == dst_width && x < 0x8000) {
|
||||||
|
ScaleARGBFilterCols = ScaleARGBColsUp2_C;
|
||||||
|
#if defined(HAS_SCALEARGBCOLSUP2_SSE2)
|
||||||
|
if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(dst_width, 8) &&
|
||||||
|
IS_ALIGNED(src_argb, 16) && IS_ALIGNED(src_stride, 16) &&
|
||||||
|
IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride, 16)) {
|
||||||
|
ScaleARGBFilterCols = ScaleARGBColsUp2_SSE2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
const int max_y = (src_height - 1) << 16;
|
const int max_y = (src_height - 1) << 16;
|
||||||
if (y > max_y) {
|
if (y > max_y) {
|
||||||
y = max_y;
|
y = max_y;
|
||||||
@ -716,7 +741,7 @@ static void ScaleARGB(const uint8* src, int src_stride,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (filtering) {
|
if (filtering) {
|
||||||
ScaleARGBBilinearDown(src_height,
|
ScaleARGBBilinearDown(src_width, src_height,
|
||||||
clip_width, clip_height,
|
clip_width, clip_height,
|
||||||
src_stride, dst_stride, src, dst,
|
src_stride, dst_stride, src, dst,
|
||||||
x, dx, y, dy, filtering);
|
x, dx, y, dy, filtering);
|
||||||
|
|||||||
@ -477,6 +477,35 @@ void ScaleARGBFilterCols_C(uint8* dst_argb, const uint8* src_argb,
|
|||||||
dst[0] = BLENDER(a, b, xf);
|
dst[0] = BLENDER(a, b, xf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScaleARGBFilterCols64_C(uint8* dst_argb, const uint8* src_argb,
|
||||||
|
int dst_width, int x32, int dx) {
|
||||||
|
int64 x = static_cast<int64>(x32);
|
||||||
|
const uint32* src = reinterpret_cast<const uint32*>(src_argb);
|
||||||
|
uint32* dst = reinterpret_cast<uint32*>(dst_argb);
|
||||||
|
for (int j = 0; j < dst_width - 1; j += 2) {
|
||||||
|
int64 xi = x >> 16;
|
||||||
|
int xf = (x >> 9) & 0x7f;
|
||||||
|
uint32 a = src[xi];
|
||||||
|
uint32 b = src[xi + 1];
|
||||||
|
dst[0] = BLENDER(a, b, xf);
|
||||||
|
x += dx;
|
||||||
|
xi = x >> 16;
|
||||||
|
xf = (x >> 9) & 0x7f;
|
||||||
|
a = src[xi];
|
||||||
|
b = src[xi + 1];
|
||||||
|
dst[1] = BLENDER(a, b, xf);
|
||||||
|
x += dx;
|
||||||
|
dst += 2;
|
||||||
|
}
|
||||||
|
if (dst_width & 1) {
|
||||||
|
int64 xi = x >> 16;
|
||||||
|
int xf = (x >> 9) & 0x7f;
|
||||||
|
uint32 a = src[xi];
|
||||||
|
uint32 b = src[xi + 1];
|
||||||
|
dst[0] = BLENDER(a, b, xf);
|
||||||
|
}
|
||||||
|
}
|
||||||
#undef BLENDER1
|
#undef BLENDER1
|
||||||
#undef BLENDERC
|
#undef BLENDERC
|
||||||
#undef BLENDER
|
#undef BLENDER
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user