1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avcodec/thread: Move ff_thread_(await|report)_progress to new header

This is in preparation for further commits that will stop
using ThreadFrame for frame-threaded codecs that don't use
ff_thread_(await|report)_progress(); the API for those codecs
having inter-frame depdendencies will live in threadframe.h.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-02-06 07:08:01 +01:00
parent 7fc10e273b
commit b3551b6072
28 changed files with 79 additions and 36 deletions

View File

@ -34,7 +34,7 @@
#include "mpegutils.h"
#include "mpegvideo.h"
#include "rectangle.h"
#include "thread.h"
#include "threadframe.h"
/**
* @param stride the number of MVs to get to the next row

View File

@ -37,6 +37,7 @@
#include "golomb.h"
#include "mathops.h"
#include "ffv1.h"
#include "threadframe.h"
static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,
int is_signed)

View File

@ -30,7 +30,7 @@
#include "h264_ps.h"
#include "mpegutils.h"
#include "rectangle.h"
#include "thread.h"
#include "threadframe.h"
#include <assert.h>

View File

@ -34,7 +34,7 @@
#include "h264dec.h"
#include "h264_ps.h"
#include "qpeldsp.h"
#include "thread.h"
#include "threadframe.h"
static inline int get_lowest_part_list_y(H264SliceContext *sl,
int n, int height, int y_offset, int list)

View File

@ -30,7 +30,7 @@
#include "avcodec.h"
#include "h264dec.h"
#include "mpegutils.h"
#include "thread.h"
#include "threadframe.h"
void ff_h264_unref_picture(H264Context *h, H264Picture *pic)
{

View File

@ -45,7 +45,7 @@
#include "mathops.h"
#include "mpegutils.h"
#include "rectangle.h"
#include "thread.h"
#include "threadframe.h"
static const uint8_t field_scan[16+1] = {
0 + 0 * 4, 0 + 1 * 4, 1 + 0 * 4, 0 + 2 * 4,

View File

@ -46,7 +46,7 @@
#include "mpegutils.h"
#include "profiles.h"
#include "rectangle.h"
#include "thread.h"
#include "threadframe.h"
const uint16_t ff_h264_mb_sizes[4] = { 256, 384, 512, 768 };

View File

@ -26,6 +26,7 @@
#include "libavutil/internal.h"
#include "hevcdec.h"
#include "threadframe.h"
#define LUMA 0
#define CB 1

View File

@ -23,6 +23,7 @@
#include "hevc.h"
#include "hevcdec.h"
#include "threadframe.h"
static const uint8_t l0_l1_cand_idx[12][2] = {
{ 0, 1, },

View File

@ -26,6 +26,7 @@
#include "thread.h"
#include "hevc.h"
#include "hevcdec.h"
#include "threadframe.h"
void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
{

View File

@ -46,6 +46,7 @@
#include "hwconfig.h"
#include "internal.h"
#include "profiles.h"
#include "threadframe.h"
const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 };

View File

@ -35,6 +35,7 @@
#include "hpeldsp.h"
#include "idctdsp.h"
#include "thread.h"
#include "threadframe.h"
#define MIMIC_HEADER_SIZE 20
#define MIMIC_VLC_BITS 11

View File

@ -38,7 +38,7 @@
#include "h263.h"
#include "h263dec.h"
#include "profiles.h"
#include "thread.h"
#include "threadframe.h"
#include "xvididct.h"
#include "unary.h"

View File

@ -43,7 +43,7 @@
#include "mpeg4video.h"
#include "mpegvideodata.h"
#include "qpeldsp.h"
#include "thread.h"
#include "threadframe.h"
#include "wmv2.h"
#include <limits.h>

View File

@ -31,7 +31,7 @@
#include "internal.h"
#include "mpegutils.h"
#include "mpegvideo.h"
#include "thread.h"
#include "threadframe.h"
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
{

View File

@ -36,6 +36,7 @@
#include "png.h"
#include "pngdsp.h"
#include "thread.h"
#include "threadframe.h"
#include <zlib.h>

View File

@ -32,6 +32,7 @@
#include "internal.h"
#include "pthread_internal.h"
#include "thread.h"
#include "threadframe.h"
#include "version.h"
#include "libavutil/avassert.h"

View File

@ -41,7 +41,7 @@
#include "mpeg_er.h"
#include "qpeldsp.h"
#include "rectangle.h"
#include "thread.h"
#include "threadframe.h"
#include "rv34vlc.h"
#include "rv34data.h"

View File

@ -70,32 +70,6 @@ int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture,
*/
void ff_thread_finish_setup(AVCodecContext *avctx);
/**
* Notify later decoding threads when part of their reference picture is ready.
* Call this when some part of the picture is finished decoding.
* Later calls with lower values of progress have no effect.
*
* @param f The picture being decoded.
* @param progress Value, in arbitrary units, of how much of the picture has decoded.
* @param field The field being decoded, for field-picture codecs.
* 0 for top field or frame pictures, 1 for bottom field.
*/
void ff_thread_report_progress(ThreadFrame *f, int progress, int field);
/**
* Wait for earlier decoding threads to finish reference pictures.
* Call this before accessing some part of a picture, with a given
* value for progress, and it will return after the responsible decoding
* thread calls ff_thread_report_progress() with the same or
* higher value for progress.
*
* @param f The picture being referenced.
* @param progress Value, in arbitrary units, to wait for.
* @param field The field being referenced, for field-picture codecs.
* 0 for top field or frame pictures, 1 for bottom field.
*/
void ff_thread_await_progress(ThreadFrame *f, int progress, int field);
#if FF_API_THREAD_SAFE_CALLBACKS
/**
* Wrapper around get_format() for frame-multithreaded codecs.

53
libavcodec/threadframe.h Normal file
View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2022 Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
*
* 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
*/
#ifndef AVCODEC_THREADFRAME_H
#define AVCODEC_THREADFRAME_H
#include "avcodec.h"
#include "thread.h"
/**
* Notify later decoding threads when part of their reference picture is ready.
* Call this when some part of the picture is finished decoding.
* Later calls with lower values of progress have no effect.
*
* @param f The picture being decoded.
* @param progress Value, in arbitrary units, of how much of the picture has decoded.
* @param field The field being decoded, for field-picture codecs.
* 0 for top field or frame pictures, 1 for bottom field.
*/
void ff_thread_report_progress(ThreadFrame *f, int progress, int field);
/**
* Wait for earlier decoding threads to finish reference pictures.
* Call this before accessing some part of a picture, with a given
* value for progress, and it will return after the responsible decoding
* thread calls ff_thread_report_progress() with the same or
* higher value for progress.
*
* @param f The picture being referenced.
* @param progress Value, in arbitrary units, to wait for.
* @param field The field being referenced, for field-picture codecs.
* 0 for top field or frame pictures, 1 for bottom field.
*/
void ff_thread_await_progress(ThreadFrame *f, int progress, int field);
#endif

View File

@ -37,6 +37,7 @@
#include "codec.h"
#include "hwconfig.h"
#include "thread.h"
#include "threadframe.h"
#include "internal.h"
#include "put_bits.h"
#include "startcode.h"

View File

@ -43,6 +43,7 @@
#include "internal.h"
#include "mathops.h"
#include "thread.h"
#include "threadframe.h"
#include "videodsp.h"
#include "vp3data.h"
#include "vp4data.h"

View File

@ -33,6 +33,7 @@
#include "mathops.h"
#include "rectangle.h"
#include "thread.h"
#include "threadframe.h"
#include "vp8.h"
#include "vp8data.h"

View File

@ -27,6 +27,7 @@
#include "internal.h"
#include "profiles.h"
#include "thread.h"
#include "threadframe.h"
#include "pthread_internal.h"
#include "videodsp.h"

View File

@ -23,6 +23,7 @@
#include "libavutil/avassert.h"
#include "threadframe.h"
#include "vp56.h"
#include "vp9.h"
#include "vp9data.h"

View File

@ -21,6 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "threadframe.h"
#include "vp56.h"
#include "vp9.h"
#include "vp9data.h"

View File

@ -24,6 +24,7 @@
#include "libavutil/avassert.h"
#include "libavutil/mem_internal.h"
#include "threadframe.h"
#include "videodsp.h"
#include "vp9data.h"
#include "vp9dec.h"

View File

@ -29,6 +29,7 @@
#include "get_bits.h"
#include "internal.h"
#include "thread.h"
#include "threadframe.h"
#include "unary.h"
#include "wavpack.h"
#include "dsd.h"