static int hls_transform_unit(HEVCContext *s, int x0, int y0,
int xBase, int yBase, int cb_xBase, int cb_yBase,
int log2_cb_size, int log2_trafo_size,
- int trafo_depth, int blk_idx,
- int cbf_luma, int *cbf_cb, int *cbf_cr)
+ int blk_idx, int cbf_luma, int *cbf_cb, int *cbf_cr)
{
HEVCLocalContext *lc = s->HEVClc;
const int log2_trafo_size_c = log2_trafo_size - s->sps->hshift[1];
}
ret = hls_transform_unit(s, x0, y0, xBase, yBase, cb_xBase, cb_yBase,
- log2_cb_size, log2_trafo_size, trafo_depth,
+ log2_cb_size, log2_trafo_size,
blk_idx, cbf_luma, cbf_cb, cbf_cr);
if (ret < 0)
return ret;
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)
int min_cb_width = s->sps->min_cb_width;
int x_cb = x0 >> log2_min_cb_size;
int y_cb = y0 >> log2_min_cb_size;
- int ref_idx[2];
- int mvp_flag[2];
int x_pu, y_pu;
int i, j;
- if (SAMPLE_CTB(s->skip_flag, x_cb, y_cb)) {
+ int skip_flag = SAMPLE_CTB(s->skip_flag, x_cb, y_cb);
+
+ if (!skip_flag)
+ lc->pu.merge_flag = ff_hevc_merge_flag_decode(s);
+
+ if (skip_flag || lc->pu.merge_flag) {
if (s->sh.max_num_merge_cand > 1)
merge_idx = ff_hevc_merge_idx_decode(s);
else
merge_idx = 0;
- ff_hevc_luma_mv_merge_mode(s, x0, y0,
- 1 << log2_cb_size,
- 1 << log2_cb_size,
- log2_cb_size, partIdx,
- merge_idx, ¤t_mv);
- x_pu = x0 >> s->sps->log2_min_pu_size;
- y_pu = y0 >> s->sps->log2_min_pu_size;
-
- for (j = 0; j < nPbH >> s->sps->log2_min_pu_size; j++)
- for (i = 0; i < nPbW >> s->sps->log2_min_pu_size; i++)
- tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv;
- } else { /* MODE_INTER */
- lc->pu.merge_flag = ff_hevc_merge_flag_decode(s);
- if (lc->pu.merge_flag) {
- if (s->sh.max_num_merge_cand > 1)
- merge_idx = ff_hevc_merge_idx_decode(s);
- else
- merge_idx = 0;
-
- ff_hevc_luma_mv_merge_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
- partIdx, merge_idx, ¤t_mv);
- x_pu = x0 >> s->sps->log2_min_pu_size;
- y_pu = y0 >> s->sps->log2_min_pu_size;
-
- for (j = 0; j < nPbH >> s->sps->log2_min_pu_size; j++)
- for (i = 0; i < nPbW >> s->sps->log2_min_pu_size; i++)
- tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv;
- } else {
- enum InterPredIdc inter_pred_idc = PRED_L0;
- 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]) {
- ref_idx[0] = ff_hevc_ref_idx_lx_decode(s, s->sh.nb_refs[L0]);
- current_mv.ref_idx[0] = ref_idx[0];
- }
- current_mv.pred_flag = PF_L0;
- ff_hevc_hls_mvd_coding(s, x0, y0, 0);
- mvp_flag[0] = ff_hevc_mvp_lx_flag_decode(s);
- ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
- partIdx, merge_idx, ¤t_mv,
- mvp_flag[0], 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]) {
- ref_idx[1] = ff_hevc_ref_idx_lx_decode(s, s->sh.nb_refs[L1]);
- current_mv.ref_idx[1] = ref_idx[1];
- }
-
- 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[1] = ff_hevc_mvp_lx_flag_decode(s);
- ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
- partIdx, merge_idx, ¤t_mv,
- mvp_flag[1], 1);
- current_mv.mv[1].x += lc->pu.mvd.x;
- current_mv.mv[1].y += lc->pu.mvd.y;
- }
+ ff_hevc_luma_mv_merge_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
+ partIdx, merge_idx, ¤t_mv);
+ } else {
+ hevc_luma_mv_mpv_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
+ partIdx, merge_idx, ¤t_mv);
+ }
- x_pu = x0 >> s->sps->log2_min_pu_size;
- y_pu = y0 >> s->sps->log2_min_pu_size;
+ x_pu = x0 >> s->sps->log2_min_pu_size;
+ y_pu = y0 >> s->sps->log2_min_pu_size;
- for(j = 0; j < nPbH >> s->sps->log2_min_pu_size; j++)
- for (i = 0; i < nPbW >> s->sps->log2_min_pu_size; i++)
- tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv;
- }
- }
+ for (j = 0; j < nPbH >> s->sps->log2_min_pu_size; j++)
+ for (i = 0; i < nPbW >> s->sps->log2_min_pu_size; i++)
+ tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv;
if (current_mv.pred_flag & PF_L0) {
ref0 = refPicList[0].ref[current_mv.ref_idx[0]];