56 Commits

Author SHA1 Message Date
Frank Barchard
cdd3bae848 TestI400LargeSize fix for warning message build error
- change %ld to %zd for size_t printf warnings
- disable TestI400LargeSize when disabling SLOW_TESTS
- disable cpuid tests that read proc/cpuinfo test data files
- add ifdef around timers to allow hexagon build
- remove faulty hybrid detect
- remove old mips LIBYUV_DISABLE_DSPR2 reference in gyp build
- apply clang-format

Bug: 434382656
Change-Id: Id74812e6ef29d4a8d0ff967a9189d249b80816d4
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/6812825
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
2025-08-01 12:03:11 -07:00
Frank Barchard
951e43439c Use pragma comment to disable warning for ASSERT_NE when including gtest.h
- // IWYU pragma: export

Bug: None
Change-Id: Ic438b9712ca9bccb819358cb94fbee9a63389748
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/6553193
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Wan-Teh Chang <wtc@google.com>
2025-05-15 15:58:15 -07:00
Chunbo Hua
874f391dbf Validate memory right after malloc
The failure of malloc would make a NULL pointer. But if in this case,
things like reinterpret_cast is done to some shift from the NULL point,
it will return a valid pointer although its content would be Access
Violation area.

Bug: 359949838
Change-Id: Ie73bca426671ee85315b96f187a6de8c955cada6
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5789885
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
2024-08-21 00:07:37 +00:00
Frank Barchard
6e4b0acb4b I422Rotate take stride for temporary buffers
- Minor variable name changes first/last to top/bottom
- Comments explaining rotate temporary buffers usage
- Add asserts for scale parameter
- Use NULL and stddef.h instead of 0
- Use void * for allocation in row.h
- Add () around size parameter in macros


Bug: libyuv:926, libyuv:949
Change-Id: Ib55417570926ccada0a0f8abd1753dc12e5b162e
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4136762
Reviewed-by: Wan-Teh Chang <wtc@google.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
2023-01-04 23:11:52 +00:00
Sergio Garcia Murillo
f8626a7224 Add 10 bit rotate methods.
This initial implementation is based on current unoptimized code in webrtc using just plain for loops.

Bug: libyuv:949
Change-Id: Ic87ee49c3a0b62edbaaa4255c263c1f7be4ea02b
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4110782
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
2023-01-04 21:10:01 +00:00
Frank Barchard
be50557db7 Remove include resource.h for Fuchsia build
Bug: None
Change-Id: I3e0748d3aebdc8bc1ff8ddfc79d9cdb751c03e0f
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3906081
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Justin Green <greenjustin@google.com>
2022-09-19 19:30:35 +00:00
Frank Barchard
f0cfc1f1c8 ubsan friendly unaligned tests
- ubsan complains on unaligned tests when an int16 or int32 is stored unaligned in C.
Although current Intel, ARM, Mips and PPC can do unaligned load/store, its not guaranteed
and could crash a CPU that doesnt support it.
- unaligned tests use offset of 2 or 4, which ubsan accepts.
- unittest fills in random buffer with 2 bytes at a time instead of a short.
- row common functions for int16 types use 2 shorts instead of 1 int.

Bug: libyuv:908, b/203243873
Change-Id: Idf13fa901647d7b0975f1947291caa781999a9bc
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3229782
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
2021-10-18 18:03:28 +00:00
Yuan Tong
c9843de02a Optimize unlimited data for Intel
Use unsigned coefficient and signed UV value in YUVTORGB.

R=fbarchard@chromium.org

Bug: libyuv:862, libyuv:863
Change-Id: I32e58b2cee383fb98104c055beb0867a7ad05bfe
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2850016
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Wan-Teh Chang <wtc@google.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
2021-04-27 20:35:27 +00:00
Frank Barchard
5f0354bde5 clang-tidy and clang-format applied reland
row_neon.cc manually editted for clang format bugs

TBR=braveyao@chromium.org

Bug: None
Test: local arm builds still pass
Change-Id: Ida4aac2f4ee354e2c1bd354b06e76a26b3c0becc
Reviewed-on: https://chromium-review.googlesource.com/930165
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
2018-02-21 23:30:38 +00:00
Frank Barchard
9c0663d7ce Revert "clang-tidy and clang-format applied"
This reverts commit cfff527a4738cbd125f788937c503558d225d9fa.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> clang-tidy and clang-format applied
> 
> TBR=braveyao@chromium.org
> Bug: None
> Test: local arm builds still pass
> Change-Id: Iac042fbaad940e01fc4ce228a104d3d561b80f92
> Reviewed-on: https://chromium-review.googlesource.com/929999
> Reviewed-by: Frank Barchard <fbarchard@chromium.org>

TBR=fbarchard@chromium.org,braveyao@chromium.org

Change-Id: I4ee92ceeaa3c34bce3f20bf759dd30593807ad3f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/930141
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
2018-02-21 23:21:07 +00:00
Frank Barchard
cfff527a47 clang-tidy and clang-format applied
TBR=braveyao@chromium.org
Bug: None
Test: local arm builds still pass
Change-Id: Iac042fbaad940e01fc4ce228a104d3d561b80f92
Reviewed-on: https://chromium-review.googlesource.com/929999
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
2018-02-21 22:44:53 +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
3cf056f8c3 clang-format for align_buffer_page_end and free_aligned_buffer_page_end
clang-format does nested indents for macros that dont end with ;
example:
  align_buffer_page_end(dst_y_8, dst_y_plane_size)
      align_buffer_page_end(dst_u_8, dst_uv_plane_size)
          align_buffer_page_end(dst_v_8, dst_uv_plane_size)
              align_buffer_page_end(dst_y_16, dst_y_plane_size * 2)
                  align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2)
                      align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2)

use a similar allocator to the one used within libyuv in row.h which makes the caller add ;
  align_buffer_page_end(dst_y_8, dst_y_plane_size);
  align_buffer_page_end(dst_u_8, dst_uv_plane_size);
  align_buffer_page_end(dst_v_8, dst_uv_plane_size);
  align_buffer_page_end(dst_y_16, dst_y_plane_size * 2);
  align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2);
  align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2);

Bug: libyuv:758
Test: try bots
Change-Id: I4a0770707e7053e094a37bbfc3c5884d5663d078
Reviewed-on: https://chromium-review.googlesource.com/762757
Reviewed-by: Patrik Höglund <phoglund@chromium.org>
Reviewed-by: Frank Barchard <fbarchard@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2017-11-10 22:36:39 +00:00
Frank Barchard
8676ad7004 scale float samples and return max value
BUG=libyuv:717
TEST=ScaleSum unittest to compare C vs Arm implementation
TBR=kjellander@chromium.org

Change-Id: Iaa7af5547d979aad4722f868d31b405340115748
Reviewed-on: https://chromium-review.googlesource.com/600534
Reviewed-by: Cheng Wang <wangcheng@google.com>
2017-08-04 23:34:30 +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
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
b00d40160a make unittest allocator align to 64 bytes.
blur requires memory be aligned.  change the unittest allocator to guarantee 64 byte alignment.
re-enable blur any test that fails if memory is unaligned.

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

Review URL: https://codereview.chromium.org/2019753002 .
2016-05-27 18:02:47 -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
60abed3a47 add SIMD_ALIGNED to unit_test.h
avoids need for row.h for some unittests;

R=harryjin@google.com
BUG=libyuv:594
TESTED=try bots tested.

Review URL: https://codereview.chromium.org/2004313004 .
2016-05-24 13:56:25 -07:00
Frank Barchard
07cb92272f If image sizes are greater than 32768, fixed point stepping will overflow an int. This CL changes the max size to 32768 and disables the test if larger.
BUG=libyuv:590
TESTED=LIBYUV_FLAGS=-1 LIBYUV_WIDTH=8192 LIBYUV_HEIGHT=16 out/Release/libyuv_unittest --gtest_filter=*
R=harryjin@google.com

Review URL: https://codereview.chromium.org/1947783002 .
2016-05-05 19:09:02 -07:00
Frank Barchard
903c91cc2e fix for ubsan on unittest.h fastrand()
internal math of the fastrand function uses a multiply
and add that overflows a signed int.  This triggers a
ubsan failure:

../../unit_test/../unit_test/unit_test.h:60:33: runtime error: signed integer overflow: 56248274 * 214013 cannot be represented in type 'int'

This change casts the intermediate math to unsigned
int to avoid the overflow.

For more info on ubsan, see
http://dev.chromium.org/developers/testing/undefinedbehaviorsanitizer

TESTED=Passing compilation using:
GYP_DEFINES="ubsan=1"
GYP_DEFINES="ubsan_vptr=1"

R=harryjin@google.com, pbos@webrtc.org
BUG=libyuv:563

Review URL: https://codereview.chromium.org/1662453003 .
2016-02-02 14:32:12 -08:00
Frank Barchard
82d74a37fa unittest fix for cpu flags.
cpu flags of 1 disables SIMD and uses C.  This used to be 0, but the change
in auto init behavior means that 0 now means uninitialized, and will cause
auto detect to reinit the cpu info.  A value of 1 disables the auto init.

TBR=harryjin@google.com
BUG=none

Review URL: https://codereview.chromium.org/1408753004 .
2015-11-03 19:06:19 -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
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
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
d880a90eca make randomize take 64 bit count to allow larger images to be tested
BUG=none
TESTED=untested

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1429 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-06-09 01:55:01 +00: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
008ce53ac4 pavgb with memory op requires alignment. This CL disables conversions that use pavgb, and resolves scale by 3/8 unittest for checking alignment works. The 3/8 code used a pavgb with a memory operand. tests are added for scaling and allow unaligning on purpose.
BUG=365
TESTED=local change to force unaligned memory fails on some conversions and scaling code.
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1114 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-10-07 01:57: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
4b4b50fb44 Make unittests to 1280 pixels for simple planar tests, to get more realistic performance metrics than 256 pixels.
BUG=253
TEST=planar tests
R=nfullagar@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@753 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-08-09 02:02:52 +00:00
fbarchard@google.com
b3a08b3e05 include lint warning fixes
BUG=none
TEST=lint
R=ryanpetrie@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@728 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-06-17 16:37:39 +00:00
fbarchard@google.com
f2f9dbb644 FixedDiv function in C and benchmark
BUG=none
TEST=FixedDiv*
R=johannkoenig@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@727 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-06-15 21:10:19 +00:00
fbarchard@google.com
47c4989b79 MemRandomize fix for short result
BUG=none
TEST=none
R=dingkai@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@725 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-06-13 21:36:58 +00:00
fbarchard@google.com
ae67c900f4 Randomize function for filling a buffer with random values.
BUG=244
TEST=*ScaleFrom1366x768_Box
R=mflodman@webrtc.org

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@720 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-06-10 16:12:20 +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
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
d26b451472 I420ToNV12_Neon bug fix
BUG=135
TEST=/libyuv_unittest --gtest_filter=*NV*
Review URL: https://webrtc-codereview.appspot.com/939005

git-svn-id: http://libyuv.googlecode.com/svn/trunk@444 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-10-25 19:24:59 +00:00
fbarchard@google.com
d3728d9222 unittest simplify loop counter
BUG=none
TEST=planar unittests
Review URL: https://webrtc-codereview.appspot.com/935006

git-svn-id: http://libyuv.googlecode.com/svn/trunk@443 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-10-25 17:12:41 +00:00
fbarchard@google.com
75f90ac315 Add unittest environment variables to set conversion width and height
BUG=none
TEST=convert_test
Review URL: https://webrtc-codereview.appspot.com/932004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@439 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-10-24 17:43:51 +00:00
fbarchard@google.com
7781d943b0 Disable V210 unittest that fails valgrind, and some warning fixes for android.
BUG=91
TEST=try
Review URL: https://webrtc-codereview.appspot.com/813004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@362 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-09-18 22:58:34 +00:00
fbarchard@google.com
6ccda3d206 Add environment variable for tests to repeat for benchmarking purposes.
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/796006

git-svn-id: http://libyuv.googlecode.com/svn/trunk@352 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-09-14 15:35:34 +00:00
fbarchard@google.com
b0c9797589 Update Copyright notice to follow new chromium conventions.
BUG=63
TEST=none
Review URL: https://webrtc-codereview.appspot.com/730004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@314 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-08-08 19:04:24 +00:00
fbarchard@google.com
d9eb63fc16 UNDER_ALLOCATED_HACK for scale that detects odd width and odd height were miscalculated and adjusts scaler for it.
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/663007

git-svn-id: http://libyuv.googlecode.com/svn/trunk@290 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-06-21 01:13:44 +00:00
fbarchard@google.com
81b804e35c ARGBQuantize to do a posterizing effect. Added random resolution unittest.
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/654005

git-svn-id: http://libyuv.googlecode.com/svn/trunk@289 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-06-20 02:15:01 +00:00
fbarchard@google.com
810cd91079 ARGBUnattenuateRow_SSE2 use reciprocal table and pmul
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/497001

git-svn-id: http://libyuv.googlecode.com/svn/trunk@244 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-04-20 20:15:27 +00:00
fbarchard@google.com
e3ebe7a5cd Neon instructions detect without using NDK so it will work within Android, and on other linux arm based platforms and builds
BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/358008

git-svn-id: http://libyuv.googlecode.com/svn/trunk@153 16f28f9a-4ce2-e073-06de-1de4eb20be90
2012-01-26 02:14:52 +00:00
frkoenig@google.com
93d003f874 YUVToARGB, YUVToBGRA,YUVToABGR optimized.
Review URL: http://webrtc-codereview.appspot.com/267022

git-svn-id: http://libyuv.googlecode.com/svn/trunk@86 16f28f9a-4ce2-e073-06de-1de4eb20be90
2011-11-19 01:39:57 +00:00