35 Commits

Author SHA1 Message Date
Frank Barchard
8fa02df3c0 mingw fix ifdefs to use gcc source
mingw gcc sets the macro _M_IX86 which is normally only set
by Visual C and clangcl which are Visual C style source code
style for assembly, but gcc is not Visual C compatible.
Add _MSC_VER to most ifdefs to detect that its really Visual C
or clangcl and not mingw gcc so the gcc source code will be used.

Bug: libyuv:744
Test: CXXFLAGS=-m32 CXX=~/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32-g++ make -f linux.mk
Change-Id: I3431aa486eb769b145faa8d5eb75ed639f9d6f5e
Reviewed-on: https://chromium-review.googlesource.com/722319
Reviewed-by: Cheng Wang <wangcheng@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
2017-10-17 17:36:35 +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
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
cc88adc620 YUV scale filter columns improved filtering accuracy
upscale a YUV image.  observe change in hue.. green especially.
disable ScaleFilterCols_SSSE3, falling back on ScaleFilterCols_C
observe hue.. green especially, is better.

was ScaleFrom1280x720_Bilinear (1620 ms)
now ScaleFrom1280x720_Bilinear (1907 ms)

BUG=libyuv:605
TEST=try bots
R=harryjin@google.com, wangcheng@google.com

Review URL: https://codereview.chromium.org/2084533006 .
2016-06-23 20:16:55 -07:00
Frank Barchard
0e462e6f45 Remove use_sysroot=0
use_sysroot=0 is required for webrtc on linux intel builds, but
libyuv doesnt use the affected libraries, so removing this.

R=harryjin@google.com, sbc@chromium.org
BUG=libyuv:534,libyuv:542

Review URL: https://codereview.chromium.org/1566303002 .
2016-01-11 14:57:50 -08:00
Frank Barchard
80ca4514ef change scale down by 4 to use rounding.
TBR=harryjin@google.com
BUG=libyuv:447

Review URL: https://codereview.chromium.org/1525033005 .
2015-12-15 21:25:18 -08:00
Frank Barchard
ae55e41851 use rounding in scaledown by 2
When scaling down by 2 the formula should round consistently.
(a+b+c+d+2)/4
The C version did but the SSE2 version was doing 2 averages.
avg(avg(a,b),avg(c,d))
This change uses a sum, then rounds.

R=dhrosa@google.com, harryjin@google.com
BUG=libyuv:447,libyuv:527

Review URL: https://codereview.chromium.org/1513183004 .
2015-12-14 17:25:36 -08:00
Frank Barchard
94d4269936 clang use scalewin
R=harryjin@google.com
TBR=harryjin@google.com
BUG=libyuv:469

Review URL: https://webrtc-codereview.appspot.com/51329004.
2015-08-18 14:50:27 -07:00
Frank Barchard
7cd7f5a80f avx ifdef for scale HAS_SCALEADDROW_AVX2.
R=jzern@google.com
BUG=libyuv:480

Review URL: https://webrtc-codereview.appspot.com/53779004.
2015-07-31 17:17:14 -07:00
Frank Barchard
0e83b64e88 scalerow avx2 bug fix. was using ymm2 instead of ymm3.
R=harryjin@google.com
BUG=libyuv:462

Review URL: https://webrtc-codereview.appspot.com/56639004.
2015-07-07 17:48:04 -07:00
fbarchard@google.com
2e9f3e5cf5 rename source files from row_posix.cc etc to row_gcc.cc to avoid gyp build filtering out source files from build when on windows with clang. The source code contained in row_gcc.cc is gcc syntax inline assembly available for any platform that supports gcc or clang for intel cpus.
BUG=440
TESTED=try bots
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1430 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-06-09 17:27:52 +00:00
fbarchard@google.com
05416e2d9a Box filter for YUV use rows with accumulation buffer for better memory behavior. The old code would do columns accumulated into registers, and then store the result once. This was slow from a memory point of view. The new code does a row of source at a time, updating an accumulation buffer every row. The accumulation buffer is small, and should fit cache. Before each accumulation of N rows, the buffer needs to be reset to zero. If the memset is a bottleneck, it would be faster to do the first row without an add, storing to the accumulation buffer, and then add for the remaining rows.
BUG=425
TESTED=out\release\libyuv_unittest --gtest_filter=*ScaleTo1x1*
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1428 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-06-09 01:05:18 +00:00
fbarchard@google.com
632c50f29c include posix source for 64 bit clang builds.
BUG=440
TESTED=ninja -C out\Release_x64
R=bcornell@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1407 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-05-14 21:40:05 +00:00
fbarchard@google.com
484e5d2d23 make windows code built with clangcl include the _posix source code. depot_tools excludes these source files now, so they need to be manually included.
BUG=435
TESTED=clangcl local build on windows
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1394 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-05-02 00:15:05 +00:00
fbarchard@google.com
9f4636e298 AVX2 port of ScaleDownBy4.
BUG=314
TESTED=out\release\libyuv_unittest --gtest_filter=*.ScaleDownBy4*

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1390 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-04-30 01:58:32 +00:00
fbarchard@google.com
4e78b8dc2e scale to 3/4 or 3/8 with odd width destinations efficiently. previously if width was not multiple of what the simd loop would do (24), scaling would fall back on slower C code. This change allows SIMD to be used for most of the scaling and C for the remainder, improving efficiency.
BUG=314
TESTED=set LIBYUV_WIDTH=1896 & ScaleDownBy3by4_*
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1380 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-04-27 21:56:08 +00:00
fbarchard@google.com
013e812275 Port box filter to AVX2.
BUG=libyuv:425
TESTED=c:\intelsde\sde -ast -hsw -- out\release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*libyuvTest.ScaleTo640x360_Box
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1367 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-04-14 00:21:15 +00:00
fbarchard@google.com
b5ea79d845 add rows handle height of 1 using a more general while-style loop.
BUG=none
TESTED=try bots

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1366 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-04-13 18:56:08 +00:00
fbarchard@google.com
c7161d1c36 Remove code alignment declspec from Visual C versions for vs2014 compatibility.
BUG=422
TESTED=local vs2013 build still passes.

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1365 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-04-12 23:54:26 +00:00
fbarchard@google.com
c70c7c02ff scale to half size optimization for avx2 - use pmaddubsw instruction to horizontally add bytes, then pavgw to round and divide by 2.
BUG=314
TESTED=libyuvTest.ScaleDownBy2*
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1352 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-31 23:59:27 +00:00
fbarchard@google.com
72673ac873 linear and point sample scale to half size for AVX2.
BUG=314
TESTED=out\release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*.ScaleDownBy2*
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1349 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-30 21:46:08 +00:00
fbarchard@google.com
9ef8999ff3 scale to half size use pmadd/pavgw to horizontal averaging.
BUG=314
TESTED=out\release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*.ScaleDownBy2*
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1348 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-27 18:20:21 +00:00
fbarchard@google.com
e6ca9cc2a2 Scale down by 2 AVX2 port. Processes twice as many pixels as SSE2 and takes advantage of 3 argument instructions to reduce register usage and number of instructions.
BUG=314
TESTED=libyuvTest.ScaleDownBy2_Box
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1347 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-26 23:21:08 +00:00
fbarchard@google.com
d41fbf40dd Handle scale down by factor of 2 efficiently by calling SIMD for multiple of 16 destination pixels, and C for remainder.
BUG=314
TESTED=out\release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*.ScaleDownBy2*
R=bcornell@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1344 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-24 23:25:30 +00:00
fbarchard@google.com
d28cd77f99 Enable assembly for clangcl build on Windows. Previously assembly was disabled so clangcl would work, but only with C code. As clangcl mimics both Visual C and GCC, ifdefs need to pick one or the other or often you'll end up with both. In this CL we disable most Visual C code and use the GCC versions which allow assembly for both 32 and 64 bit intel.
BUG=412
TESTED=clang=1 build on windows
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1341 16f28f9a-4ce2-e073-06de-1de4eb20be90
2015-03-19 20:36:31 +00:00
fbarchard@google.com
c5aac16af9 Remove loop alignment for benefit of modern cpus that dont require alignment.
BUG=none
TESTED=local libyuv unittest passes
R=brucedawson@google.com, tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1180 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-11-24 21:26:22 +00:00
fbarchard@google.com
91f240c5db Move sub before branch for loops.
Remove CopyRow_x86
Add CopyRow_Any versions for AVX, SSE2 and Neon.
BUG=269
TESTED=local build
R=harryjin@google.com, tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1175 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-11-20 21:14:27 +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
044f914c29 Change scale to unaligned movdqu.
BUG=365
TESTED=scale unittests
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1101 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-10-01 01:16:04 +00:00
fbarchard@google.com
1f923e3ea6 Declare parameters that are unused, since C does not let you give a type without name.
BUG=303
TEST=compile -x c

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@954 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-01-07 05:42:27 +00:00
fbarchard@google.com
5dba58cb1e FixedDiv1 using a single 64/32 divide. Removes size restriction from slope.
BUG=302
TESTED=libyuv scale tests
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@940 16f28f9a-4ce2-e073-06de-1de4eb20be90
2014-01-02 22:32:09 +00:00
fbarchard@google.com
0db78ad127 Switch from xor/mov bx, to movzx ebx, which still passes drmemory and valgrind.
BUG=none
TESTED=drmemory

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@904 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-12-08 19:23:41 +00:00
fbarchard@google.com
48e5364313 Use xor/mov bx instead of movzx to avoid drmemory bug
BUG=none
TEST=none
R=johannkoenig@google.com, tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@891 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-12-04 03:04:58 +00:00
fbarchard@google.com
c2295807bd Reduce alignment for loops from 16 bytes to 4 bytes. Reduces outer loop overhead without hurting innerloop time.
BUG=none
TESTED=try bots
R=fbarchard@chromium.org, mflodman@webrtc.org

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@880 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-12-02 15:57:39 +00:00
fbarchard@google.com
dbe4814361 Move scale row functions to scale_win etc
BUG=none
TEST=untested
R=tpsiaki@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@879 16f28f9a-4ce2-e073-06de-1de4eb20be90
2013-11-28 01:16:15 +00:00