Commit b5d197a3 authored by Mickaël Raulet's avatar Mickaël Raulet Committed by Michael Niedermayer

hevc: inline cabac in hls_mvd_coding(cherry picked from commit...

hevc: inline cabac in hls_mvd_coding(cherry picked from commit ad387195ad04e8a005a1bfd509e9e4f827e68fa9)
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 92a97d11
...@@ -917,30 +917,6 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) ...@@ -917,30 +917,6 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size)
return 0; return 0;
} }
static void hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size)
{
HEVCLocalContext *lc = &s->HEVClc;
int x = ff_hevc_abs_mvd_greater0_flag_decode(s);
int y = ff_hevc_abs_mvd_greater0_flag_decode(s);
if (x)
x += ff_hevc_abs_mvd_greater1_flag_decode(s);
if (y)
y += ff_hevc_abs_mvd_greater1_flag_decode(s);
switch (x) {
case 2: lc->pu.mvd.x = ff_hevc_mvd_decode(s); break;
case 1: lc->pu.mvd.x = ff_hevc_mvd_sign_flag_decode(s); break;
case 0: lc->pu.mvd.x = 0; break;
}
switch (y) {
case 2: lc->pu.mvd.y = ff_hevc_mvd_decode(s); break;
case 1: lc->pu.mvd.y = ff_hevc_mvd_sign_flag_decode(s); break;
case 0: lc->pu.mvd.y = 0; break;
}
}
/** /**
* 8.5.3.2.2.1 Luma sample interpolation process * 8.5.3.2.2.1 Luma sample interpolation process
* *
...@@ -1128,7 +1104,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW, int nP ...@@ -1128,7 +1104,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW, int nP
current_mv.ref_idx[0] = ref_idx[0]; current_mv.ref_idx[0] = ref_idx[0];
} }
current_mv.pred_flag[0] = 1; current_mv.pred_flag[0] = 1;
hls_mvd_coding(s, x0, y0, 0); ff_hevc_hls_mvd_coding(s, x0, y0, 0);
mvp_flag[0] = ff_hevc_mvp_lx_flag_decode(s); mvp_flag[0] = ff_hevc_mvp_lx_flag_decode(s);
ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size, ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
partIdx, merge_idx, &current_mv, mvp_flag[0], 0); partIdx, merge_idx, &current_mv, mvp_flag[0], 0);
...@@ -1146,7 +1122,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW, int nP ...@@ -1146,7 +1122,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW, int nP
lc->pu.mvd.x = 0; lc->pu.mvd.x = 0;
lc->pu.mvd.y = 0; lc->pu.mvd.y = 0;
} else { } else {
hls_mvd_coding(s, x0, y0, 1); ff_hevc_hls_mvd_coding(s, x0, y0, 1);
} }
current_mv.pred_flag[1] = 1; current_mv.pred_flag[1] = 1;
......
...@@ -912,10 +912,6 @@ int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH); ...@@ -912,10 +912,6 @@ int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH);
int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx); int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx);
int ff_hevc_mvp_lx_flag_decode(HEVCContext *s); int ff_hevc_mvp_lx_flag_decode(HEVCContext *s);
int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s); int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s);
int ff_hevc_abs_mvd_greater0_flag_decode(HEVCContext *s);
int ff_hevc_abs_mvd_greater1_flag_decode(HEVCContext *s);
int ff_hevc_mvd_decode(HEVCContext *s);
int ff_hevc_mvd_sign_flag_decode(HEVCContext *s);
int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size); int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size);
int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth); int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth);
int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth); int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth);
...@@ -950,6 +946,8 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, ...@@ -950,6 +946,8 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
int log2_trafo_size, enum ScanType scan_idx, int log2_trafo_size, enum ScanType scan_idx,
int c_idx); int c_idx);
void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size);
void ff_hevc_pps_free(HEVCPPS **ppps); void ff_hevc_pps_free(HEVCPPS **ppps);
extern const uint8_t ff_hevc_qpel_extra_before[4]; extern const uint8_t ff_hevc_qpel_extra_before[4];
......
...@@ -844,17 +844,17 @@ int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s) ...@@ -844,17 +844,17 @@ int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s)
return GET_CABAC(elem_offset[NO_RESIDUAL_DATA_FLAG]); return GET_CABAC(elem_offset[NO_RESIDUAL_DATA_FLAG]);
} }
int ff_hevc_abs_mvd_greater0_flag_decode(HEVCContext *s) static av_always_inline int abs_mvd_greater0_flag_decode(HEVCContext *s)
{ {
return GET_CABAC(elem_offset[ABS_MVD_GREATER0_FLAG]); return GET_CABAC(elem_offset[ABS_MVD_GREATER0_FLAG]);
} }
int ff_hevc_abs_mvd_greater1_flag_decode(HEVCContext *s) static av_always_inline int abs_mvd_greater1_flag_decode(HEVCContext *s)
{ {
return GET_CABAC(elem_offset[ABS_MVD_GREATER1_FLAG] + 1); return GET_CABAC(elem_offset[ABS_MVD_GREATER1_FLAG] + 1);
} }
int ff_hevc_mvd_decode(HEVCContext *s) static av_always_inline int mvd_decode(HEVCContext *s)
{ {
int ret = 2; int ret = 2;
int k = 1; int k = 1;
...@@ -870,7 +870,7 @@ int ff_hevc_mvd_decode(HEVCContext *s) ...@@ -870,7 +870,7 @@ int ff_hevc_mvd_decode(HEVCContext *s)
return get_cabac_bypass_sign(&s->HEVClc.cc, -ret); return get_cabac_bypass_sign(&s->HEVClc.cc, -ret);
} }
int ff_hevc_mvd_sign_flag_decode(HEVCContext *s) static av_always_inline int mvd_sign_flag_decode(HEVCContext *s)
{ {
return get_cabac_bypass_sign(&s->HEVClc.cc, -1); return get_cabac_bypass_sign(&s->HEVClc.cc, -1);
} }
...@@ -1392,3 +1392,27 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, ...@@ -1392,3 +1392,27 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
} }
} }
void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size)
{
HEVCLocalContext *lc = &s->HEVClc;
int x = abs_mvd_greater0_flag_decode(s);
int y = abs_mvd_greater0_flag_decode(s);
if (x)
x += abs_mvd_greater1_flag_decode(s);
if (y)
y += abs_mvd_greater1_flag_decode(s);
switch (x) {
case 2: lc->pu.mvd.x = mvd_decode(s); break;
case 1: lc->pu.mvd.x = mvd_sign_flag_decode(s); break;
case 0: lc->pu.mvd.x = 0; break;
}
switch (y) {
case 2: lc->pu.mvd.y = mvd_decode(s); break;
case 1: lc->pu.mvd.y = mvd_sign_flag_decode(s); break;
case 0: lc->pu.mvd.y = 0; break;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment