mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 17:26:49 +08:00
Support invert for ARGBRect and SetPlane
BUG=387 TESTED=ARGBRect_Invert R=harryjin@google.com Review URL: https://webrtc-codereview.appspot.com/37539004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@1219 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
992c3b089a
commit
8e3db2dc73
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1218
|
||||
Version: 1219
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1218
|
||||
#define LIBYUV_VERSION 1219
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -1096,6 +1096,11 @@ void SetPlane(uint8* dst_y, int dst_stride_y,
|
||||
int y;
|
||||
uint32 v32 = value | (value << 8) | (value << 16) | (value << 24);
|
||||
void (*SetRow)(uint8* dst, uint32 value, int pix) = SetRow_C;
|
||||
if (height < 0) {
|
||||
height = -height;
|
||||
dst_y = dst_y + (height - 1) * dst_stride_y;
|
||||
dst_stride_y = -dst_stride_y;
|
||||
}
|
||||
// Coalesce rows.
|
||||
if (dst_stride_y == width) {
|
||||
width *= height;
|
||||
@ -1155,10 +1160,15 @@ int ARGBRect(uint8* dst_argb, int dst_stride_argb,
|
||||
int width, int height,
|
||||
uint32 value) {
|
||||
if (!dst_argb ||
|
||||
width <= 0 || height <= 0 ||
|
||||
width <= 0 || height == 0 ||
|
||||
dst_x < 0 || dst_y < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (height < 0) {
|
||||
height = -height;
|
||||
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||
dst_stride_argb = -dst_stride_argb;
|
||||
}
|
||||
dst_argb += dst_y * dst_stride_argb + dst_x * 4;
|
||||
// Coalesce rows.
|
||||
if (dst_stride_argb == width * 4) {
|
||||
|
||||
@ -2149,8 +2149,6 @@ static int TestARGBRect(int width, int height, int benchmark_iterations,
|
||||
return max_diff;
|
||||
}
|
||||
|
||||
// TODO(fbarchard): Add invert support and test.
|
||||
|
||||
TEST_F(libyuvTest, ARGBRect_Any) {
|
||||
int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, 4);
|
||||
@ -2163,6 +2161,12 @@ TEST_F(libyuvTest, ARGBRect_Unaligned) {
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRect_Invert) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0, 4);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBRect_Opt) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, 4);
|
||||
@ -2181,11 +2185,16 @@ TEST_F(libyuvTest, SetPlane_Unaligned) {
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, SetPlane_Invert) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, -1, 0, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, SetPlane_Opt) {
|
||||
int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 0, 1);
|
||||
EXPECT_EQ(0, max_diff);
|
||||
}
|
||||
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user