Commit Graph

18 Commits

Author SHA1 Message Date
Johann
b4fb99220b clang-format v5.0.0 vpx_util/vpx_atomic.h
Allow*OnASingleLine appears to no longer apply to
typedef structs.

Change-Id: If10db1c30c74ee31dad1a0b1926964e850f15fd2
2018-01-12 09:15:19 -08:00
Peter Boström
6822fb2f09 Remove support for stdatomic.h.
This header doesn't build on g++ v6 as it's a C and not C++ header
(_Atomic is not a keyword in C++11). Since the C and C++ invocations
cannot be guaranteed to point to the same underlying atomic_int
implementation, remove support for them and use compiler intrinsics
instead.

BUG=webm:1461

Change-Id: Ie1cd6759c258042efc87f51f036b9aa53e4ea9d5
2017-09-06 11:59:50 -04:00
Peter Boström
d42e876164 Add atomics to vp8 synchronization primitives.
Fixes issue on iPad Pro 10.5 (and probably other places) where threads
are not properly synchronized. On x86 this data race was benign as load
and store instructions are atomic, they were being atomic in practice as
the program hasn't been observed to be miscompiled.

Such guarantees are not made outside x86, and real problems manifested
where libvpx reliably reproduced a broken bitstream for even just the
initial keyframe. This was detected in WebRTC where this device started
using multithreading (as its CPU count is higher than earlier devices,
where the problem did not manifest as single-threading was used in
practice).

This issue was not detected under thread-sanitizer bots as mutexes were
conditionally used under this platform to simulate the protected read
and write semantics that were in practice provided on x86 platforms.

This change also removes several mutexes, so encoder/decoder state is
lighter-weight after this change and we do not need to initialize so
many mutexes (this was done even on non-thread-sanitizer platforms where
they were unused).

Change-Id: If41fcb0d99944f7bbc8ec40877cdc34d672ae72a
2017-08-31 17:55:57 -07:00
Jerome Jiang
ff2d220d21 Remove duplication on vp8/9_write_yuv_frame.
Change-Id: Ib3546032a27c715bf509c0e24d26a189bc829da8
2017-06-09 17:08:26 -07:00
Aleksey Vasenev
343b6b09a1 Align thread entry point stack
_beginthreadex does not align the stack on 16-byte boundary as expected
by gcc.

On x86 targets, the force_align_arg_pointer attribute may be applied to
individual function definitions, generating an alternate prologue and
epilogue that realigns the run-time stack if necessary. This supports
mixing legacy codes that run with a 4-byte aligned stack with modern
codes that keep a 16-byte stack for SSE compatibility.
https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html

Change-Id: Ie4e4ab32948c238fa87054d5664189972ca6708e
Signed-off-by: Aleksey Vasenev <margtu-fivt@ya.ru>
2016-08-10 11:57:34 -07:00
clang-format
6565c17f24 vpx_util: apply clang-format
Change-Id: Ie7eab608e2906b9a2b3533db95292ebc430ad377
2016-07-25 22:33:21 -07:00
James Zern
3007081a87 vpx_thread: use CreateThread for windows phone
BUG=b/29583578

original webp change:

commit d2afe974f9d751de144ef09d31255aea13b442c0
Author: James Zern <jzern@google.com>
Date:   Mon Nov 23 20:41:26 2015 -0800

    thread: use CreateThread for windows phone

    _beginthreadex is unavailable for winrt/uwp

    Change-Id: Ie7412a568278ac67f0047f1764e2521193d74d4d

100644 blob 93f7622797f05f6acc1126e8296c481d276e4047 src/utils/thread.c
100644 blob 840831185502d42a3246e4b7ff870121c8064791 src/utils/thread.h

Change-Id: Iade8fff6367b45534986c77ebe61abeb45bce0f8
2016-07-01 19:36:58 -07:00
James Zern
7954e67bb8 vpx_thread: use WaitForSingleObjectEx if available
BUG=b/29583578

original webp change:

commit 0fd0e12bfe83f16ce4f1c038b251ccbc13c62ac2
Author: James Zern <jzern@google.com>
Date:   Mon Nov 23 20:40:26 2015 -0800

    thread: use WaitForSingleObjectEx if available

    Windows XP and up

    Change-Id: Ie1a46a82722b8624437c8aba0aa4566a4b0b3f57

100644 blob d58f74e5523dbc985fc531cf5f0833f1e9157cf0 src/utils/thread.c
100644 blob 840831185502d42a3246e4b7ff870121c8064791 src/utils/thread.h

Change-Id: If165c38b378c6e0c55e17a1b071efd3ec3e7dcdd
2016-07-01 19:36:58 -07:00
James Zern
a48d42a804 vpx_thread: use InitializeCriticalSectionEx if available
BUG=b/29583578

original webp change:

commit 63fadc9ffacc77d4617526a50c696d21d558a70b
Author: James Zern <jzern@google.com>
Date:   Mon Nov 23 20:38:46 2015 -0800

    thread: use InitializeCriticalSectionEx if available

    Windows Vista / Server 2008 and up

    Change-Id: I32c5b4e5384d614c5a821ef511293ff014c67966

100644 blob f84207d89b3a6bb98bfe8f3fa55cad72dfd061ff src/utils/thread.c
100644 blob 840831185502d42a3246e4b7ff870121c8064791 src/utils/thread.h

Change-Id: I9ce49b3a86857267e504cd8ceab503b7b441d614
2016-07-01 19:36:58 -07:00
James Zern
8cc525e82b vpx_thread: use native windows cond var if available
BUG=b/29583578

original webp change:

commit 110ad5835ecd66995d0e7f66dca1b90dea595f5a
Author: James Zern <jzern@google.com>
Date:   Mon Nov 23 19:49:58 2015 -0800

    thread: use native windows cond var if available

    Vista / Server 2008 and up. no speed difference observed.

    Change-Id: Ice19704777cb679b290dc107a751a0f36dd0c0a9

100644 blob 4fc372b7bc6980a9ed3618c8cce5b67ed7b0f412 src/utils/thread.c
100644 blob 840831185502d42a3246e4b7ff870121c8064791 src/utils/thread.h

Change-Id: Iede7ae8a7184e4b17a4050b33956918fc84e15b5
2016-07-01 19:36:58 -07:00
James Zern
d4d6c58e37 vpx_thread.[hc]: update webp source reference
+ drop the blob hash, the updated reference will be updated in the
commit message

BUG=b/29583578

Change-Id: Ifabbe52a2f07ac29e1881f5c8a62d7f3eb3c2c04
2016-07-01 19:36:58 -07:00
KO Myung-Hun
14e8adea3c vpx: Add OS/2-specific threading codes
With correction of a type of a thread function for new threading
codes.

Change-Id: Ic6dc9f530698800d1cfe2da327848e8f8b62e31f
2016-05-22 18:11:50 +09:00
Johann
5d5cc0d082 Check for bswap* builtins before using
Canonical builtin checks for clang are to use
__has_builtin. Much less fragile than version checks.

https://code.google.com/p/webm/issues/detail?id=1082

Change-Id: I8151fb75899acdf1a935c23aad9441da99a9abcd
2015-10-14 15:37:53 -07:00
James Zern
2abfd8f92a endian_inl.h: fix mips32 android build
when configuring with mips32-android-gcc HAVE_MIPS32 would be set, but the
ndk does not set -mips32r2 for APP_ABI=mips which results in BSwap32 failing
to build; refine the check in endian_inl.h

Change-Id: I22893fe61f29111eb902d961b500b2174596268d
2015-08-06 12:27:00 -07:00
Jim Bankoski
0fe589f21e Fill buffer speed up
Eliminates the byte by byte read from bool decoder,  by reading
in a size_t and then shifting it into place.

Change-Id: I0ed8c7b6f942847e79cc90105dc1d2b5b3deb0d6
2015-07-21 12:54:44 -07:00
Jim Bankoski
da9db83270 Revert "Fill buffer speed up"
This reverts commit 9b4f9f45ee.

Change-Id: I23545ac8c7464127f7466fc6a58de517874fe0cf
2015-07-13 13:47:46 +00:00
Jim Bankoski
9b4f9f45ee Fill buffer speed up
Eliminates the byte by byte read from bool decoder,  by reading
in a size_t and then shifting it into place.

Change-Id: Id89241977103fc3b973e4ed172a5cbf246998e5d
2015-07-09 11:41:30 -07:00
Jingning Han
d1b30ceaa3 Rename vpx_thread to vpx_util
Change the dir name to include more util tools.

Change-Id: Id5b16062803ce5eed872fe2edb36d7e56b32eed8
2015-07-02 10:02:37 -07:00