chromium/third_party/ffmpeg/libavcodec/pthread_frame.c

/*
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

/**
 * @file
 * Frame multithreading support functions
 * @see doc/multithreading.txt
 */

#include <stdatomic.h>

#include "avcodec.h"
#include "avcodec_internal.h"
#include "codec_desc.h"
#include "codec_internal.h"
#include "decode.h"
#include "hwaccel_internal.h"
#include "hwconfig.h"
#include "internal.h"
#include "pthread_internal.h"
#include "refstruct.h"
#include "thread.h"
#include "threadframe.h"
#include "version_major.h"

#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/common.h"
#include "libavutil/cpu.h"
#include "libavutil/frame.h"
#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/thread.h"

enum {};

enum {};

ThreadFrameProgress;

/**
 * Context used by codec threads and stored in their AVCodecInternal thread_ctx.
 */
PerThreadContext;

/**
 * Context stored in the client AVCodecInternal thread_ctx.
 */
FrameThreadContext;

static int hwaccel_serial(const AVCodecContext *avctx)
{}

static void async_lock(FrameThreadContext *fctx)
{}

static void async_unlock(FrameThreadContext *fctx)
{}

static void thread_set_name(PerThreadContext *p)
{}

/**
 * Codec worker thread.
 *
 * Automatically calls ff_thread_finish_setup() if the codec does
 * not provide an update_thread_context method, or if the codec returns
 * before calling it.
 */
static attribute_align_arg void *frame_worker_thread(void *arg)
{}

/**
 * Update the next thread's AVCodecContext with values from the reference thread's context.
 *
 * @param dst The destination context.
 * @param src The source context.
 * @param for_user 0 if the destination is a codec thread, 1 if the destination is the user's thread
 * @return 0 on success, negative error code on failure
 */
static int update_context_from_thread(AVCodecContext *dst, const AVCodecContext *src, int for_user)
{}

/**
 * Update the next thread's AVCodecContext with values set by the user.
 *
 * @param dst The destination context.
 * @param src The source context.
 * @return 0 on success, negative error code on failure
 */
static int update_context_from_user(AVCodecContext *dst, const AVCodecContext *src)
{}

static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx,
                         AVPacket *avpkt)
{}

int ff_thread_decode_frame(AVCodecContext *avctx,
                           AVFrame *picture, int *got_picture_ptr,
                           AVPacket *avpkt)
{}

void ff_thread_report_progress(ThreadFrame *f, int n, int field)
{}

void ff_thread_await_progress(const ThreadFrame *f, int n, int field)
{}

void ff_thread_finish_setup(AVCodecContext *avctx) {}

/// Waits for all threads to finish.
static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count)
{}

#define OFF
DEFINE_OFFSET_ARRAY();
#undef OFF

#define OFF
DEFINE_OFFSET_ARRAY();
#undef OFF

void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
{}

static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
                               FrameThreadContext *fctx, AVCodecContext *avctx,
                               const FFCodec *codec, int first)
{}

int ff_frame_thread_init(AVCodecContext *avctx)
{}

void ff_thread_flush(AVCodecContext *avctx)
{}

int ff_thread_can_start_frame(AVCodecContext *avctx)
{}

static int thread_get_buffer_internal(AVCodecContext *avctx, AVFrame *f, int flags)
{}

int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
{}

int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
{}

void ff_thread_release_ext_buffer(ThreadFrame *f)
{}

enum ThreadingStatus ff_thread_sync_ref(AVCodecContext *avctx, size_t offset)
{}