@@ -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
@@ -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)
@@ -30,7 +30,7 @@
#include "h264_ps.h"
#include "mpegutils.h"
#include "rectangle.h"
-#include "thread.h"
+#include "threadframe.h"
#include <assert.h>
@@ -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)
@@ -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)
{
@@ -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,
@@ -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 };
@@ -26,6 +26,7 @@
#include "libavutil/internal.h"
#include "hevcdec.h"
+#include "threadframe.h"
#define LUMA 0
#define CB 1
@@ -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, },
@@ -28,6 +28,7 @@
#include "thread.h"
#include "hevc.h"
#include "hevcdec.h"
+#include "threadframe.h"
void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
{
@@ -45,6 +45,7 @@
#include "hevcdec.h"
#include "hwconfig.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 };
@@ -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
@@ -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"
@@ -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>
@@ -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)
{
@@ -36,6 +36,7 @@
#include "png.h"
#include "pngdsp.h"
#include "thread.h"
+#include "threadframe.h"
#include <zlib.h>
@@ -32,6 +32,7 @@
#include "internal.h"
#include "pthread_internal.h"
#include "thread.h"
+#include "threadframe.h"
#include "version.h"
#include "libavutil/avassert.h"
@@ -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"
@@ -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.
new file mode 100644
@@ -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
@@ -38,6 +38,7 @@
#include "codec.h"
#include "hwconfig.h"
#include "thread.h"
+#include "threadframe.h"
#include "internal.h"
#include "put_bits.h"
#include "raw.h"
@@ -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"
@@ -33,6 +33,7 @@
#include "mathops.h"
#include "rectangle.h"
#include "thread.h"
+#include "threadframe.h"
#include "vp8.h"
#include "vp8data.h"
@@ -27,6 +27,7 @@
#include "internal.h"
#include "profiles.h"
#include "thread.h"
+#include "threadframe.h"
#include "pthread_internal.h"
#include "videodsp.h"
@@ -23,6 +23,7 @@
#include "libavutil/avassert.h"
+#include "threadframe.h"
#include "vp56.h"
#include "vp9.h"
#include "vp9data.h"
@@ -22,6 +22,7 @@
*/
#include "internal.h"
+#include "threadframe.h"
#include "vp56.h"
#include "vp9.h"
#include "vp9data.h"
@@ -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"
@@ -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"
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 dependencies will live in threadframe.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/error_resilience.c | 2 +- libavcodec/ffv1dec.c | 1 + libavcodec/h264_direct.c | 2 +- libavcodec/h264_mb.c | 2 +- libavcodec/h264_picture.c | 2 +- libavcodec/h264_slice.c | 2 +- libavcodec/h264dec.c | 2 +- libavcodec/hevc_filter.c | 1 + libavcodec/hevc_mvs.c | 1 + libavcodec/hevc_refs.c | 1 + libavcodec/hevcdec.c | 1 + libavcodec/mimic.c | 1 + libavcodec/mpeg4videodec.c | 2 +- libavcodec/mpegvideo.c | 2 +- libavcodec/mpegvideo_dec.c | 2 +- libavcodec/pngdec.c | 1 + libavcodec/pthread_frame.c | 1 + libavcodec/rv34.c | 2 +- libavcodec/thread.h | 26 ----------------- libavcodec/threadframe.h | 53 +++++++++++++++++++++++++++++++++++ libavcodec/utils.c | 1 + libavcodec/vp3.c | 1 + libavcodec/vp8.c | 1 + libavcodec/vp9.c | 1 + libavcodec/vp9block.c | 1 + libavcodec/vp9mvs.c | 1 + libavcodec/vp9recon.c | 1 + libavcodec/wavpack.c | 1 + 28 files changed, 79 insertions(+), 36 deletions(-) create mode 100644 libavcodec/threadframe.h