[FFmpeg-devel] [PATCH 2/4] hevc: use new step progress API
Christophe Gisquet
christophe.gisquet at gmail.com
Wed Jul 23 21:13:44 CEST 2014
Use new API without introducing changes to synchronization points,
i.e. same behaviour.
---
libavcodec/hevc.c | 19 ++++++++++---------
libavcodec/hevc_filter.c | 10 +++++-----
libavcodec/hevc_mvs.c | 4 ++--
libavcodec/hevc_refs.c | 2 +-
4 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 1fee4dd..913385a 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -1614,12 +1614,13 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF
}
static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref,
- const Mv *mv, int y0, int height)
+ const Mv *mv, int x, int y)
{
- int y = (mv->y >> 2) + y0 + height + 9;
-
- if (s->threads_type == FF_THREAD_FRAME )
- ff_thread_await_progress(&ref->tf, y, 0);
+ if (s->threads_type == FF_THREAD_FRAME) {
+ x += (mv->x >> 2) + 9;
+ y += (mv->y >> 2) + 9;
+ ff_thread_await_progress3(&ref->tf, x, y);
+ }
}
static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
@@ -1739,13 +1740,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, ¤t_mv.mv[0], y0, nPbH);
+ hevc_await_progress(s, ref0, ¤t_mv.mv[0], x0+nPbW, y0+nPbH);
}
if (current_mv.pred_flag & PF_L1) {
ref1 = refPicList[1].ref[current_mv.ref_idx[1]];
if (!ref1)
return;
- hevc_await_progress(s, ref1, ¤t_mv.mv[1], y0, nPbH);
+ hevc_await_progress(s, ref1, ¤t_mv.mv[1], x0+nPbW, y0+nPbH);
}
if (current_mv.pred_flag == PF_L0) {
@@ -2625,7 +2626,7 @@ static int hevc_frame_start(HEVCContext *s)
fail:
if (s->ref && s->threads_type == FF_THREAD_FRAME)
- ff_thread_report_progress(&s->ref->tf, INT_MAX, 0);
+ ff_thread_report_progress3_raster_end(&s->ref->tf, INT_MAX);
s->ref = NULL;
return ret;
}
@@ -2984,7 +2985,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
fail:
if (s->ref && s->threads_type == FF_THREAD_FRAME)
- ff_thread_report_progress(&s->ref->tf, INT_MAX, 0);
+ ff_thread_report_progress3_raster_end(&s->ref->tf, INT_MAX);
return ret;
}
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 7b41dd4..62f0ebb 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -702,16 +702,16 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
sao_filter_CTB(s, x - ctb_size, y);
if (y && x_end) {
sao_filter_CTB(s, x, y - ctb_size);
- if (s->threads_type & FF_THREAD_FRAME )
- ff_thread_report_progress(&s->ref->tf, y, 0);
+ if (s->threads_type & FF_THREAD_FRAME)
+ ff_thread_report_progress3_raster_end(&s->ref->tf, y);
}
if (x_end && y_end) {
sao_filter_CTB(s, x , y);
- if (s->threads_type & FF_THREAD_FRAME )
- ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0);
+ if (s->threads_type & FF_THREAD_FRAME)
+ ff_thread_report_progress3_raster_end(&s->ref->tf, y+ctb_size);
}
} else if (s->threads_type & FF_THREAD_FRAME && x_end)
- ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0);
+ ff_thread_report_progress3_raster_end(&s->ref->tf, y + ctb_size - 4);
}
void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size)
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c
index 1d4c002..4564d71 100644
--- a/libavcodec/hevc_mvs.c
+++ b/libavcodec/hevc_mvs.c
@@ -244,7 +244,7 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
x &= -16;
y &= -16;
if (s->threads_type == FF_THREAD_FRAME)
- ff_thread_await_progress(&ref->tf, y, 0);
+ ff_thread_await_progress3(&ref->tf, x, y);
x_pu = x >> s->sps->log2_min_pu_size;
y_pu = y >> s->sps->log2_min_pu_size;
temp_col = TAB_MVF(x_pu, y_pu);
@@ -258,7 +258,7 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
x &= -16;
y &= -16;
if (s->threads_type == FF_THREAD_FRAME)
- ff_thread_await_progress(&ref->tf, y, 0);
+ ff_thread_await_progress3(&ref->tf, x, y);
x_pu = x >> s->sps->log2_min_pu_size;
y_pu = y >> s->sps->log2_min_pu_size;
temp_col = TAB_MVF(x_pu, y_pu);
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 136cc6f..2625517 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -370,7 +370,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
frame->flags = 0;
if (s->threads_type == FF_THREAD_FRAME)
- ff_thread_report_progress(&frame->tf, INT_MAX, 0);
+ ff_thread_report_progress3_raster_end(&frame->tf, INT_MAX);
return frame;
}
--
1.9.2.msysgit.0
More information about the ffmpeg-devel
mailing list