iamnpc / libyuv

Automatically exported from code.google.com/p/libyuv
0 stars 0 forks source link

planar test fails on non-x86 #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. build
2. run unit-tests on s390x or ppc64

What is the expected output? What do you see instead?
[ RUN      ] libyuvTest.TestAttenuate
planar_test.cc:158: Failure
Value of: unatten_pixels[2][2]
  Actual: 
Expected: 192u
Which is: 192
[  FAILED  ] libyuvTest.TestAttenuate (8256 ms)

the "Actual" value is 193

What version of the product are you using? On what operating system?
Fedora 16 on s390x

Please provide any additional information below.
I did the computation done in ARGBUnattenuateRow_C() by hand and the result is 
193 which is also what the test-suite returns. It seems to me that the SSE 
optimized and C versions return different results.

And the reason is that "8.16 fixed point inverse table" is different between 
row_common.cc and row_posix.cc (which is the same as row_win.cc, see the value 
for index 255) and also width of numbers used is probably different (I haven't 
studied the algorithms deeply)

  T(0xf8), T(0xf9), T(0xfa), T(0xfb), T(0xfc), T(0xfd), T(0xfe), T(0xff)
vs.
  T(0xf8), T(0xf9), T(0xfa), T(0xfb), T(0xfc), T(0xfd), T(0xfe), 0x100

Original issue reported on code.google.com by d...@danny.cz on 17 May 2012 at 4:31

GoogleCodeExporter commented 9 years ago
Thanks for the report!  When feasible, I make the C code mimic the SSE.  But 
its not always practical - it would loose a lot of performance.

This unattenuate is a new function, which not used by WebRtc directly... its 
for 'Effects'.

The C versions can be tested on x86 by disabling CPUs.
gclient runhooks
devenv -build Debug libyuv_test.sln
build\debug\libyuv_unittest.exe  --gtest_catch_exceptions=0 --gtest_filter=*ten*
set LIBYUV_DISABLE_SSE2=1
build\debug\libyuv_unittest.exe  --gtest_catch_exceptions=0 --gtest_filter=*ten*
Note: Google Test filter = *ten*
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from libyuvTest
[ RUN      ] libyuvTest.TestAttenuate
.\unit_test\planar_test.cc(158): error: Value of: unatten_pixels[2][2]
  Actual: '\xC1' (193)
Expected: 192u
Which is: 192
[  FAILED  ] libyuvTest.TestAttenuate (874 ms)
[----------] 1 test from libyuvTest (876 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (880 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] libyuvTest.TestAttenuate

 1 FAILED TEST

Original comment by fbarch...@chromium.org on 17 May 2012 at 8:56

GoogleCodeExporter commented 9 years ago
Fixed in r268
https://webrtc-codereview.appspot.com/585004
The C version just needed the last constant to be 1.0.  But I made it use the 
same table as SSE2, so the results are identical and no speed difference.

Original comment by fbarch...@chromium.org on 17 May 2012 at 10:51

GoogleCodeExporter commented 9 years ago
I confirm that r268 passes the test on Fedora 16 on s390x, thanks guys.

Original comment by d...@danny.cz on 18 May 2012 at 6:48