Commit ddf11462 authored by fbarchard@google.com's avatar fbarchard@google.com

More accurate tests when running improved luma/chroma accuracy code.

BUG=324
TESTED=TestYUV
R=harryjin@google.com

Review URL: https://webrtc-codereview.appspot.com/39589004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1237 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent e7873910
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 1236 Version: 1237
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1236 #define LIBYUV_VERSION 1237
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -115,23 +115,22 @@ TESTCS(TestI422, I422ToARGB, ARGBToI422, 0, 1, 0, 7) ...@@ -115,23 +115,22 @@ TESTCS(TestI422, I422ToARGB, ARGBToI422, 0, 1, 0, 7)
TESTCS(TestJ420, J420ToARGB, ARGBToJ420, 1, 2, benchmark_width_, 3) TESTCS(TestJ420, J420ToARGB, ARGBToJ420, 1, 2, benchmark_width_, 3)
TESTCS(TestJ422, J422ToARGB, ARGBToJ422, 0, 1, 0, 4) TESTCS(TestJ422, J422ToARGB, ARGBToJ422, 0, 1, 0, 4)
void YUVToRGB(int y, int u, int v, int* r, int* g, int* b) { static void YUVToRGB(int y, int u, int v, int* r, int* g, int* b) {
const int kWidth = 128; const int kWidth = 16;
const int kHeight = 2; const int kHeight = 1;
const int kPixels = kWidth * kHeight; const int kPixels = kWidth * kHeight;
const int kHalfPixels = ((kWidth + 1) / 2) * ((kHeight + 1) / 2); const int kHalfPixels = ((kWidth + 1) / 2) * ((kHeight + 1) / 2);
align_buffer_64(orig_y, kPixels);
align_buffer_64(orig_u, kHalfPixels);
align_buffer_64(orig_v, kHalfPixels);
align_buffer_64(orig_pixels, kPixels * 4);
SIMD_ALIGNED(uint8 orig_y[16]);
SIMD_ALIGNED(uint8 orig_u[8]);
SIMD_ALIGNED(uint8 orig_v[8]);
SIMD_ALIGNED(uint8 orig_pixels[16 * 1 * 4]);
memset(orig_y, y, kPixels); memset(orig_y, y, kPixels);
memset(orig_u, u, kHalfPixels); memset(orig_u, u, kHalfPixels);
memset(orig_v, v, kHalfPixels); memset(orig_v, v, kHalfPixels);
MemRandomize(orig_pixels, kPixels * 4);
/* YUV converted to ARGB. */ /* YUV converted to ARGB. */
I420ToARGB(orig_y, kWidth, I422ToARGB(orig_y, kWidth,
orig_u, (kWidth + 1) / 2, orig_u, (kWidth + 1) / 2,
orig_v, (kWidth + 1) / 2, orig_v, (kWidth + 1) / 2,
orig_pixels, kWidth * 4, orig_pixels, kWidth * 4,
...@@ -140,14 +139,9 @@ void YUVToRGB(int y, int u, int v, int* r, int* g, int* b) { ...@@ -140,14 +139,9 @@ void YUVToRGB(int y, int u, int v, int* r, int* g, int* b) {
*b = orig_pixels[0]; *b = orig_pixels[0];
*g = orig_pixels[1]; *g = orig_pixels[1];
*r = orig_pixels[2]; *r = orig_pixels[2];
free_aligned_buffer_64(orig_pixels);
free_aligned_buffer_64(orig_y);
free_aligned_buffer_64(orig_u);
free_aligned_buffer_64(orig_v);
} }
int RoundToByte(double f) { static int RoundToByte(double f) {
int i = lrintf(f); int i = lrintf(f);
if (i < 0) { if (i < 0) {
i = 0; i = 0;
...@@ -158,7 +152,7 @@ int RoundToByte(double f) { ...@@ -158,7 +152,7 @@ int RoundToByte(double f) {
return i; return i;
} }
void YUVToRGBReference(int y, int u, int v, int* r, int* g, int* b) { static void YUVToRGBReference(int y, int u, int v, int* r, int* g, int* b) {
*r = RoundToByte((y - 16) * 1.164 + (v - 128) * 1.596); *r = RoundToByte((y - 16) * 1.164 + (v - 128) * 1.596);
*g = RoundToByte((y - 16) * 1.164 + (u - 128) * -0.391 + (v - 128) * -0.813); *g = RoundToByte((y - 16) * 1.164 + (u - 128) * -0.391 + (v - 128) * -0.813);
*b = RoundToByte((y - 16) * 1.164 + (u - 128) * 2.018); *b = RoundToByte((y - 16) * 1.164 + (u - 128) * 2.018);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment