Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation
@ 2023-09-14 16:53 Andreas Rheinhardt
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 2/5] avcodec/pthread_frame: Remove unused enum values Andreas Rheinhardt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-14 16:53 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/thread.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index 2c8c0cdb16..180e1137ae 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.h
@@ -73,12 +73,7 @@ void ff_thread_finish_setup(AVCodecContext *avctx);
 int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags);
 
 /**
- * Wrapper around release_buffer() frame-for multithreaded codecs.
- * Call this function instead of avctx->release_buffer(f).
- * The AVFrame will be copied and the actual release_buffer() call
- * will be performed later. The contents of data pointed to by the
- * AVFrame should not be changed until ff_thread_get_buffer() is called
- * on it.
+ * Wrapper around av_frame_unref() for frame-threaded codecs.
  *
  * @param avctx The current context.
  * @param f The picture being released.
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 2/5] avcodec/pthread_frame: Remove unused enum values
  2023-09-14 16:53 [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt
@ 2023-09-14 17:01 ` Andreas Rheinhardt
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 3/5] avcodec/pthread_frame: Fix doxygen comments Andreas Rheinhardt
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-14 17:01 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

No longer used since the removal of FF_API_THREAD_SAFE_CALLBACKS
in e0786a8eeb9e7c8feb057e83f284491f0a87e463.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/pthread_frame.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 6b792bfc39..58a9101888 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -55,16 +55,6 @@ enum {
     STATE_INPUT_READY,
     ///< Set before the codec has called ff_thread_finish_setup().
     STATE_SETTING_UP,
-    /**
-     * Set when the codec calls get_buffer().
-     * State is returned to STATE_SETTING_UP afterwards.
-     */
-    STATE_GET_BUFFER,
-     /**
-      * Set when the codec calls get_format().
-      * State is returned to STATE_SETTING_UP afterwards.
-      */
-    STATE_GET_FORMAT,
     ///< Set after the codec has called ff_thread_finish_setup().
     STATE_SETUP_FINISHED,
 };
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 3/5] avcodec/pthread_frame: Fix doxygen comments
  2023-09-14 16:53 [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 2/5] avcodec/pthread_frame: Remove unused enum values Andreas Rheinhardt
@ 2023-09-14 17:01 ` Andreas Rheinhardt
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 4/5] avcodec/threadframe: Move ff_thread_can_start_frame() to thread.h Andreas Rheinhardt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-14 17:01 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

The '<' in ///< says that the comment pertains to the previous item
on the same line as the ///<.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/pthread_frame.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 58a9101888..4973d64550 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -51,11 +51,11 @@
 #include "libavutil/thread.h"
 
 enum {
-    ///< Set when the thread is awaiting a packet.
+    /// Set when the thread is awaiting a packet.
     STATE_INPUT_READY,
-    ///< Set before the codec has called ff_thread_finish_setup().
+    /// Set before the codec has called ff_thread_finish_setup().
     STATE_SETTING_UP,
-    ///< Set after the codec has called ff_thread_finish_setup().
+    /// Set after the codec has called ff_thread_finish_setup().
     STATE_SETUP_FINISHED,
 };
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 4/5] avcodec/threadframe: Move ff_thread_can_start_frame() to thread.h
  2023-09-14 16:53 [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 2/5] avcodec/pthread_frame: Remove unused enum values Andreas Rheinhardt
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 3/5] avcodec/pthread_frame: Fix doxygen comments Andreas Rheinhardt
@ 2023-09-14 17:01 ` Andreas Rheinhardt
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 5/5] avcodec/pthread_frame: Only set PerThreadContext* when frame-threading Andreas Rheinhardt
  2023-09-16 12:49 ` [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-14 17:01 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It does not use ThreadFrames at all, so thread.h is the correct place.
bcb0faeaba60b5d329fafee2e55f28d3c709e7b1 was wrong.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegvideo_dec.c | 1 +
 libavcodec/thread.h        | 2 ++
 libavcodec/threadframe.h   | 2 --
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 6aa979433c..7aa46a4e25 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -37,6 +37,7 @@
 #include "mpegvideo.h"
 #include "mpegvideodec.h"
 #include "mpeg4videodec.h"
+#include "thread.h"
 #include "threadframe.h"
 #include "wmv2dec.h"
 
diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index 180e1137ae..4edcfc3172 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.h
@@ -52,6 +52,8 @@ void ff_thread_flush(AVCodecContext *avctx);
 int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture,
                            int *got_picture_ptr, AVPacket *avpkt);
 
+int ff_thread_can_start_frame(AVCodecContext *avctx);
+
 /**
  * If the codec defines update_thread_context(), call this
  * when they are ready for the next thread to start decoding
diff --git a/libavcodec/threadframe.h b/libavcodec/threadframe.h
index d581c408a5..a8403c8976 100644
--- a/libavcodec/threadframe.h
+++ b/libavcodec/threadframe.h
@@ -87,6 +87,4 @@ int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src);
 int ff_thread_replace_frame(AVCodecContext *avctx, ThreadFrame *dst,
                             const ThreadFrame *src);
 
-int ff_thread_can_start_frame(AVCodecContext *avctx);
-
 #endif
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 5/5] avcodec/pthread_frame: Only set PerThreadContext* when frame-threading
  2023-09-14 16:53 [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt
                   ` (2 preceding siblings ...)
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 4/5] avcodec/threadframe: Move ff_thread_can_start_frame() to thread.h Andreas Rheinhardt
@ 2023-09-14 17:01 ` Andreas Rheinhardt
  2023-09-16 12:49 ` [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-14 17:01 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Otherwise the thread_ctx pointer might be NULL or point to
a SliceThreadContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/pthread_frame.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 4973d64550..b53fb54906 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -644,10 +644,12 @@ void ff_thread_await_progress(const ThreadFrame *f, int n, int field)
 }
 
 void ff_thread_finish_setup(AVCodecContext *avctx) {
-    PerThreadContext *p = avctx->internal->thread_ctx;
+    PerThreadContext *p;
 
     if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return;
 
+    p = avctx->internal->thread_ctx;
+
     p->hwaccel_threadsafe = avctx->hwaccel &&
                             (ffhwaccel(avctx->hwaccel)->caps_internal & HWACCEL_CAP_THREAD_SAFE);
 
@@ -956,11 +958,12 @@ void ff_thread_flush(AVCodecContext *avctx)
 
 int ff_thread_can_start_frame(AVCodecContext *avctx)
 {
-    PerThreadContext *p = avctx->internal->thread_ctx;
-
-    if ((avctx->active_thread_type&FF_THREAD_FRAME) && atomic_load(&p->state) != STATE_SETTING_UP &&
+    if ((avctx->active_thread_type & FF_THREAD_FRAME) &&
         ffcodec(avctx->codec)->update_thread_context) {
-        return 0;
+        PerThreadContext *p = avctx->internal->thread_ctx;
+
+        if (atomic_load(&p->state) != STATE_SETTING_UP)
+            return 0;
     }
 
     return 1;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation
  2023-09-14 16:53 [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt
                   ` (3 preceding siblings ...)
  2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 5/5] avcodec/pthread_frame: Only set PerThreadContext* when frame-threading Andreas Rheinhardt
@ 2023-09-16 12:49 ` Andreas Rheinhardt
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-16 12:49 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/thread.h | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/libavcodec/thread.h b/libavcodec/thread.h
> index 2c8c0cdb16..180e1137ae 100644
> --- a/libavcodec/thread.h
> +++ b/libavcodec/thread.h
> @@ -73,12 +73,7 @@ void ff_thread_finish_setup(AVCodecContext *avctx);
>  int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags);
>  
>  /**
> - * Wrapper around release_buffer() frame-for multithreaded codecs.
> - * Call this function instead of avctx->release_buffer(f).
> - * The AVFrame will be copied and the actual release_buffer() call
> - * will be performed later. The contents of data pointed to by the
> - * AVFrame should not be changed until ff_thread_get_buffer() is called
> - * on it.
> + * Wrapper around av_frame_unref() for frame-threaded codecs.
>   *
>   * @param avctx The current context.
>   * @param f The picture being released.

Will apply this patchset tomorrow unless there are objections.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-16 12:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-14 16:53 [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt
2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 2/5] avcodec/pthread_frame: Remove unused enum values Andreas Rheinhardt
2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 3/5] avcodec/pthread_frame: Fix doxygen comments Andreas Rheinhardt
2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 4/5] avcodec/threadframe: Move ff_thread_can_start_frame() to thread.h Andreas Rheinhardt
2023-09-14 17:01 ` [FFmpeg-devel] [PATCH 5/5] avcodec/pthread_frame: Only set PerThreadContext* when frame-threading Andreas Rheinhardt
2023-09-16 12:49 ` [FFmpeg-devel] [PATCH 1/5] avcodec/thread: Remove outdated documentation Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git