64 Commits

Author SHA1 Message Date
Frank Barchard
55b97cb48f BIT_EXACT for unattenuate and attenuate.
- reenable Intel SIMD unaffected by BIT_EXACT
- add bit exact version of ARGBAttenuate, which uses ARM version of formula.
- add bit exact version of ARGBUnatenuate, which mimics the AVX code.

Apply clang format to cleanup code.

Bug: libyuv:908, b/202888439
Change-Id: Ie842b1b3956b48f4190858e61c02998caedc2897
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3224702
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
2021-10-15 19:46:02 +00:00
Frank Barchard
b9bd1b5537 DISABLE_SLOW_TESTS replaces ENABLE_SLOW_TESTS
- change default to enable all tests for better test/bot coverage
- DISABLE_SLOW_TESTS turns off tests that are redundent or unoptimized

Bug: libyuv:905, b/197551385
Change-Id: Ia720526864af774a009852751a1a85c6b1b7f978
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3183099
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
2021-09-27 22:40:43 +00:00
Frank Barchard
49ebc996aa Make 2 step transitive tests measure 2 step time.
Add tests of all macros used by libyuv public headers

When a 1 step conversion is added, a 2 step test can compare
the old 2 step method to the 1 step.  A 1 step unittest is
also added which compares C to SIMD.  Making the 2 step
conversions measure performance of the 2 steps allows the
old 2 step performance to be compared to 1 step.

All macros used in public headers are added to an ifdef test.
Showing them in a unittest allows some diagnostics when
a test is failing.

Bug: libyuv:901
Change-Id: I7ffa6ed0cb3b506fa1b7fd4b7b1b729658c3c266
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2857916
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
2021-04-30 18:14:57 +00:00
Frank Barchard
5e05f26a2b Switch win32 to row_gcc for clangcl.
Bug: libyuv:900, libyuv:848, b/178283356, b/185922513
Change-Id: I7697953753391c555a778198db36412c853fb29e
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2844962
Reviewed-by: richard winterton <rrwinterton@gmail.com>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
2021-04-22 19:32:32 +00:00
Yuan Tong
590c17ce40 Refactor NEON YUVToRGB, Remove subsampling
Refactor NEON YUVToRGB Assembly to support HBD data as input and output.
Work on YUV444 internally, remove subsampling in I444ToARGB.

libyuv_unittest --gtest_filter=*.NV??ToARGB_Opt:*UYVYToARGB_Opt:*YUY2ToARGB_Opt:*I4*ToARGB_Opt

Bug: libyuv:895, libyuv:862, libyuv:863
Change-Id: I05b56ea8ea56d9e523720b842fa6e4b122ed4115
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2810060
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
2021-04-15 19:13:10 +00:00
Frank Barchard
12a4a2372c Rounding added to scaling upsampler
Bug: libyuv:872, b/178521093
Change-Id: I86749f73f5e55d5fd8b87ea6938084cbacb1cda7
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2686945
Reviewed-by: Wan-Teh Chang <wtc@google.com>
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
2021-02-10 18:51:02 +00:00
Frank Barchard
942c508448 BT.2020 Full Range yuvconstants
new color util to compute constants needed based on white point.

[ RUN      ] LibYUVColorTest.TestFullYUVV
hist	      -2	      -1	       0	       1	       2
red	       0	 1627136	13670144	 1479936	       0
green	  319285	 3456836	 9243059	 3440771	  317265
blue	       0	 1561088	14202112	 1014016	       0

Bug: libyuv:877, b/178283356
Change-Id: If432ebfab76b01302fdb416a153c4f26ca0832d6
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2678859
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
2021-02-06 00:26:55 +00:00
Frank Barchard
37480f12c6 Add BT.709 Full Range yuv constants.
MAKEYUVCONSTANTS macro to generate struct for YUV to RGB
Fix I444AlphaToARGB unit test for ARM by adjusting C version to match Neon implementation.

Bug: libyuv:879, libyuv:878, libyuv:877, libyuv:862, b/178283356
Change-Id: Iedb171fbf668316e7d45ab9e3481de6205ed31e2
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2646472
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Wan-Teh Chang <wtc@google.com>
2021-01-26 18:36:56 +00:00
Frank Barchard
385418a8e2 I420ToARGB prototype added to convert_from.h
Duplicate I420ToARGB prototype from convert_argb.h into convert_from.h for webrtc
Apply clang format for white spacing consistency.

Bug: libyuv:838, b/151375918
Change-Id: I0f667ca5350192710dbb135e92e73e18b46135e5
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2446613
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
2020-10-02 21:05:10 +00:00
Frank Barchard
6d603ec3f5 clamp C functions use compare
Intel
Was ARGBSubtract_Opt (1760 ms)
Now ARGBSubtract_Opt (1546 ms)

ARM
Was ARGBAdd_Opt (1747 ms)
Now ARGBAdd_Opt (1260 ms)

Bug: None
Change-Id: I52436f6390b6b7313f2a8820833bb4f60ae958be
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2299639
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
2020-07-16 22:03:34 +00:00
Frank Barchard
0b793d9fac Add J420AlphaToARGB and colortests for bt.709 and rec.2020
Bug: libyuv:864, b/159753166
Change-Id: If6ba742a0e7c5baeab29e8b92569aee361af88e9
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2261568
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
2020-06-24 00:57:28 +00:00
Frank Barchard
fce0fed542 ARGBToY use 8 bit precision instead of 7 bit.
Neon and GCC Intel optimized, but win32 and mips not optimized.

BUG=libyuv:842, b/141482243

Change-Id: Ia56fa85c8cc1db51f374bd0c89b56d21ec94afa7
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/1825642
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
2019-10-07 23:01:10 +00:00
Frank Barchard
92e22cf5b6 Lint cleanup after C99 change CL
TBR=braveyao@chromium.org
Bug: libyuv:774
Test: git cl lint
Change-Id: I51cf8107a8db17fbc9952d610f3e4d7aac5aa743
Reviewed-on: https://chromium-review.googlesource.com/882217
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
2018-01-24 19:16:03 +00:00
Frank Barchard
7e389884a1 Switch to C99 types
Append _t to all sized types.
uint64 becomes uint64_t etc

Bug: libyuv:774
Test: try bots build on all platforms
Change-Id: Ide273d7f8012313d6610415d514a956d6f3a8cac
Reviewed-on: https://chromium-review.googlesource.com/879922
Reviewed-by: Miguel Casas <mcasas@chromium.org>
2018-01-23 19:16:05 +00:00
Frank Barchard
efbf15754a Step thru full color test by increments of 5 for better test speed.
Full color test is the slowest of the unittests, and not catching any
additional bugs at the moment.  Step thru range of 0 to 255 in steps of
5 to speed up the test.  255 is 3 * 5 * 17, so any of those primes would
hit 0 and 255 exactly.

Was LibYUVColorTest.TestFullYUV (896 ms)
Now LibYUVColorTest.TestFullYUV (212 ms)

TBR=kjellander@chromium.org
Bug: libyuv:736
Test: LibYUVColorTest.TestFullYUV
Change-Id: I5b55fb07ada0dc7bdc3c3c20569d36bf09bb3804
Reviewed-on: https://chromium-review.googlesource.com/672064
Commit-Queue: Frank Barchard <fbarchard@google.com>
Reviewed-by: Frank Barchard <fbarchard@google.com>
2017-09-19 02:01:53 +00:00
Frank Barchard
e62309f259 clang-format libyuv
BUG=libyuv:654
R=kjellander@chromium.org

Review URL: https://codereview.chromium.org/2469353005 .
2016-11-07 17:37:23 -08:00
Frank Barchard
462be27ec8 j422 now uses j420 source code so increase error threshold to match.
R=harryjin@google.com
BUG=libyuv:597

Review URL: https://codereview.chromium.org/2024213003 .
2016-05-31 19:45:34 -07:00
Frank Barchard
ade85fb55c remove row.h from unittests
add SIMD_ALIGNED to unittest header.

BUG=libyuv:594
TESTED=local build passes with row.h removed from tests.
R=harryjin@google.com

Review URL: https://codereview.chromium.org/2001373002 .
2016-05-27 10:57:49 -07:00
Frank Barchard
8c196f4d4c Fix testi420 unittest for odd height
When the image height for unittests was set to an
odd height, the TestI420 unittest would not fill
the complete source buffer.  This change handles
the odd height test case.
No change to library code.

TBR=harryjin@google.com
BUG=libyuv:549

Review URL: https://codereview.chromium.org/1609103002 .
2016-01-19 16:16:39 -08:00
Frank Barchard
c629cb3afe add command line cpu info to allow android neon test
in order to compare C and Neon code, a new command line flag is added.
historically environment variables controlled cpu features, but on
android apk it is easier to pass a command line option to disable cpu
optimizations.

R=harryjin@google.com
BUG=libyuv:516

Review URL: https://codereview.chromium.org/1407193009 .
2015-11-03 17:01:48 -08:00
Frank Barchard
00f15e3c6c color unittest allow j420 error of 5 for arm
R=harryjin@google.com
BUG=libyuv:511

Review URL: https://codereview.chromium.org/1412683005 .
2015-10-22 11:25:04 -07:00
Frank Barchard
5d0a871d37 remove have jpeg test
This test is just a printf, not a real test, but somehow
fails on arm.

TBR=harryjin@google.com
BUG=libyuv:506

Review URL: https://codereview.chromium.org/1409913002 .
2015-10-15 19:13:07 -07:00
Frank Barchard
d5c2a11529 disable color test that hangs on C version for Arm.
TBR=harryjin@google.com
BUG=libyuv:506

Review URL: https://codereview.chromium.org/1403183002 .
2015-10-14 18:48:56 -07:00
Frank Barchard
e2417df4cb create color test category of unittests to narrow down arm bug
A hang in color conversion on arm occurs somewhere in yuv to rgb.
Breaking the color test into its own category of test will help
run selective tests to narrow down the issue.

R=harryjin@google.com
BUG=libyuv:506

Review URL: https://codereview.chromium.org/1405543003 .
2015-10-14 16:58:55 -07:00
Frank Barchard
26db4de2ae break up unittests into categories
R=harryjin@google.com
BUG=none

Review URL: https://codereview.chromium.org/1399523004 .
2015-10-13 16:01:07 -07:00
Frank Barchard
f4c1ac10f0 Speed up rounding to byte test
R=harryjin@google.com
BUG=libyuv:492

Review URL: https://codereview.chromium.org/1367403007 .
2015-10-02 15:27:13 -07:00
Frank Barchard
16f12b58cc Replace random with fastrand
random / rand is slow and impacts performance testing.
Although its only called to clear a frame once, a typical profile shows
it high in the overall profile, when doing 1000 frames for a benchmark.

95.10%  libyuv_unittest  libyuv_unittest      [.] YUY2ToARGBRow_SSSE3
 2.01%  libyuv_unittest  libc-2.19.so         [.] __random_r
 1.13%  libyuv_unittest  libc-2.19.so         [.] __random

Replace random is a faster version for unittests.

set LIBYUV_WIDTH=1280
set LIBYUV_HEIGHT=720
set LIBYUV_REPEAT=999
set LIBYUV_FLAGS=-1
out\release\libyuv_unittest --gtest_filter=*YUY2ToARGB*  | findms

Was
libyuvTest.YUY2ToARGB_Opt (497 ms)

Now
libyuvTest.YUY2ToARGB_Opt (454 ms)

R=harryjin@google.com
BUG=none

Review URL: https://codereview.chromium.org/1361813002 .
2015-09-22 15:47:36 -07:00
Frank Barchard
478ff9608b Increase error tolerance to 4 for arm on J420 convert
BUG=libyuv:479
R=harryjin@google.com

Review URL: https://webrtc-codereview.appspot.com/53789004.
2015-08-07 12:24:25 -07:00
Frank Barchard
9487b9d6d8 any allow for avx2 32 pixels at a time of argb
R=harryjin@google.com
BUG=libyuv:461

Review URL: https://webrtc-codereview.appspot.com/54779004.
2015-07-01 17:50:48 -07:00
fbarchard@google.com
f16f33d4ce All cpu flags to be set so that instead of comparing C code, compare assembler to assembler, for benchmarking purposes.
BUG=none
TESTED=libyuv_unittest.exe
R=bcornell@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1346 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-26 18:22:29 +00:00
fbarchard@google.com
4f46a3e03d remove 1 tab from each row of histograms in libyuvTest.TestFullYUV and libyuvTest.TestScaleFullYUV.
BUG=none
TESTED=libyuvTest.TestScaleFullYUV
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1345 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-25 22:38:01 +00:00
fbarchard@google.com
92f7f421fd rename I400 to J400 and I400 reference to I400. J400 is a simple replication of values to convert to RGB, which is what the old I400 was. I400 reference is the Y part of the YUV formula, so renaming that to I400.
BUG=none
TESTED=libyuvTest (5925 ms total)
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1333 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-17 00:01:18 +00:00
fbarchard@google.com
f301777060 Fix YToARGB and tweaks to thresholds in YUV tests.
BUG=411
TESTED=libyuvTest.TestYToARGB
R=bcornell@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1330 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-16 19:50:33 +00:00
fbarchard@google.com
bfba8e41c4 Add test for color accuracy of J422ToARGB
BUG=414
TESTED=libyuvTest.TestFullYUVJ
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1329 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-16 18:47:42 +00:00
fbarchard@google.com
63726ed9c6 test different ways to round and clamp
BUG=none
TESTED=TestRoundToByte
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1325 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-13 22:24:45 +00:00
fbarchard@google.com
8f152605c7 test for cast and clamp performance.
BUG=none
TESTED=libyuv unittest added to benchmark and confirm behavior of cast
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1323 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-12 18:49:32 +00:00
fbarchard@google.com
be77e062da Make TestFullYUV test do full yuv color space by default with randomized Y for inner loop
BUG=none
TESTED=out\release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*TestFullYUV
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1319 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-10 21:26:46 +00:00
fbarchard@google.com
1d87532f00 Make color_test using if statements for clamping values from 0 to 255.
BUG=none
TESTED=libyuvTest.TestFullYUV

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1316 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-10 01:51:01 +00:00
fbarchard@google.com
cdd80e04c9 Port I444ToARGB to AVX2.
BUG=403
TESTED=I444ToARGB unittests
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1314 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-09 21:56:48 +00:00
fbarchard@google.com
7c55ae4ada Change YUV full test to use pseudo random order
BUG=none
TESTED=libyuvTest.TestFullYUV

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1313 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-08 23:00:39 +00:00
fbarchard@google.com
9c96867a97 lrintf is not supported by visual studio 2010; replace instances of lrintf with a cast to int.
BUG=409
TESTED=python build\gyp_chromium -fninja -G msvs_version=2010 --depth=. libyuv_test.gyp
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1312 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-06 22:20:41 +00:00
yang.zhang@arm.com
94e3d5a3be Improve the accuracy YUV to RGB for ARMv7 NEON
NEON version of YUV422TORGB is updated based on C algorithm. Accuracy YUV to RGB
of NEON is also updated according to test result. Macro LIBYUV_NEON is added to
identify accuracy YUV to RGB for ARM platform.
Except TestJ420 and TestYUV, all the other tests are passed.

BUG=324
TESTED=libyuvTest on ARMv7 with Android
R=fbarchard@google.com

Change-Id: I492ca628679940534f40341721dc5b6dc2d7a5b6

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1296 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-02-25 06:51:29 +00:00
fbarchard@google.com
796396b226 Switch step for libyuvTest.TestFullYUV from 3 to 5 for better test performance.
BUG=397
TESTED=libyuvTest.TestFullYUV
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1281 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-02-13 21:48:29 +00:00
fbarchard@google.com
695f42fdb8 fix for odd width but even height in TestI420
BUG=400
TESTED=libyuv unittests pass locally with width of 11
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1271 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-02-09 21:40:27 +00:00
fbarchard@google.com
6c200c5924 Test YUV against reference
BUG=393
TESTED=TestGreyYUV
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1265 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-02-05 23:58:01 +00:00
fbarchard@google.com
9d67669697 make histogram use 8 digits for all values for more consistent formatting.
BUG=394
TESTED=TestFullYUV
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1260 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-02-04 20:00:38 +00:00
fbarchard@google.com
c4e032c543 change Y multiplier and bias to compensate for 257/256 which makes YToARGB exactly match float math.
Histogram Before
hist            -3      -2      -1      0       1       2       3
red             0       0       1809408 13140736        1827072 0       0
green           0       0       1679912 13471329        1625975 0       0
blue            168448  994816  1876480 10655488        1893376 1006336 182272
Histogram After
hist            -3      -2      -1      0       1       2       3
red             0       0       558848  15632128        586240  0       0
green           0       0       209907  16350588        216721  0       0
blue            14848   642816  1989376 11363328        2053120 695040  18688
BUG=394
TESTED=more stringent luma tests
R=brucedawson@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1259 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-02-04 19:45:26 +00:00
fbarchard@google.com
0494ffee81 use lrintf to round from float to int instead of round and then cast.
BUG=393
TESTED=local windows test passed.
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1257 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-02-02 21:06:51 +00:00
fbarchard@google.com
4e155ef6c4 Change test to test for Arm, since all CPUs except arm provide accurate yuv conversion
BUG=392
TESTED=try bots

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1254 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-01-27 00:22:10 +00:00
fbarchard@google.com
4848b06016 YPixel subtract bias to match C code
BUG=392
TESTED=TestGreyYUV
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1253 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-01-26 23:58:20 +00:00