64 Commits

Author SHA1 Message Date
Frank Barchard
64994843e6 fix compare row test for avx2 which does 64 bytes per loop
libyuv_test  --gunit_also_run_disabled_tests --libyuv_width=129

Bug: libyuv:894
Change-Id: I2511f8fa486e492097b4882c466dd37cc3c1e25d
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2808631
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
2021-04-06 22:37:25 +00:00
Frank Barchard
f7b49c7e1a Disable tests via macro that refer to row.h
This is to resolve issues when the library is compiled with different
compiler and/or flags than the tests.

BUG=libyuv:836

Change-Id: I80727bfbd2fe1e02c842a7dba68a3deac941e23e
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/1757114
Reviewed-by: richard winterton <rrwinterton@gmail.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
2019-08-20 18:44:36 +00:00
Frank Barchard
b792e0dbc1 tidy applied with all cppcoreguidelines and google
TBR=braveyao@chromium.org
Bug: libyuv:750
Test: builds and runs and passes more tidy tests
Change-Id: I1400a915ee5734c38d19dab9cf1f210ca43d17fc
Reviewed-on: https://chromium-review.googlesource.com/905810
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
2018-02-07 02:28:25 +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
324fa32739 Convert16To8Row_SSSE3 port from AVX2
H010ToAR30 uses Convert16To8Row_SSSE3 to convert 10 bit YUV to 8 bit.
Then standard YUV conversion can be used.  This improves performance
on low end CPUs.
Future CL will by pass this conversion allowing for 10 bit YUV source,
but the function will be useful as a utility for YUV conversions.

Bug: libyuv:559, libyuv:751
Test: out/Release/libyuv_unittest --gtest_filter=*H010ToAR30* --libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1 --libyuv_cpu_info=-1
Change-Id: I9b3ef22d88a5fd861de4cf1900b4c6e8fd24d0af
Reviewed-on: https://chromium-review.googlesource.com/792334
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
2017-11-28 19:22:39 +00:00
Frank Barchard
ffc4811863 clang-format fixes
Bug: None
Test: lint passes
Change-Id: I1fd40d3506bab1f4f9100902f633a9c9e7b96337
Reviewed-on: https://chromium-review.googlesource.com/745038
Reviewed-by: Frank Barchard <fbarchard@google.com>
2017-10-31 02:25:01 +00:00
Frank Barchard
80077a80c2 HammingDistance_X86 using popcnt assembly
popcnt has a fake dependency on the destination.
This assembly avoids the dependency by using a different
register for each popcnt.

Bug: libyuv:701
Test: LIBYUV_DISABLE_SSSE3=1 out/Release/libyuv_unittest --gtest_filter=*Ham*Opt --libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=9999 --libyuv_flags=-1 --libyuv_cpu_info=-1
Change-Id: Ie1d202e2613b7fa8a3c02acd433940e92c80eafa
Reviewed-on: https://chromium-review.googlesource.com/731826
Reviewed-by: Cheng Wang <wangcheng@google.com>
Reviewed-by: Frank Barchard <fbarchard@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2017-10-23 21:15:12 +00:00
Frank Barchard
1cebe2c622 TestHammingDistance_Opt to test low level matches C reference.
The low level hamming distance functions have size limitations
based on counter sizes.  The higher level calls the low level
in blocks that avoid overflow and then accumulators in int64.
This test compares the results of the low levels to the high
level and against a known value (all ones) to ensure the
count is correct for any specified size.
The the size is very large, the result is expected to be
different.

Bug: libyuv:701
Test: TestHammingDistance_Opt
Change-Id: I6716af7cd09ac4d88a8afa25bc845a1b62af7c93
Reviewed-on: https://chromium-review.googlesource.com/710800
Reviewed-by: Frank Barchard <fbarchard@google.com>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2017-10-11 20:21:31 +00:00
Frank Barchard
60f433fbd9 Revert "ComputeHammingDistance reduce SIMD loop to 1 call when possible."
This reverts commit ec75df5894845b8d6b1341885a78db1de83decd8.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> ComputeHammingDistance reduce SIMD loop to 1 call when possible.
> 
> 32 bit x86 has high overhead due to -fpic.  So this reduces the
> number of calls by 1.
> 
> TBR=kjellander@chromium.org
> Bug: libyuv:701
> Test: BenchmarkHammingDistance
> Change-Id: I7f557ef047920db65eab362a5f93abbd274ca051
> Reviewed-on: https://chromium-review.googlesource.com/701755
> Reviewed-by: Frank Barchard <fbarchard@google.com>
> Reviewed-by: Cheng Wang <wangcheng@google.com>

TBR=rrwinterton@gmail.com,fbarchard@google.com,wangcheng@google.com

Change-Id: Ia61e8558a8f083c14be5f51e0e141550b6f2b5c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: libyuv:701
Reviewed-on: https://chromium-review.googlesource.com/707823
Reviewed-by: Frank Barchard <fbarchard@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2017-10-10 01:16:15 +00:00
Frank Barchard
ec75df5894 ComputeHammingDistance reduce SIMD loop to 1 call when possible.
32 bit x86 has high overhead due to -fpic.  So this reduces the
number of calls by 1.

TBR=kjellander@chromium.org
Bug: libyuv:701
Test: BenchmarkHammingDistance
Change-Id: I7f557ef047920db65eab362a5f93abbd274ca051
Reviewed-on: https://chromium-review.googlesource.com/701755
Reviewed-by: Frank Barchard <fbarchard@google.com>
Reviewed-by: Cheng Wang <wangcheng@google.com>
2017-10-09 22:51:23 +00:00
Frank Barchard
1734712a6f Fix odd length HammingDistance
If length of HammingDistance was not a multiple of 4,
the result was incorrect.  The old tests did not catch this
so a new test is done to count 1s.

Bug: libyuv:740
Test: LibYUVCompareTest.TestHammingDistance
Change-Id: I93db5437821c597f1f162ac263d4a594bb83231f
Reviewed-on: https://chromium-review.googlesource.com/699614
Reviewed-by: richard winterton <rrwinterton@gmail.com>
Reviewed-by: Cheng Wang <wangcheng@google.com>
Reviewed-by: Frank Barchard <fbarchard@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2017-10-04 22:21:36 +00:00
Frank Barchard
fecd741794 Port HammingDistance to SSSE3
Bug: libyuv:701
Test: BenchmarkHammingDistance_Opt
Change-Id: Ibdd5d382677ebef4f82a62e0d5c3b88614a3b6e4
Reviewed-on: https://chromium-review.googlesource.com/696290
Commit-Queue: Frank Barchard <fbarchard@google.com>
Reviewed-by: Cheng Wang <wangcheng@google.com>
2017-10-03 19:11:05 +00:00
Frank Barchard
bde789b176 Hamming Distance SSE2 and AVX2 optimized
Bug: None
Test: None
Change-Id: Id52663f9c957aac3172fba92d888ad1b041d5cf0
Reviewed-on: https://chromium-review.googlesource.com/692981
Reviewed-by: Cheng Wang <wangcheng@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2017-10-02 22:32:54 +00:00
Frank Barchard
db25485ee2 Move compare functions into a unittest class
BUG=None
TEST=LibYUVCompareTest.*
R=jkellander@chromium.org

Change-Id: I3131ca73020f855ead08255d09aa7a846bf0d556
Reviewed-on: https://chromium-review.googlesource.com/540064
Commit-Queue: Frank Barchard <fbarchard@google.com>
Reviewed-by: Henrik Kjellander <kjellander@chromium.org>
2017-06-19 19:39:10 +00:00
Frank Barchard
77f6916da2 use __popcnt for visual c HammingDistance_X86
BUG=libyuv:701
TEST=HammingDistance unittest performance is comparable to x64
R=wangcheng@google.com

Change-Id: I8abe861e086e0162ba4c7ba6f1ef7d1c006cd9d4
Reviewed-on: https://chromium-review.googlesource.com/505454
Reviewed-by: Frank Barchard <fbarchard@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2017-05-12 22:59:00 +00:00
Frank Barchard
e0615c0e69 Optimize Hamming Distance C code to do 64 bits at a time.
BUG=libyuv:701
TEST=LibYUVBaseTest.BenchmarkHammingDistance_C
R=wangcheng@google.com

Change-Id: I243003b098bea8ef3809298bbec349ed52a43d8c
Reviewed-on: https://chromium-review.googlesource.com/499487
Reviewed-by: Cheng Wang <wangcheng@google.com>
2017-05-12 17:53:52 +00:00
Frank Barchard
2136e349da Hamming code difference of 2 memory blocks
BUG=libyuv:701
TEST=built and disassembled for aarch64
R=kjellander@chromium.org

Change-Id: I7712b1c7934e5dfb55fda1fa7c8405c32d6964ce
Reviewed-on: https://chromium-review.googlesource.com/495327
Reviewed-by: Henrik Kjellander <kjellander@chromium.org>
Reviewed-by: Cheng Wang <wangcheng@google.com>
2017-05-08 21:37:51 +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
198bce3959 Cast for clang-cl 64 bit build warnings in unittests
R=kjellander@chromium.org
BUG=libyuv:649

Review URL: https://codereview.chromium.org/2414763002 .
2016-10-12 13:09:57 -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
6020d2aa64 fix off by one in unitest BenchmarkARGBDetect_Unaligned where array is initialized beyond end by 1.
TBR=harryjin@google.com
BUG=libyuv:595
TESTED=local unittest passes on try bots

Review URL: https://codereview.chromium.org/2012603002 .
2016-05-24 15:33:27 -07: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
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
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
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
a6025e8b6b ARGBDetect do 2 pixels at a time for improved performance.
BUG=375
TESTED=libyuvTest.BenchmarkARGBDetect_Opt
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1155 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-11-05 23:23:17 +00:00
fbarchard@google.com
b661b3ee0d Detect Endian of ARGB image.
BUG=375
TESTED=libyuv builds, but no test app for it yet
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1154 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-11-05 18:46:06 +00:00
fbarchard@google.com
9c4c82181b Remove alignment constraint for SSE2. Allows the optimized function to be used with unaligned memory, improving performance in that use case. Hurts performance on core2 and prior where memory was faster with movdqa instruction.
BUG=365
TESTED=psnr, ssim and djb2 unittests pass.
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1100 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-09-30 18:53:34 +00:00
fbarchard@google.com
ae9a1388a7 Use malloc for row buffers in rotate
BUG=296
TESTED=rotate_test
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@922 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-12-26 21:41:11 +00:00
fbarchard@google.com
0014ce0056 test odd width and fix for unaligned used on odd width conversion.
BUG=283
TESTED=try bots
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@883 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-12-02 20:07:29 +00:00
fbarchard@google.com
095f33d870 Coalesce rows by changing width/height and dropping into code instead of recursing. Improve coalesce by setting stride to 0 so it can be used even on odd width images. Reduce unittests to improve time to run emulators.
BUG=277
TEST=unittests all build and pass
R=ryanpetrie@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@819 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-10-21 19:29:10 +00:00
fbarchard@google.com
88ce3c0caa Change unittests to pass when size is 1 tall.
BUG=202
TEST=set LIBYUV_HEIGHT=1 & out\release\libyuv_unittest
R=ryanpetrie@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@811 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-10-14 19:36:26 +00:00
fbarchard@google.com
c9f0d966ed FixedDiv port to gcc
BUG=250
TEST=*Div*
R=ryanpetrie@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@733 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-06-18 18:58:33 +00:00
fbarchard@google.com
8ffe78abd2 Scale down by 4 used 3rd pixel
BUG=232
TEST=convert.exe -f 0 faces_640x480_P420.yuv face2_160x120_P420.yuv
R=changjun.yang@intel.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@709 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-05-30 07:14:14 +00:00
fbarchard@google.com
0066be9716 test hash of quick brown fox for known hash value
BUG=none
TESTED=out\release\libyuv_unittest --gtest_filter=libyuvTest.Djb2_Test
R=johannkoenig@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@699 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-05-22 02:10:47 +00:00
fbarchard@google.com
9f24b14e05 Compare typo fix
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/1390005

git-svn-id: http://libyuv.googlecode.com/svn/trunk@691 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-05-09 01:43:54 +00:00
fbarchard@google.com
b06d3f5344 Add more tests for hash
BUG=none
TEST=out\release\libyuv_unittest --gtest_filter=*Djb2*
Review URL: https://webrtc-codereview.appspot.com/1448004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@690 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-05-09 00:34:05 +00:00
fbarchard@google.com
6a34ee200e Test DJB2 hash with half the buffer same.
BUG=none
TEST=libyuvTest.BenchmakDjb2_Test
Review URL: https://webrtc-codereview.appspot.com/1446004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@689 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-05-08 23:05:08 +00:00
fbarchard@google.com
4127a2637d ARGBInterpolate odd width support and inverted odd width test. ARGBToNV12/21 odd height fix. Compare test tolerate small height with warning.
BUG=202
TEST=libyuvTest.ARGBInterpolate85_Any_Invert
Review URL: https://webrtc-codereview.appspot.com/1325004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@663 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-04-15 10:43:33 +00:00
fbarchard@google.com
4e0d7cc2c6 Y coefficients for J420 need to be scaled by 255/219 to full range.
BUG=159
TESTED=out\release\libyuv_unittest --gtest_filter=*J*
Review URL: https://webrtc-codereview.appspot.com/1264004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@624 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-03-27 07:35:03 +00:00
fbarchard@google.com
04de744106 fix for bayer unittest, transpose and rotate, and Ssim tolerance.
BUG=198
TESTED=*Bayer*
Review URL: https://webrtc-codereview.appspot.com/1194004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@604 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-03-13 01:52:21 +00:00
fbarchard@google.com
cde587092f Replace two spaces with one after .
BUG=none
TEST=lint
Review URL: https://webrtc-codereview.appspot.com/1063010

git-svn-id: http://libyuv.googlecode.com/svn/trunk@553 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-01-28 00:02:35 +00:00
fbarchard@google.com
d985cf1f62 clamp maxy for first row of bilinear
BUG=153
TEST=none
Review URL: https://webrtc-codereview.appspot.com/934014

git-svn-id: http://libyuv.googlecode.com/svn/trunk@490 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-11-14 08:15:55 +00:00
fbarchard@google.com
3e46444727 Mirror source to continuous destination with Neon
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/937020

git-svn-id: http://libyuv.googlecode.com/svn/trunk@488 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-11-14 02:03:49 +00:00
fbarchard@google.com
55d5b48e4d bilinear scale use fast 2 pass unless image is beyond row buffer size.
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/965020

git-svn-id: http://libyuv.googlecode.com/svn/trunk@484 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-11-13 17:31:08 +00:00
fbarchard@google.com
bd4fcb9877 Switch to 128x72 for default testing size when not benchmarking.
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/935004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@442 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-10-24 19:52:14 +00:00
fbarchard@google.com
3bb60b37fd Use width variable for all tests
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/934004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@441 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-10-24 18:31:55 +00:00
fbarchard@google.com
042acf0458 Reduce allowed error on simple conversions
BUG=none
TEST=unittests
Review URL: https://webrtc-codereview.appspot.com/917006

git-svn-id: http://libyuv.googlecode.com/svn/trunk@431 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-10-20 06:37:21 +00:00
fbarchard@google.com
0a6b7a6eb7 test rgb565 by converting to ARGB and then doing MSE
BUG=114
TEST=libyuvTest.I420ToRGB565_Any
Review URL: https://webrtc-codereview.appspot.com/919004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@428 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-10-19 20:10:47 +00:00