[FFmpeg-cvslog] avcodec/thread: Move ff_thread_(await|report)_progress to new header
Andreas Rheinhardt
git at videolan.org
Wed Feb 9 19:09:38 EET 2022
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Feb 6 07:08:01 2022 +0100| [b3551b6072687539c9e162fcec9e1e42a668ee8c] | committer: Andreas Rheinhardt
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 at khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b3551b6072687539c9e162fcec9e1e42a668ee8c
---
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(-)
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 91cd8a4444..551ef914ce 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -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
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 810b2e18f0..3f90a8fb55 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -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)
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
index 93c2e1e438..014491e29b 100644
--- a/libavcodec/h264_direct.c
+++ b/libavcodec/h264_direct.c
@@ -30,7 +30,7 @@
#include "h264_ps.h"
#include "mpegutils.h"
#include "rectangle.h"
-#include "thread.h"
+#include "threadframe.h"
#include <assert.h>
diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c
index 3cd17b7e4b..0b31774556 100644
--- a/libavcodec/h264_mb.c
+++ b/libavcodec/h264_mb.c
@@ -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)
diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index dcd5874c2e..50a21c260f 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -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)
{
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index dc636c5e78..600a109889 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -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,
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index a47caa95e8..1d648f04b7 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -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 };
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 3c45b5a39e..1ef214b0ff 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -26,6 +26,7 @@
#include "libavutil/internal.h"
#include "hevcdec.h"
+#include "threadframe.h"
#define LUMA 0
#define CB 1
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c
index 1f6ca5a314..7477efcf52 100644
--- a/libavcodec/hevc_mvs.c
+++ b/libavcodec/hevc_mvs.c
@@ -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, },
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index d496918feb..a36cdd3926 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -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)
{
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index ed012c4e75..967f5170e5 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -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 };
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index ade973d860..6a51da5748 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -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
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 2aea845580..655be5697d 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -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"
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index bbcf00b014..14768ca8e8 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -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>
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 1e238bd1e1..57465e41a0 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -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)
{
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 3c00007907..3b12f4057a 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -36,6 +36,7 @@
#include "png.h"
#include "pngdsp.h"
#include "thread.h"
+#include "threadframe.h"
#include <zlib.h>
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 43e097ff06..73dc4d3669 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -32,6 +32,7 @@
#include "internal.h"
#include "pthread_internal.h"
#include "thread.h"
+#include "threadframe.h"
#include "version.h"
#include "libavutil/avassert.h"
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index e68072de06..febd41f577 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -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"
diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index d7d2ddd8f1..091dc8a35e 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.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.
diff --git a/libavcodec/threadframe.h b/libavcodec/threadframe.h
new file mode 100644
index 0000000000..c2caf511b9
--- /dev/null
+++ b/libavcodec/threadframe.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2022 Andreas Rheinhardt <andreas.rheinhardt at 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
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c7c7323351..cf01f72570 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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"
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 791e531862..06b0e873b6 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -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"
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index c9d9117528..cf07789d6c 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -33,6 +33,7 @@
#include "mathops.h"
#include "rectangle.h"
#include "thread.h"
+#include "threadframe.h"
#include "vp8.h"
#include "vp8data.h"
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 24841c5b9f..1250425dce 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -27,6 +27,7 @@
#include "internal.h"
#include "profiles.h"
#include "thread.h"
+#include "threadframe.h"
#include "pthread_internal.h"
#include "videodsp.h"
diff --git a/libavcodec/vp9block.c b/libavcodec/vp9block.c
index 5e6cded2bc..5fdda63545 100644
--- a/libavcodec/vp9block.c
+++ b/libavcodec/vp9block.c
@@ -23,6 +23,7 @@
#include "libavutil/avassert.h"
+#include "threadframe.h"
#include "vp56.h"
#include "vp9.h"
#include "vp9data.h"
diff --git a/libavcodec/vp9mvs.c b/libavcodec/vp9mvs.c
index 774aaa3910..ddce9b6c84 100644
--- a/libavcodec/vp9mvs.c
+++ b/libavcodec/vp9mvs.c
@@ -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"
diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c
index 503091e545..bfafde8c9c 100644
--- a/libavcodec/vp9recon.c
+++ b/libavcodec/vp9recon.c
@@ -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"
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 6b2ec19bf1..5a338d7658 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -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"
More information about the ffmpeg-cvslog
mailing list