[FFmpeg-cvslog] hevc: better mt implementation

Anton Khirnov git at videolan.org
Mon Oct 28 00:37:26 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Oct 27 16:50:20 2013 +0100| [2f77894cccec8dcba47b5217da9b51273c24fbbb] | committer: Michael Niedermayer

hevc: better mt implementation

Signed-off-by: Mickaël Raulet <mraulet at insa-rennes.fr>
(cherry picked from commit 93afb8c519deca85b3c97804927de5b016dd32d1)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f77894cccec8dcba47b5217da9b51273c24fbbb
---

 libavcodec/hevc.c        |   11 +++++------
 libavcodec/hevc_filter.c |    5 ++++-
 libavcodec/hevc_mvs.c    |    2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 1fb350f..011b1ee 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -1066,13 +1066,12 @@ static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, ptrdiff_t ds
 }
 
 static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref,
-                                const Mv *mv, int y0)
+                                const Mv *mv, int y0, int height)
 {
-    int y = (mv->y >> 2) + y0;
+    int y = (mv->y >> 2) + y0 + height + 9;
 
-    //ff_thread_await_progress(&ref->tf, FFMIN(s->height, y), 0);
     if (s->threads_type == FF_THREAD_FRAME )
-        ff_thread_await_progress(&ref->tf, INT_MAX, 0);
+        ff_thread_await_progress(&ref->tf, y, 0);
 }
 
 static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
@@ -1190,13 +1189,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
         ref0 = refPicList[0].ref[current_mv.ref_idx[0]];
         if (!ref0)
             return;
-        hevc_await_progress(s, ref0, &current_mv.mv[0], y0);
+        hevc_await_progress(s, ref0, &current_mv.mv[0], y0, nPbH);
     }
     if (current_mv.pred_flag[1]) {
         ref1 = refPicList[1].ref[current_mv.ref_idx[1]];
         if (!ref1)
             return;
-        hevc_await_progress(s, ref1, &current_mv.mv[1], y0);
+        hevc_await_progress(s, ref1, &current_mv.mv[1], y0, nPbH);
     }
 
     if (current_mv.pred_flag[0] && !current_mv.pred_flag[1]) {
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 497c089..0a6d7c9 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -683,8 +683,11 @@ void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size)
 {
     if (y_ctb && x_ctb)
         ff_hevc_hls_filter(s, x_ctb - ctb_size, y_ctb - ctb_size);
-    if (y_ctb && x_ctb >= s->sps->width - ctb_size)
+    if (y_ctb && x_ctb >= s->sps->width - ctb_size) {
         ff_hevc_hls_filter(s, x_ctb, y_ctb - ctb_size);
+        if (s->threads_type == FF_THREAD_FRAME )
+            ff_thread_report_progress(&s->ref->tf, y_ctb - ctb_size, 0);
+    }
     if (x_ctb && y_ctb >= s->sps->height - ctb_size)
         ff_hevc_hls_filter(s, x_ctb - ctb_size, y_ctb);
 }
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c
index c6e229f..d26de51 100644
--- a/libavcodec/hevc_mvs.c
+++ b/libavcodec/hevc_mvs.c
@@ -268,7 +268,7 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
     y = y0 + nPbH;
 
     if (s->threads_type == FF_THREAD_FRAME )
-        ff_thread_await_progress(&ref->tf, INT_MAX, 0);
+        ff_thread_await_progress(&ref->tf, y, 0);
     if (tab_mvf &&
         (y0 >> s->sps->log2_ctb_size) == (y >> s->sps->log2_ctb_size) &&
         y < s->sps->height &&



More information about the ffmpeg-cvslog mailing list