/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ // // Multi-threaded worker // // Original source: // https://chromium.googlesource.com/webm/libwebp // Enable GNU extensions in glibc so that we can call pthread_setname_np(). // This must be before any #include statements. #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <assert.h> #include <string.h> // for memset() #include "config/aom_config.h" #include "aom_mem/aom_mem.h" #include "aom_ports/sanitizer.h" #include "aom_util/aom_pthread.h" #include "aom_util/aom_thread.h" #if CONFIG_MULTITHREAD struct AVxWorkerImpl { … }; //------------------------------------------------------------------------------ static void execute(AVxWorker *const worker); // Forward declaration. static THREADFN thread_loop(void *ptr) { … } // main thread state control static void change_state(AVxWorker *const worker, AVxWorkerStatus new_status) { … } #endif // CONFIG_MULTITHREAD //------------------------------------------------------------------------------ static void init(AVxWorker *const worker) { … } static int sync(AVxWorker *const worker) { … } static int reset(AVxWorker *const worker) { … } static void execute(AVxWorker *const worker) { … } static void launch(AVxWorker *const worker) { … } static void end(AVxWorker *const worker) { … } //------------------------------------------------------------------------------ static AVxWorkerInterface g_worker_interface = …; int aom_set_worker_interface(const AVxWorkerInterface *const winterface) { … } const AVxWorkerInterface *aom_get_worker_interface(void) { … } //------------------------------------------------------------------------------