Commit 48da8c29 authored by fbarchard@google.com's avatar fbarchard@google.com

print min max error per channel

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

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1244 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent b0895936
......@@ -270,11 +270,15 @@ TEST_F(libyuvTest, TestGreyYUV) {
}
// This full test should be run occassionally to test all values are accurate.
// TODO(fbarchard): Determine error distribution.
TEST_F(libyuvTest, TestFullYUV) {
int i;
// If using small image, step faster.
int step = benchmark_width_ <= 128 ? 3 : 1;
int r0, g0, b0, r1, g1, b1;
int rn[256] = { 0, }, gn[256] = { 0, },
bn[256] = { 0, }, rx[256] = { 0, },
gx[256] = { 0, }, bx[256] = { 0, };
int rh[256] = { 0, }, gh[256] = { 0, }, bh[256] = { 0, };
for (int y = 0; y < 256; y += step) {
for (int u = 0; u < 256; u += step) {
for (int v = 0; v < 256; v += step) {
......@@ -283,9 +287,52 @@ TEST_F(libyuvTest, TestFullYUV) {
EXPECT_NEAR(r0, r1, ERROR_R);
EXPECT_NEAR(g0, g1, ERROR_G);
EXPECT_NEAR(b0, b1, ERROR_B);
int rd = r1 - r0;
int gd = g1 - g0;
int bd = b1 - b0;
++rh[rd + 128];
++gh[gd + 128];
++bh[bd + 128];
if (rd < rn[r0]) { rn[r0] = rd; }
if (gd < gn[g0]) { gn[g0] = gd; }
if (bd < bn[b0]) { bn[b0] = bd; }
if (rd > rx[r0]) { rx[r0] = rd; }
if (gd > gx[g0]) { gx[g0] = gd; }
if (bd > bx[b0]) { bx[b0] = bd; }
}
}
}
if (step == 1) {
for (i = 0; i < 256; ++i) {
printf("red %d %d, green %d %d, blue %d %d\n",
rn[i], rx[i], gn[i], gx[i], bn[i], bx[i]);
}
}
printf("hist\t");
for (i = 0; i < 256; ++i) {
if (rh[i] || gh[i] || bh[i]) {
printf("\t%d", i - 128);
}
}
printf("\nred\t");
for (i = 0; i < 256; ++i) {
if (rh[i] || gh[i] || bh[i]) {
printf("\t%d", rh[i]);
}
}
printf("\ngreen\t");
for (i = 0; i < 256; ++i) {
if (rh[i] || gh[i] || bh[i]) {
printf("\t%d", gh[i]);
}
}
printf("\nblue\t");
for (i = 0; i < 256; ++i) {
if (rh[i] || gh[i] || bh[i]) {
printf("\t%d", bh[i]);
}
}
printf("\n");
}
} // namespace libyuv
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