|
|
|
@ -192,7 +192,7 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb) |
|
|
|
|
s->sh.chroma_offset_l0[i][1] = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (s->sh.slice_type == B_SLICE) { |
|
|
|
|
if (s->sh.slice_type == HEVC_SLICE_B) { |
|
|
|
|
for (i = 0; i < s->sh.nb_refs[L1]; i++) { |
|
|
|
|
luma_weight_l1_flag[i] = get_bits1(gb); |
|
|
|
|
if (!luma_weight_l1_flag[i]) { |
|
|
|
@ -510,14 +510,14 @@ static int hls_slice_header(HEVCContext *s) |
|
|
|
|
skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
|
|
|
|
|
|
|
|
|
|
sh->slice_type = get_ue_golomb_long(gb); |
|
|
|
|
if (!(sh->slice_type == I_SLICE || |
|
|
|
|
sh->slice_type == P_SLICE || |
|
|
|
|
sh->slice_type == B_SLICE)) { |
|
|
|
|
if (!(sh->slice_type == HEVC_SLICE_I || |
|
|
|
|
sh->slice_type == HEVC_SLICE_P || |
|
|
|
|
sh->slice_type == HEVC_SLICE_B)) { |
|
|
|
|
av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", |
|
|
|
|
sh->slice_type); |
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
} |
|
|
|
|
if (IS_IRAP(s) && sh->slice_type != I_SLICE) { |
|
|
|
|
if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { |
|
|
|
|
av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); |
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
} |
|
|
|
@ -608,16 +608,16 @@ static int hls_slice_header(HEVCContext *s) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sh->nb_refs[L0] = sh->nb_refs[L1] = 0; |
|
|
|
|
if (sh->slice_type == P_SLICE || sh->slice_type == B_SLICE) { |
|
|
|
|
if (sh->slice_type == HEVC_SLICE_P || sh->slice_type == HEVC_SLICE_B) { |
|
|
|
|
int nb_refs; |
|
|
|
|
|
|
|
|
|
sh->nb_refs[L0] = s->ps.pps->num_ref_idx_l0_default_active; |
|
|
|
|
if (sh->slice_type == B_SLICE) |
|
|
|
|
if (sh->slice_type == HEVC_SLICE_B) |
|
|
|
|
sh->nb_refs[L1] = s->ps.pps->num_ref_idx_l1_default_active; |
|
|
|
|
|
|
|
|
|
if (get_bits1(gb)) { // num_ref_idx_active_override_flag
|
|
|
|
|
sh->nb_refs[L0] = get_ue_golomb_long(gb) + 1; |
|
|
|
|
if (sh->slice_type == B_SLICE) |
|
|
|
|
if (sh->slice_type == HEVC_SLICE_B) |
|
|
|
|
sh->nb_refs[L1] = get_ue_golomb_long(gb) + 1; |
|
|
|
|
} |
|
|
|
|
if (sh->nb_refs[L0] > HEVC_MAX_REFS || sh->nb_refs[L1] > HEVC_MAX_REFS) { |
|
|
|
@ -641,7 +641,7 @@ static int hls_slice_header(HEVCContext *s) |
|
|
|
|
sh->list_entry_lx[0][i] = get_bits(gb, av_ceil_log2(nb_refs)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (sh->slice_type == B_SLICE) { |
|
|
|
|
if (sh->slice_type == HEVC_SLICE_B) { |
|
|
|
|
sh->rpl_modification_flag[1] = get_bits1(gb); |
|
|
|
|
if (sh->rpl_modification_flag[1] == 1) |
|
|
|
|
for (i = 0; i < sh->nb_refs[L1]; i++) |
|
|
|
@ -649,7 +649,7 @@ static int hls_slice_header(HEVCContext *s) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (sh->slice_type == B_SLICE) |
|
|
|
|
if (sh->slice_type == HEVC_SLICE_B) |
|
|
|
|
sh->mvd_l1_zero_flag = get_bits1(gb); |
|
|
|
|
|
|
|
|
|
if (s->ps.pps->cabac_init_present_flag) |
|
|
|
@ -660,7 +660,7 @@ static int hls_slice_header(HEVCContext *s) |
|
|
|
|
sh->collocated_ref_idx = 0; |
|
|
|
|
if (sh->slice_temporal_mvp_enabled_flag) { |
|
|
|
|
sh->collocated_list = L0; |
|
|
|
|
if (sh->slice_type == B_SLICE) |
|
|
|
|
if (sh->slice_type == HEVC_SLICE_B) |
|
|
|
|
sh->collocated_list = !get_bits1(gb); |
|
|
|
|
|
|
|
|
|
if (sh->nb_refs[sh->collocated_list] > 1) { |
|
|
|
@ -674,8 +674,8 @@ static int hls_slice_header(HEVCContext *s) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ((s->ps.pps->weighted_pred_flag && sh->slice_type == P_SLICE) || |
|
|
|
|
(s->ps.pps->weighted_bipred_flag && sh->slice_type == B_SLICE)) { |
|
|
|
|
if ((s->ps.pps->weighted_pred_flag && sh->slice_type == HEVC_SLICE_P) || |
|
|
|
|
(s->ps.pps->weighted_bipred_flag && sh->slice_type == HEVC_SLICE_B)) { |
|
|
|
|
pred_weight_table(s, gb); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1347,8 +1347,8 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, |
|
|
|
|
int pic_height = s->ps.sps->height; |
|
|
|
|
int mx = mv->x & 3; |
|
|
|
|
int my = mv->y & 3; |
|
|
|
|
int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || |
|
|
|
|
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); |
|
|
|
|
int weight_flag = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || |
|
|
|
|
(s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); |
|
|
|
|
int idx = ff_hevc_pel_weight[block_w]; |
|
|
|
|
|
|
|
|
|
x_off += mv->x >> 2; |
|
|
|
@ -1410,8 +1410,8 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, |
|
|
|
|
int my0 = mv0->y & 3; |
|
|
|
|
int mx1 = mv1->x & 3; |
|
|
|
|
int my1 = mv1->y & 3; |
|
|
|
|
int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || |
|
|
|
|
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); |
|
|
|
|
int weight_flag = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || |
|
|
|
|
(s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); |
|
|
|
|
int x_off0 = x_off + (mv0->x >> 2); |
|
|
|
|
int y_off0 = y_off + (mv0->y >> 2); |
|
|
|
|
int x_off1 = x_off + (mv1->x >> 2); |
|
|
|
@ -1496,8 +1496,8 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, |
|
|
|
|
int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; |
|
|
|
|
int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; |
|
|
|
|
const Mv *mv = ¤t_mv->mv[reflist]; |
|
|
|
|
int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || |
|
|
|
|
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); |
|
|
|
|
int weight_flag = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || |
|
|
|
|
(s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); |
|
|
|
|
int idx = ff_hevc_pel_weight[block_w]; |
|
|
|
|
int hshift = s->ps.sps->hshift[1]; |
|
|
|
|
int vshift = s->ps.sps->vshift[1]; |
|
|
|
@ -1561,8 +1561,8 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF |
|
|
|
|
uint8_t *src2 = ref1->data[cidx+1]; |
|
|
|
|
ptrdiff_t src1stride = ref0->linesize[cidx+1]; |
|
|
|
|
ptrdiff_t src2stride = ref1->linesize[cidx+1]; |
|
|
|
|
int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || |
|
|
|
|
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); |
|
|
|
|
int weight_flag = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || |
|
|
|
|
(s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); |
|
|
|
|
int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; |
|
|
|
|
int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; |
|
|
|
|
Mv *mv0 = ¤t_mv->mv[0]; |
|
|
|
@ -1662,7 +1662,7 @@ static void hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, |
|
|
|
|
|
|
|
|
|
ff_hevc_set_neighbour_available(s, x0, y0, nPbW, nPbH); |
|
|
|
|
mv->pred_flag = 0; |
|
|
|
|
if (s->sh.slice_type == B_SLICE) |
|
|
|
|
if (s->sh.slice_type == HEVC_SLICE_B) |
|
|
|
|
inter_pred_idc = ff_hevc_inter_pred_idc_decode(s, nPbW, nPbH); |
|
|
|
|
|
|
|
|
|
if (inter_pred_idc != PRED_L1) { |
|
|
|
@ -2040,7 +2040,7 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) |
|
|
|
|
} else |
|
|
|
|
lc->cu.cu_transquant_bypass_flag = 0; |
|
|
|
|
|
|
|
|
|
if (s->sh.slice_type != I_SLICE) { |
|
|
|
|
if (s->sh.slice_type != HEVC_SLICE_I) { |
|
|
|
|
uint8_t skip_flag = ff_hevc_skip_flag_decode(s, x0, y0, x_cb, y_cb); |
|
|
|
|
|
|
|
|
|
x = y_cb * min_cb_width + x_cb; |
|
|
|
@ -2066,7 +2066,7 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) |
|
|
|
|
} else { |
|
|
|
|
int pcm_flag = 0; |
|
|
|
|
|
|
|
|
|
if (s->sh.slice_type != I_SLICE) |
|
|
|
|
if (s->sh.slice_type != HEVC_SLICE_I) |
|
|
|
|
lc->cu.pred_mode = ff_hevc_pred_mode_decode(s); |
|
|
|
|
if (lc->cu.pred_mode != MODE_INTRA || |
|
|
|
|
log2_cb_size == s->ps.sps->log2_min_cb_size) { |
|
|
|
@ -2806,7 +2806,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!s->sh.dependent_slice_segment_flag && |
|
|
|
|
s->sh.slice_type != I_SLICE) { |
|
|
|
|
s->sh.slice_type != HEVC_SLICE_I) { |
|
|
|
|
ret = ff_hevc_slice_rpl(s); |
|
|
|
|
if (ret < 0) { |
|
|
|
|
av_log(s->avctx, AV_LOG_WARNING, |
|
|
|
|