Update libaom to rev b25610052a1398032320008d69b51d2da94f5928

This commit is contained in:
trav90 2018-10-19 23:00:02 -05:00 • committed by Roy Tam
commit 3d109dd4fc
240 changed files with 16977 additions and 6139 deletions

View file

@ -17,7 +17,7 @@
/* Implement a function wrapper to guarantee initialization
* thread-safety for library singletons.
*
* NOTE: These functions use static locks, and can only be
* NOTE: This function uses static locks, and can only be
* used with one common argument per compilation unit. So
*
* file1.c:
@ -25,8 +25,8 @@
* ...
* aom_once(foo);
*
* file2.c:
* aom_once(bar);
* file2.c:
* aom_once(bar);
*
* will ensure foo() and bar() are each called only once, but in
*
@ -46,19 +46,19 @@
* local initializers are not thread-safe in MSVC prior to Visual
* Studio 2015.
*
* As a static, once_state will be zero-initialized as program start.
* As a static, aom_once_state will be zero-initialized as program start.
*/
static LONG once_state;
static void once(void (*func)(void)) {
/* Try to advance once_state from its initial value of 0 to 1.
static LONG aom_once_state;
static void aom_once(void (*func)(void)) {
/* Try to advance aom_once_state from its initial value of 0 to 1.
* Only one thread can succeed in doing so.
*/
if (InterlockedCompareExchange(&once_state, 1, 0) == 0) {
/* We're the winning thread, having set once_state to 1.
if (InterlockedCompareExchange(&aom_once_state, 1, 0) == 0) {
/* We're the winning thread, having set aom_once_state to 1.
* Call our function. */
func();
/* Now advance once_state to 2, unblocking any other threads. */
InterlockedIncrement(&once_state);
/* Now advance aom_once_state to 2, unblocking any other threads. */
InterlockedIncrement(&aom_once_state);
return;
}
@ -66,10 +66,10 @@ static void once(void (*func)(void)) {
* the state variable so we don't return before func()
* has finished executing elsewhere.
*
* Try to advance once_state from 2 to 2, which is only possible
* Try to advance aom_once_state from 2 to 2, which is only possible
* after the winning thead advances it from 1 to 2.
*/
while (InterlockedCompareExchange(&once_state, 2, 2) != 2) {
while (InterlockedCompareExchange(&aom_once_state, 2, 2) != 2) {
/* State isn't yet 2. Try again.
*
* We are used for singleton initialization functions,
@ -83,8 +83,8 @@ static void once(void (*func)(void)) {
Sleep(0);
}
/* We've seen once_state advance to 2, so we know func()
* has been called. And we've left once_state as we found it,
/* We've seen aom_once_state advance to 2, so we know func()
* has been called. And we've left aom_once_state as we found it,
* so other threads will have the same experience.
*
* It's safe to return now.
@ -95,7 +95,7 @@ static void once(void (*func)(void)) {
#elif CONFIG_MULTITHREAD && defined(__OS2__)
#define INCL_DOS
#include <os2.h>
static void once(void (*func)(void)) {
static void aom_once(void (*func)(void)) {
static int done;
/* If the initialization is complete, return early. */
@ -117,18 +117,15 @@ static void once(void (*func)(void)) {
#elif CONFIG_MULTITHREAD && HAVE_PTHREAD_H
#include <pthread.h>
static void once(void (*func)(void)) {
static void aom_once(void (*func)(void)) {
static pthread_once_t lock = PTHREAD_ONCE_INIT;
pthread_once(&lock, func);
}
#else
/* No-op version that performs no synchronization. *_rtcd() is idempotent,
* so as long as your platform provides atomic loads/stores of pointers
* no synchronization is strictly necessary.
*/
/* Default version that performs no synchronization. */
static void once(void (*func)(void)) {
static void aom_once(void (*func)(void)) {
static int done;
if (!done) {