aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/hevc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-22 01:23:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-22 01:32:55 +0100
commit148506c965dde46ca8166c04f398bd8e85f81f3c (patch)
treebf9f1f61269584bab9c6d4ad1f8d047d9c3425a9 /libavcodec/hevc.c
parent70e3fae88d5993b69016c82d4528ad343cc19e3b (diff)
parentcd975d5658a1cbe99939df75db59d5ae9fbcb4e0 (diff)
downloadffmpeg-148506c965dde46ca8166c04f398bd8e85f81f3c.tar.gz
Merge commit 'cd975d5658a1cbe99939df75db59d5ae9fbcb4e0'
* commit 'cd975d5658a1cbe99939df75db59d5ae9fbcb4e0': hevc: Spin the mv_mpv_mode calls in a stand alone function Conflicts: libavcodec/hevc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r--libavcodec/hevc.c88
1 files changed, 47 insertions, 41 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index dda54e8f91..d4dc52c9dd 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -1576,6 +1576,51 @@ static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref,
ff_thread_await_progress(&ref->tf, y, 0);
}
+static void hevc_luma_mv_mpv_mode(HEVCContext *s, int x0, int y0, int nPbW,
+ int nPbH, int log2_cb_size, int part_idx,
+ int merge_idx, MvField *mv)
+{
+ HEVCLocalContext *lc = s->HEVClc;
+ enum InterPredIdc inter_pred_idc = PRED_L0;
+ int mvp_flag;
+
+ ff_hevc_set_neighbour_available(s, x0, y0, nPbW, nPbH);
+ mv->pred_flag = 0;
+ if (s->sh.slice_type == B_SLICE)
+ inter_pred_idc = ff_hevc_inter_pred_idc_decode(s, nPbW, nPbH);
+
+ if (inter_pred_idc != PRED_L1) {
+ if (s->sh.nb_refs[L0])
+ mv->ref_idx[0]= ff_hevc_ref_idx_lx_decode(s, s->sh.nb_refs[L0]);
+
+ mv->pred_flag = PF_L0;
+ ff_hevc_hls_mvd_coding(s, x0, y0, 0);
+ mvp_flag = ff_hevc_mvp_lx_flag_decode(s);
+ ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
+ part_idx, merge_idx, mv, mvp_flag, 0);
+ mv->mv[0].x += lc->pu.mvd.x;
+ mv->mv[0].y += lc->pu.mvd.y;
+ }
+
+ if (inter_pred_idc != PRED_L0) {
+ if (s->sh.nb_refs[L1])
+ mv->ref_idx[1]= ff_hevc_ref_idx_lx_decode(s, s->sh.nb_refs[L1]);
+
+ if (s->sh.mvd_l1_zero_flag == 1 && inter_pred_idc == PRED_BI) {
+ AV_ZERO32(&lc->pu.mvd);
+ } else {
+ ff_hevc_hls_mvd_coding(s, x0, y0, 1);
+ }
+
+ mv->pred_flag += PF_L1;
+ mvp_flag = ff_hevc_mvp_lx_flag_decode(s);
+ ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
+ part_idx, merge_idx, mv, mvp_flag, 1);
+ mv->mv[1].x += lc->pu.mvd.x;
+ mv->mv[1].y += lc->pu.mvd.y;
+ }
+}
+
static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
int nPbW, int nPbH,
int log2_cb_size, int partIdx, int idx)
@@ -1616,47 +1661,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
ff_hevc_luma_mv_merge_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
partIdx, merge_idx, &current_mv);
} else {
- enum InterPredIdc inter_pred_idc = PRED_L0;
- int mvp_flag;
-
- ff_hevc_set_neighbour_available(s, x0, y0, nPbW, nPbH);
- current_mv.pred_flag = 0;
- if (s->sh.slice_type == B_SLICE)
- inter_pred_idc = ff_hevc_inter_pred_idc_decode(s, nPbW, nPbH);
-
- if (inter_pred_idc != PRED_L1) {
- if (s->sh.nb_refs[L0]) {
- current_mv.ref_idx[0]= ff_hevc_ref_idx_lx_decode(s, s->sh.nb_refs[L0]);
- }
- current_mv.pred_flag = PF_L0;
- ff_hevc_hls_mvd_coding(s, x0, y0, 0);
- mvp_flag = ff_hevc_mvp_lx_flag_decode(s);
- ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
- partIdx, merge_idx, &current_mv,
- mvp_flag, 0);
- current_mv.mv[0].x += lc->pu.mvd.x;
- current_mv.mv[0].y += lc->pu.mvd.y;
- }
-
- if (inter_pred_idc != PRED_L0) {
- if (s->sh.nb_refs[L1]) {
- current_mv.ref_idx[1]= ff_hevc_ref_idx_lx_decode(s, s->sh.nb_refs[L1]);
- }
-
- if (s->sh.mvd_l1_zero_flag == 1 && inter_pred_idc == PRED_BI) {
- AV_ZERO32(&lc->pu.mvd);
- } else {
- ff_hevc_hls_mvd_coding(s, x0, y0, 1);
- }
-
- current_mv.pred_flag += PF_L1;
- mvp_flag = ff_hevc_mvp_lx_flag_decode(s);
- ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
- partIdx, merge_idx, &current_mv,
- mvp_flag, 1);
- current_mv.mv[1].x += lc->pu.mvd.x;
- current_mv.mv[1].y += lc->pu.mvd.y;
- }
+ hevc_luma_mv_mpv_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
+ partIdx, merge_idx, &current_mv);
}
x_pu = x0 >> s->sps->log2_min_pu_size;