[FFmpeg-devel] [PATCH 2/2] lavc/pthread_slice: rename ff_thread_await/report_progress2()

Anton Khirnov anton at khirnov.net
Thu Oct 10 18:28:14 EEST 2024


To ff_slice_thread_await/report_progress().
---
 libavcodec/hevc/hevcdec.c  | 16 ++++++++--------
 libavcodec/pthread_slice.c |  4 ++--
 libavcodec/thread.h        |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 1f80bbe8ab..c5384c35cc 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -2765,14 +2765,14 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, void *hevc_lclist,
         hls_decode_neighbour(lc, l, pps, sps, x_ctb, y_ctb, ctb_addr_ts);
 
         if (ctb_row)
-            ff_thread_await_progress2(s->avctx, ctb_row - 1,
-                                      progress + SHIFT_CTB_WPP + 1);
+            ff_slice_thread_await_progress(s->avctx, ctb_row - 1,
+                                           progress + SHIFT_CTB_WPP + 1);
 
         /* atomic_load's prototype requires a pointer to non-const atomic variable
          * (due to implementations via mutexes, where reads involve writes).
          * Of course, casting const away here is nevertheless safe. */
         if (atomic_load((atomic_int*)&s->wpp_err)) {
-            ff_thread_report_progress2(s->avctx, ctb_row, INT_MAX);
+            ff_slice_thread_report_progress(s->avctx, ctb_row, INT_MAX);
             return 0;
         }
 
@@ -2796,19 +2796,19 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, void *hevc_lclist,
         ctb_addr_ts++;
 
         ff_hevc_save_states(lc, pps, ctb_addr_ts);
-        ff_thread_report_progress2(s->avctx, ctb_row, ++progress);
+        ff_slice_thread_report_progress(s->avctx, ctb_row, ++progress);
         ff_hevc_hls_filters(lc, l, pps, x_ctb, y_ctb, ctb_size);
 
         if (!more_data && (x_ctb+ctb_size) < sps->width && ctb_row != s->sh.num_entry_point_offsets) {
             /* Casting const away here is safe, because it is an atomic operation. */
             atomic_store((atomic_int*)&s->wpp_err, 1);
-            ff_thread_report_progress2(s->avctx, ctb_row, INT_MAX);
+            ff_slice_thread_report_progress(s->avctx, ctb_row, INT_MAX);
             return 0;
         }
 
         if ((x_ctb+ctb_size) >= sps->width && (y_ctb+ctb_size) >= sps->height ) {
             ff_hevc_hls_filter(lc, l, pps, x_ctb, y_ctb, ctb_size);
-            ff_thread_report_progress2(s->avctx, ctb_row, INT_MAX);
+            ff_slice_thread_report_progress(s->avctx, ctb_row, INT_MAX);
             return ctb_addr_ts;
         }
         ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts];
@@ -2818,14 +2818,14 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, void *hevc_lclist,
             break;
         }
     }
-    ff_thread_report_progress2(s->avctx, ctb_row, INT_MAX);
+    ff_slice_thread_report_progress(s->avctx, ctb_row, INT_MAX);
 
     return 0;
 error:
     l->tab_slice_address[ctb_addr_rs] = -1;
     /* Casting const away here is safe, because it is an atomic operation. */
     atomic_store((atomic_int*)&s->wpp_err, 1);
-    ff_thread_report_progress2(s->avctx, ctb_row, INT_MAX);
+    ff_slice_thread_report_progress(s->avctx, ctb_row, INT_MAX);
     return ret;
 }
 
diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c
index 93e452e99f..5db449348b 100644
--- a/libavcodec/pthread_slice.c
+++ b/libavcodec/pthread_slice.c
@@ -180,7 +180,7 @@ int ff_slice_thread_init(AVCodecContext *avctx)
     return 0;
 }
 
-void ff_thread_report_progress2(AVCodecContext *avctx, int job, int val)
+void ff_slice_thread_report_progress(AVCodecContext *avctx, int job, int val)
 {
     SliceThreadContext *p = avctx->internal->thread_ctx;
     Progress *const progress = &p->progress[job];
@@ -191,7 +191,7 @@ void ff_thread_report_progress2(AVCodecContext *avctx, int job, int val)
     pthread_mutex_unlock(&progress->mutex);
 }
 
-void ff_thread_await_progress2(AVCodecContext *avctx, int job, int val)
+void ff_slice_thread_await_progress(AVCodecContext *avctx, int job, int val)
 {
     SliceThreadContext *p  = avctx->internal->thread_ctx;
     Progress *progress = &p->progress[job];
diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index db3ec0b98c..e11facd73d 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.h
@@ -58,8 +58,8 @@ int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx,
         int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count);
 
 int ff_slice_thread_init_progress(AVCodecContext *avctx, int job_count);
-void ff_thread_report_progress2(AVCodecContext *avctx, int job, int val);
-void ff_thread_await_progress2(AVCodecContext *avctx,  int job, int val);
+void ff_slice_thread_report_progress(AVCodecContext *avctx, int job, int val);
+void ff_slice_thread_await_progress(AVCodecContext *avctx,  int job, int val);
 
 enum ThreadingStatus {
     FF_THREAD_IS_COPY,
-- 
2.43.0



More information about the ffmpeg-devel mailing list