1146 Commits

Author SHA1 Message Date
Frank Barchard
cc89e3a77b port ARGB to 565 dithering SSE2 code to GCC.
Previously the assembly code was only available to Windows.
This CL ports the SSE2 code to GCC syntax.

When running a profiler on all the unittests, this function
was the slowest of all functions that still ran in C code.
   3.71%  libyuv_unittest  libyuv_unittest      [.] ARGBToRGB565DitherRow_C

Was
ARGBToRGB565Dither_Opt (2894 ms)
Now
ARGBToRGB565Dither_Opt (432 ms)

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

Review URL: https://codereview.chromium.org/1397673002 .
2015-10-07 18:24:50 -07:00
Frank Barchard
3e38762d6b fix avx2 box filter bug for yuv down sampling.
offset to second group of pixels was off by 16.
should have been 32, not 16.
requires avx2 hardware and wide image for test.

R=harryjin@google.com
TBR=harryjin@google.com
BUG=libyuv:492,libyuv:501

Review URL: https://codereview.chromium.org/1395603002 .
2015-10-07 11:02:33 -07:00
Frank Barchard
013080f2d2 Pass yuvconstants to YUV conversions for neon 64 bit
SETUP provided by zhongwei.yao@linaro.org

Previously the 64 bit Neon code had hard coded constants in the setup macro
for YUV conversion, while 32 bit Neon code supported the yuvconstants
parameter.

This change accepts the constants passed to the YUV conversion row function,
allowing different color spaces to be respected - naming JPEG and BT.709.
As well as the existing BT.601.

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

Review URL: https://codereview.chromium.org/1384323002 .
2015-10-06 22:19:14 -07:00
Frank Barchard
914a9856c7 Reimplement NV21ToARGB to allow different color matrix.
Low level for NV21ToARGB written to accept yuv matrix used by
other YUV to ARGB functions.
Previously NV21 was implemented for Windows using NV12 with a different
matrix that swapped U and V.  But the Arm version of the low level does
not allow the matrix U and V contributions to be swapped.
Using a new low level function that reads NV21 and uses the same
yuvconstants as other YUV conversion functions allows an Arm port of
this function.

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

Review URL: https://codereview.chromium.org/1388273002 .
2015-10-06 20:34:44 -07:00
Frank Barchard
68fa59c873 add box scaling avx2 optimization for gcc
TBR=harryjin@google.com
BUG=libyuv:492

Review URL: https://codereview.chromium.org/1392803002 .
2015-10-06 20:01:02 -07:00
Frank Barchard
f00bc9ef46 Add J444ToARGB conversion function.
J444 is JPeg YUV color space with 444 subsampling.
This implementation uses the existing I444ToARGB conversion, which is
BT.601 color space with 444 subsampling, but passing in the jpeg
color matrix constants.

TBR=harryjin@google.com
BUG=449

Review URL: https://codereview.chromium.org/1387313002 .
2015-10-06 18:46:53 -07:00
Frank Barchard
d70293993f port scale box filter sse2 to gcc
TBR=harryjin@google.com
BUG=libyuv:492

Review URL: https://codereview.chromium.org/1393653002 .
2015-10-06 16:54:26 -07:00
Frank Barchard
3eefeaeb69 test xsave before calling xgetbv.
R=agl@chromium.org, harryjin@google.com
BUG=libyuv:497

Review URL: https://codereview.chromium.org/1382803002 .
2015-09-30 17:25:41 -07:00
Frank Barchard
2cc1a2b233 Remove sse2 functions that also have ssse3
ARGBBlendRow_SSE2, ARGBAttenuateRow_SSE2, and MirrorRow_SSE2
Since vast majority of CPUs have SSSE3 now, removing the SSE2
improves the performance of CPU dispatching.

R=harryjin@google.com
BUG=none

Review URL: https://codereview.chromium.org/1377053003 .
2015-09-30 14:24:44 -07:00
Frank Barchard
d039ad6e9b Width use memory instead of register for 32 bit fpic.
Code runs out of registers on 32 bit fpic builts.

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

Review URL: https://codereview.chromium.org/1369053002 .
2015-09-25 15:36:04 -07:00
Frank Barchard
febc26a2c9 win64 version of I422AlphaToARGB.
Was
I420AlphaToARGB_Premult (8861 ms)
I420AlphaToARGB_Opt (7119 ms)
Now
I420AlphaToABGR_Premult (2840 ms)
I420AlphaToARGB_Opt (484 ms)

C function switched to 1 step.
Was
I420AlphaToARGB_Premult (8862 ms)
I420AlphaToABGR_Opt (6718 ms)

Now
I420AlphaToARGB_Premult (8706 ms)
I420AlphaToARGB_Opt (6541 ms)

R=harryjin@google.com
BUG=libyuv:496, libyuv:473

Review URL: https://codereview.chromium.org/1359183003 .
2015-09-25 15:06:41 -07:00
Frank Barchard
9a0e12f5f1 AVX2 1 step I422AlphaToARGB for gcc and win.
C     I420AlphaToARGB_Opt (5169 ms)
SSSE3 I420AlphaToARGB_Opt (432 ms)
AVX2  I420AlphaToARGB_Opt (358 ms)

and with premultiplication as 2 step process:
I420AlphaToARGB_Premult (7029 ms)
I420AlphaToARGB_Premult (757 ms)
I420AlphaToARGB_Premult (508 ms)

R=harryjin@google.com
BUG=libyuv:496,libyuv:473

Review URL: https://codereview.chromium.org/1372653003 .
2015-09-25 13:37:42 -07:00
Frank Barchard
e365cdde3b I420Alpha row function in 1 pass.
API change - I420AlphaToARGB takes flag indicating if RGB should be
premultiplied by alpha.

This version implements an efficient SSSE3 version for Windows.
C version done in 2 steps.

Was
libyuvTest.I420AlphaToARGB_Any (1136 ms)
libyuvTest.I420AlphaToARGB_Unaligned (1210 ms)
libyuvTest.I420AlphaToARGB_Invert (966 ms)
libyuvTest.I420AlphaToARGB_Opt (1031 ms)
libyuvTest.I420AlphaToABGR_Any (1020 ms)
libyuvTest.I420AlphaToABGR_Unaligned (1359 ms)
libyuvTest.I420AlphaToABGR_Invert (1082 ms)
libyuvTest.I420AlphaToABGR_Opt (986 ms)

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

Review URL: https://codereview.chromium.org/1367093002 .
2015-09-25 10:29:20 -07:00
Frank Barchard
d4594beefc switch from ebp to ebx.
ebx encodes more efficiently (1 byte less) for most address modes, than ebp.
previously it was used for 411 format, but the reader uses pinsrw now avoiding
gpr register.

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

Review URL: https://codereview.chromium.org/1365003003 .
2015-09-24 17:25:11 -07:00
Frank Barchard
8fb2048e9f Fix nv12 64 bit gcc increment.
Should be 16 bytes, but was 0x16 causing memory corruption.

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

Review URL: https://codereview.chromium.org/1368693002 .
2015-09-24 10:19:17 -07:00
Frank Barchard
accc04e6d8 NV12ToARGB_AVX2 ported to gcc
TBR=harryjin@google.com
BUG=none

Review URL: https://codereview.chromium.org/1364913002 .
2015-09-23 15:54:16 -07:00
Frank Barchard
000cf89ca8 YUY2ToARGB avx2 in 1 step conversion.
Includes UYVYToARGB ssse3 fix.

Was
YUY2ToARGB_Opt (433 ms)
69.79%  libyuv_unittest  libyuv_unittest      [.] I422ToARGBRow_AVX2
20.73%  libyuv_unittest  libyuv_unittest      [.] YUY2ToUV422Row_AVX2
 6.04%  libyuv_unittest  libyuv_unittest      [.] YUY2ToYRow_AVX2
 0.77%  libyuv_unittest  libyuv_unittest      [.] YUY2ToARGBRow_AVX2

Now
YUY2ToARGB_Opt (280 ms)
95.66%  libyuv_unittest  libyuv_unittest      [.] YUY2ToARGBRow_AVX2

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

Review URL: https://codereview.chromium.org/1364813002 .
2015-09-23 11:15:18 -07:00
Frank Barchard
2b92ec8d0f Fix git markers introduced on landing previous CL
BUG=none

Review URL: https://codereview.chromium.org/1359023003 .
2015-09-22 15:00:57 -07:00
Frank Barchard
5f3d4270d1 yuy2 to rgb gcc versions
read in read function for yuv conversion

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

Review URL: https://codereview.chromium.org/1355393002 .
2015-09-22 14:27:33 -07:00
Frank Barchard
03cd8584e7 Read Y channel in read function for yuv conversion.
Allows reader to support YUY2 format.
Also contains fix for win64 build for yuv conversion.

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

Review URL: https://codereview.chromium.org/1355333002 .
2015-09-22 12:05:16 -07:00
Frank Barchard
f96890a0be yuvconstants for all YUV to RGB conversion functions.
R=harryjin@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1363503002 .
2015-09-22 10:26:03 -07:00
Frank Barchard
62c49dc811 move constants into common
R=harryjin@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1359443005 .
2015-09-18 16:28:44 -07:00
Frank Barchard
0381673d19 port I444 to ARGB to matrix. Add I444 to ABGR.
R=harryjin@google.com
BUG=libyuv:488,libyuv:490

Review URL: https://codereview.chromium.org/1348763005 .
2015-09-18 14:36:15 -07:00
Frank Barchard
28427a53e2 I444ToABGR for android
Reimplements I444ToARGB as a matrix function.
new I444ToABGR as matrix functions with wrappers and any functions.
Allows for future J444 and H444 versions.
I444ToABGR user level function added.

BUG=libyuv:490, libyuv:449
R=harryjin@google.com

Review URL: https://codereview.chromium.org/1355733002 .
2015-09-18 11:20:58 -07:00
Frank Barchard
28ce7d94f5 j422toabgr neon port using i422toabgr matrix function.
R=harryjin@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1353923003 .
2015-09-17 15:20:55 -07:00
Frank Barchard
6fcbae1409 J422ToARGB Neon but not aarch64
TBR=harryjin@google.com
BUG=libyuv:493

Review URL: https://codereview.chromium.org/1348203004 .
2015-09-17 12:43:05 -07:00
Frank Barchard
6a6b67e7a9 Add H422ToARGB armv7 neon version.
Patch provided by zhongwei.yao@linaro.org

R=fbarchard@chromium.org, fbarchard@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1344393002 .
2015-09-17 10:38:15 -07:00
Frank Barchard
509c644245 Add J422ToARGB armv7 neon version.
R=fbarchard@chromium.org, fbarchard@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1334173005 .
2015-09-15 15:01:48 -07:00
Frank Barchard
73c32d92d7 neon64 use yuvconstants like 32 bit code.
TBR=harryjin@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1345643002 .
2015-09-14 16:43:07 -07:00
Frank Barchard
a67927c994 use struct instead of vectors
TBR=harryjin@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1345623003 .
2015-09-14 16:07:58 -07:00
Frank Barchard
909160b3b5 use same macros as row_gcc.cc
R=harryjin@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1343863002 .
2015-09-14 15:36:10 -07:00
Frank Barchard
fcacbfb27f validate scan EOI from end for better coverage
R=tpsiaki@google.com
BUG=libyuv:478

Review URL: https://codereview.chromium.org/1344623003 .
2015-09-14 10:58:51 -07:00
Frank Barchard
67a9e30225 neon yuv matrix function
R=harryjin@google.com
BUG=libyuv:488

Review URL: https://codereview.chromium.org/1337973002 .
2015-09-11 11:12:30 -07:00
Frank Barchard
316e1ab996 avx2 width parameter bug fix
R=harryjin@google.com
BUG=libyuv:489

Review URL: https://codereview.chromium.org/1321773004 .
2015-09-09 11:56:35 -07:00
Frank Barchard
ed55d24d9f H420 functionality
R=harryjin@google.com
BUG=libyuv:488

Review URL: https://webrtc-codereview.appspot.com/54869004 .
2015-09-06 11:01:40 -07:00
Frank Barchard
67b06e66cb I422ToABGR for win64. Moves any functions to accomidate win64 subset of formats.
TBR=harryjin@google.com
BUG=libyuv:488

Review URL: https://webrtc-codereview.appspot.com/57679004 .
2015-09-03 11:00:18 -07:00
Frank Barchard
7060e0d826 I420ToABGRMatrix functions with J420ToABGR wrapper.
Allows direct conversion from JPeg to ABGR for android.

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

Review URL: https://webrtc-codereview.appspot.com/55719004 .
2015-09-03 10:42:36 -07:00
Frank Barchard
925c3d9e26 I420ToARGB conversion with matrix.
Take color conversion constants as a parameter to row function for I420ToARGBMatrixRow_SSSE3.
Allows future variations of color space using a single low level.

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

Review URL: https://webrtc-codereview.appspot.com/56669004 .
2015-09-02 10:45:42 -07:00
Frank Barchard
0bc626a5d7 nolint removed
R=harryjin@google.com
BUG=none

Review URL: https://webrtc-codereview.appspot.com/59389004.
2015-08-31 10:52:13 -07:00
Frank Barchard
0735245c52 pinsrw instruction allows reading 2 bytes directly into an xmm register.
Saving a gpr register allows the register to not be pushed for now, and in future it can be used to point to color conversion matrix or alpha channel.

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

Review URL: https://webrtc-codereview.appspot.com/52789004.
2015-08-28 17:03:54 -07:00
Frank Barchard
be11f500f0 Use ebp to point to conversion table.
Proof of concept that conversions can table color matrix as a parameter.

R=harryjin@google.com

BUG=libyuv:472, libyuv:488

Review URL: https://webrtc-codereview.appspot.com/58489004.
2015-08-28 12:00:49 -07:00
Frank Barchard
3c4f5735ce use pointer to inverse table for clangcl
R=harryjin@google.com
TBR=harryjin@google.com
BUG=none

Review URL: https://webrtc-codereview.appspot.com/54859004.
2015-08-26 12:53:03 -07:00
Frank Barchard
5452cce452 port row to clangcl
BUG=libyuv:487
R=harryjin@google.com

Review URL: https://webrtc-codereview.appspot.com/53799005.
2015-08-25 16:15:42 -07:00
Frank Barchard
fa7ce4af3f fixed table for clangcl
R=harryjin@google.com
BUG=libyuv:487

Review URL: https://webrtc-codereview.appspot.com/53799004.
2015-08-25 10:47:30 -07:00
Frank Barchard
d317a70c1d llvm64 link error fix.
R=harryjin@google.com
BUG=libyuv:485

Review URL: https://webrtc-codereview.appspot.com/58479004.
2015-08-24 14:21:04 -07:00
Frank Barchard
4dfdabb552 I420AlphaToABGR for android version of yuva conversion
Same as I420AlphaToARGB but first step converts to ABGR instead of ARGB.

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

Review URL: https://webrtc-codereview.appspot.com/52779004.
2015-08-20 19:36:59 -07:00
Frank Barchard
ee9aaea02f i422torgb565 is asm for clangcl as well
Merge branch 'master' of https://chromium.googlesource.com/libyuv/libyuv into convertcl

allow lto for llvm but not gcc

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

Review URL: https://webrtc-codereview.appspot.com/52769004.
2015-08-19 10:46:30 -07: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
cda9d38a4e xmmword cast for clang
clangcl use compare_win for 32 bit, allowing fallback and enabling avx2 code for clang.
move defines/protos to compare_row.h
fix issue with odd width ARGBCopyAlpha functions by copying destination to temp buffer, then doing alpha copy, then copy back to destination.

R=harryjin@google.com
TBR=harryjin@google.com
BUG=libyuv:484

Review URL: https://webrtc-codereview.appspot.com/59379004.
2015-08-18 11:13:12 -07:00
Frank Barchard
baf6a3c1bd Using the visual C source allows clangcl to fallback seamlessly to visual c, and supports SSE41 and AVX2 versions.
R=harryjin@google.com
BUG=libyuv:469

Review URL: https://webrtc-codereview.appspot.com/58469004.
2015-08-17 10:47:43 -07:00