Merge commit 'cd975d5658a1cbe99939df75db59d5ae9fbcb4e0'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Nov 2014 00:23:42 +0000 (01:23 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Nov 2014 00:32:55 +0000 (01:32 +0100)
* 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>
1  2 
libavcodec/hevc.c

@@@ -1570,15 -1617,57 +1570,60 @@@ static void chroma_mc_bi(HEVCContext *s
  static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref,
                                  const Mv *mv, int y0, int height)
  {
 -    int y = (mv->y >> 2) + y0 + height + 9;
 -    ff_thread_await_progress(&ref->tf, y, 0);
 +    int y = FFMAX(0, (mv->y >> 2) + y0 + height + 9);
 +
 +    if (s->threads_type == FF_THREAD_FRAME )
 +        ff_thread_await_progress(&ref->tf, y, 0);
  }
  
 -    HEVCLocalContext *lc             = &s->HEVClc;
+ 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)
+ {
 -        mv->pred_flag[0] = 1;
 -        hls_mvd_coding(s, x0, y0, 0);
++    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]);
 -            hls_mvd_coding(s, x0, y0, 1);
++        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 {
 -        mv->pred_flag[1] = 1;
++            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 log2_cb_size, int partIdx, int idx)
  {
  #define POS(c_idx, x, y)                                                              \
      &s->frame->data[c_idx][((y) >> s->sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \