mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
Merge commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2'
* commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2': hevc: remove HEVCContext usage from hevc_ps Conflicts: libavcodec/hevc.c libavcodec/hevc_cabac.c libavcodec/hevc_filter.c libavcodec/hevc_mvs.c libavcodec/hevc_ps.c libavcodec/hevc_refs.c libavcodec/hevcpred_template.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
commit
d5fcca83b9
File diff suppressed because it is too large
Load Diff
@ -557,6 +557,17 @@ typedef struct HEVCPPS {
|
||||
int *min_tb_addr_zs_tab;///< MinTbAddrZS
|
||||
} HEVCPPS;
|
||||
|
||||
typedef struct HEVCParamSets {
|
||||
AVBufferRef *vps_list[MAX_VPS_COUNT];
|
||||
AVBufferRef *sps_list[MAX_SPS_COUNT];
|
||||
AVBufferRef *pps_list[MAX_PPS_COUNT];
|
||||
|
||||
/* currently active parameter sets */
|
||||
const HEVCVPS *vps;
|
||||
const HEVCSPS *sps;
|
||||
const HEVCPPS *pps;
|
||||
} HEVCParamSets;
|
||||
|
||||
typedef struct SliceHeader {
|
||||
unsigned int pps_id;
|
||||
|
||||
@ -813,12 +824,7 @@ typedef struct HEVCContext {
|
||||
uint8_t *sao_pixel_buffer_h[3];
|
||||
uint8_t *sao_pixel_buffer_v[3];
|
||||
|
||||
const HEVCVPS *vps;
|
||||
const HEVCSPS *sps;
|
||||
const HEVCPPS *pps;
|
||||
AVBufferRef *vps_list[MAX_VPS_COUNT];
|
||||
AVBufferRef *sps_list[MAX_SPS_COUNT];
|
||||
AVBufferRef *pps_list[MAX_PPS_COUNT];
|
||||
HEVCParamSets ps;
|
||||
|
||||
AVBufferPool *tab_mvf_pool;
|
||||
AVBufferPool *rpl_tab_pool;
|
||||
@ -939,9 +945,12 @@ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx);
|
||||
|
||||
int ff_hevc_decode_nal_vps(HEVCContext *s);
|
||||
int ff_hevc_decode_nal_sps(HEVCContext *s);
|
||||
int ff_hevc_decode_nal_pps(HEVCContext *s);
|
||||
int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCParamSets *ps);
|
||||
int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCParamSets *ps, int apply_defdispwin);
|
||||
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCParamSets *ps);
|
||||
int ff_hevc_decode_nal_sei(HEVCContext *s);
|
||||
|
||||
/**
|
||||
|
@ -499,10 +499,10 @@ static const uint8_t diag_scan8x8_inv[8][8] = {
|
||||
|
||||
void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts)
|
||||
{
|
||||
if (s->pps->entropy_coding_sync_enabled_flag &&
|
||||
(ctb_addr_ts % s->sps->ctb_width == 2 ||
|
||||
(s->sps->ctb_width == 2 &&
|
||||
ctb_addr_ts % s->sps->ctb_width == 0))) {
|
||||
if (s->ps.pps->entropy_coding_sync_enabled_flag &&
|
||||
(ctb_addr_ts % s->ps.sps->ctb_width == 2 ||
|
||||
(s->ps.sps->ctb_width == 2 &&
|
||||
ctb_addr_ts % s->ps.sps->ctb_width == 0))) {
|
||||
memcpy(s->cabac_state, s->HEVClc->cabac_state, HEVC_CONTEXTS);
|
||||
}
|
||||
}
|
||||
@ -553,40 +553,40 @@ static void cabac_init_state(HEVCContext *s)
|
||||
|
||||
void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts)
|
||||
{
|
||||
if (ctb_addr_ts == s->pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]) {
|
||||
if (ctb_addr_ts == s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]) {
|
||||
cabac_init_decoder(s);
|
||||
if (s->sh.dependent_slice_segment_flag == 0 ||
|
||||
(s->pps->tiles_enabled_flag &&
|
||||
s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[ctb_addr_ts - 1]))
|
||||
(s->ps.pps->tiles_enabled_flag &&
|
||||
s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[ctb_addr_ts - 1]))
|
||||
cabac_init_state(s);
|
||||
|
||||
if (!s->sh.first_slice_in_pic_flag &&
|
||||
s->pps->entropy_coding_sync_enabled_flag) {
|
||||
if (ctb_addr_ts % s->sps->ctb_width == 0) {
|
||||
if (s->sps->ctb_width == 1)
|
||||
s->ps.pps->entropy_coding_sync_enabled_flag) {
|
||||
if (ctb_addr_ts % s->ps.sps->ctb_width == 0) {
|
||||
if (s->ps.sps->ctb_width == 1)
|
||||
cabac_init_state(s);
|
||||
else if (s->sh.dependent_slice_segment_flag == 1)
|
||||
load_states(s);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (s->pps->tiles_enabled_flag &&
|
||||
s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[ctb_addr_ts - 1]) {
|
||||
if (s->ps.pps->tiles_enabled_flag &&
|
||||
s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[ctb_addr_ts - 1]) {
|
||||
if (s->threads_number == 1)
|
||||
cabac_reinit(s->HEVClc);
|
||||
else
|
||||
cabac_init_decoder(s);
|
||||
cabac_init_state(s);
|
||||
}
|
||||
if (s->pps->entropy_coding_sync_enabled_flag) {
|
||||
if (ctb_addr_ts % s->sps->ctb_width == 0) {
|
||||
if (s->ps.pps->entropy_coding_sync_enabled_flag) {
|
||||
if (ctb_addr_ts % s->ps.sps->ctb_width == 0) {
|
||||
get_cabac_terminate(&s->HEVClc->cc);
|
||||
if (s->threads_number == 1)
|
||||
cabac_reinit(s->HEVClc);
|
||||
else
|
||||
cabac_init_decoder(s);
|
||||
|
||||
if (s->sps->ctb_width == 1)
|
||||
if (s->ps.sps->ctb_width == 1)
|
||||
cabac_init_state(s);
|
||||
else
|
||||
load_states(s);
|
||||
@ -625,7 +625,7 @@ int ff_hevc_sao_band_position_decode(HEVCContext *s)
|
||||
int ff_hevc_sao_offset_abs_decode(HEVCContext *s)
|
||||
{
|
||||
int i = 0;
|
||||
int length = (1 << (FFMIN(s->sps->bit_depth, 10) - 5)) - 1;
|
||||
int length = (1 << (FFMIN(s->ps.sps->bit_depth, 10) - 5)) - 1;
|
||||
|
||||
while (i < length && get_cabac_bypass(&s->HEVClc->cc))
|
||||
i++;
|
||||
@ -656,10 +656,10 @@ int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s)
|
||||
|
||||
int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0, int x_cb, int y_cb)
|
||||
{
|
||||
int min_cb_width = s->sps->min_cb_width;
|
||||
int min_cb_width = s->ps.sps->min_cb_width;
|
||||
int inc = 0;
|
||||
int x0b = av_mod_uintp2(x0, s->sps->log2_ctb_size);
|
||||
int y0b = av_mod_uintp2(y0, s->sps->log2_ctb_size);
|
||||
int x0b = av_mod_uintp2(x0, s->ps.sps->log2_ctb_size);
|
||||
int y0b = av_mod_uintp2(y0, s->ps.sps->log2_ctb_size);
|
||||
|
||||
if (s->HEVClc->ctb_left_flag || x0b)
|
||||
inc = !!SAMPLE_CTB(s->skip_flag, x_cb - 1, y_cb);
|
||||
@ -706,7 +706,7 @@ int ff_hevc_cu_chroma_qp_offset_flag(HEVCContext *s)
|
||||
|
||||
int ff_hevc_cu_chroma_qp_offset_idx(HEVCContext *s)
|
||||
{
|
||||
int c_max= FFMAX(5, s->pps->chroma_qp_offset_list_len_minus1);
|
||||
int c_max= FFMAX(5, s->ps.pps->chroma_qp_offset_list_len_minus1);
|
||||
int i = 0;
|
||||
|
||||
while (i < c_max && GET_CABAC(elem_offset[CU_CHROMA_QP_OFFSET_IDX]))
|
||||
@ -723,15 +723,15 @@ int ff_hevc_pred_mode_decode(HEVCContext *s)
|
||||
int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0, int y0)
|
||||
{
|
||||
int inc = 0, depth_left = 0, depth_top = 0;
|
||||
int x0b = av_mod_uintp2(x0, s->sps->log2_ctb_size);
|
||||
int y0b = av_mod_uintp2(y0, s->sps->log2_ctb_size);
|
||||
int x_cb = x0 >> s->sps->log2_min_cb_size;
|
||||
int y_cb = y0 >> s->sps->log2_min_cb_size;
|
||||
int x0b = av_mod_uintp2(x0, s->ps.sps->log2_ctb_size);
|
||||
int y0b = av_mod_uintp2(y0, s->ps.sps->log2_ctb_size);
|
||||
int x_cb = x0 >> s->ps.sps->log2_min_cb_size;
|
||||
int y_cb = y0 >> s->ps.sps->log2_min_cb_size;
|
||||
|
||||
if (s->HEVClc->ctb_left_flag || x0b)
|
||||
depth_left = s->tab_ct_depth[(y_cb) * s->sps->min_cb_width + x_cb - 1];
|
||||
depth_left = s->tab_ct_depth[(y_cb) * s->ps.sps->min_cb_width + x_cb - 1];
|
||||
if (s->HEVClc->ctb_up_flag || y0b)
|
||||
depth_top = s->tab_ct_depth[(y_cb - 1) * s->sps->min_cb_width + x_cb];
|
||||
depth_top = s->tab_ct_depth[(y_cb - 1) * s->ps.sps->min_cb_width + x_cb];
|
||||
|
||||
inc += (depth_left > ct_depth);
|
||||
inc += (depth_top > ct_depth);
|
||||
@ -743,7 +743,7 @@ int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size)
|
||||
{
|
||||
if (GET_CABAC(elem_offset[PART_MODE])) // 1
|
||||
return PART_2Nx2N;
|
||||
if (log2_cb_size == s->sps->log2_min_cb_size) {
|
||||
if (log2_cb_size == s->ps.sps->log2_min_cb_size) {
|
||||
if (s->HEVClc->cu.pred_mode == MODE_INTRA) // 0
|
||||
return PART_NxN;
|
||||
if (GET_CABAC(elem_offset[PART_MODE] + 1)) // 01
|
||||
@ -755,7 +755,7 @@ int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size)
|
||||
return PART_NxN; // 000
|
||||
}
|
||||
|
||||
if (!s->sps->amp_enabled_flag) {
|
||||
if (!s->ps.sps->amp_enabled_flag) {
|
||||
if (GET_CABAC(elem_offset[PART_MODE] + 1)) // 01
|
||||
return PART_2NxN;
|
||||
return PART_Nx2N;
|
||||
@ -1075,10 +1075,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
const uint8_t *scan_x_cg, *scan_y_cg, *scan_x_off, *scan_y_off;
|
||||
|
||||
ptrdiff_t stride = s->frame->linesize[c_idx];
|
||||
int hshift = s->sps->hshift[c_idx];
|
||||
int vshift = s->sps->vshift[c_idx];
|
||||
int hshift = s->ps.sps->hshift[c_idx];
|
||||
int vshift = s->ps.sps->vshift[c_idx];
|
||||
uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride +
|
||||
((x0 >> hshift) << s->sps->pixel_shift)];
|
||||
((x0 >> hshift) << s->ps.sps->pixel_shift)];
|
||||
int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer);
|
||||
uint8_t significant_coeff_group_flag[8][8] = {{0}};
|
||||
int explicit_rdpcm_flag = 0;
|
||||
@ -1113,25 +1113,25 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
};
|
||||
int qp_y = lc->qp_y;
|
||||
|
||||
if (s->pps->transform_skip_enabled_flag &&
|
||||
log2_trafo_size <= s->pps->log2_max_transform_skip_block_size) {
|
||||
if (s->ps.pps->transform_skip_enabled_flag &&
|
||||
log2_trafo_size <= s->ps.pps->log2_max_transform_skip_block_size) {
|
||||
transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx);
|
||||
}
|
||||
|
||||
if (c_idx == 0) {
|
||||
qp = qp_y + s->sps->qp_bd_offset;
|
||||
qp = qp_y + s->ps.sps->qp_bd_offset;
|
||||
} else {
|
||||
int qp_i, offset;
|
||||
|
||||
if (c_idx == 1)
|
||||
offset = s->pps->cb_qp_offset + s->sh.slice_cb_qp_offset +
|
||||
offset = s->ps.pps->cb_qp_offset + s->sh.slice_cb_qp_offset +
|
||||
lc->tu.cu_qp_offset_cb;
|
||||
else
|
||||
offset = s->pps->cr_qp_offset + s->sh.slice_cr_qp_offset +
|
||||
offset = s->ps.pps->cr_qp_offset + s->sh.slice_cr_qp_offset +
|
||||
lc->tu.cu_qp_offset_cr;
|
||||
|
||||
qp_i = av_clip(qp_y + offset, - s->sps->qp_bd_offset, 57);
|
||||
if (s->sps->chroma_format_idc == 1) {
|
||||
qp_i = av_clip(qp_y + offset, - s->ps.sps->qp_bd_offset, 57);
|
||||
if (s->ps.sps->chroma_format_idc == 1) {
|
||||
if (qp_i < 30)
|
||||
qp = qp_i;
|
||||
else if (qp_i > 43)
|
||||
@ -1145,18 +1145,18 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
qp = qp_i;
|
||||
}
|
||||
|
||||
qp += s->sps->qp_bd_offset;
|
||||
qp += s->ps.sps->qp_bd_offset;
|
||||
}
|
||||
|
||||
shift = s->sps->bit_depth + log2_trafo_size - 5;
|
||||
shift = s->ps.sps->bit_depth + log2_trafo_size - 5;
|
||||
add = 1 << (shift-1);
|
||||
scale = level_scale[rem6[qp]] << (div6[qp]);
|
||||
scale_m = 16; // default when no custom scaling lists.
|
||||
dc_scale = 16;
|
||||
|
||||
if (s->sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) {
|
||||
const ScalingList *sl = s->pps->scaling_list_data_present_flag ?
|
||||
&s->pps->scaling_list : &s->sps->scaling_list;
|
||||
if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) {
|
||||
const ScalingList *sl = s->ps.pps->scaling_list_data_present_flag ?
|
||||
&s->ps.pps->scaling_list : &s->ps.sps->scaling_list;
|
||||
int matrix_id = lc->cu.pred_mode != MODE_INTRA;
|
||||
|
||||
matrix_id = 3 * matrix_id + c_idx;
|
||||
@ -1172,7 +1172,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
dc_scale = 0;
|
||||
}
|
||||
|
||||
if (lc->cu.pred_mode == MODE_INTER && s->sps->explicit_rdpcm_enabled_flag &&
|
||||
if (lc->cu.pred_mode == MODE_INTER && s->ps.sps->explicit_rdpcm_enabled_flag &&
|
||||
(transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) {
|
||||
explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx);
|
||||
if (explicit_rdpcm_flag) {
|
||||
@ -1303,7 +1303,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
};
|
||||
const uint8_t *ctx_idx_map_p;
|
||||
int scf_offset = 0;
|
||||
if (s->sps->transform_skip_context_enabled_flag &&
|
||||
if (s->ps.sps->transform_skip_context_enabled_flag &&
|
||||
(transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) {
|
||||
ctx_idx_map_p = (uint8_t*) &ctx_idx_map[4 * 16];
|
||||
if (c_idx == 0) {
|
||||
@ -1344,7 +1344,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
}
|
||||
}
|
||||
if (implicit_non_zero_coeff == 0) {
|
||||
if (s->sps->transform_skip_context_enabled_flag &&
|
||||
if (s->ps.sps->transform_skip_context_enabled_flag &&
|
||||
(transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) {
|
||||
if (c_idx == 0) {
|
||||
scf_offset = 42;
|
||||
@ -1389,7 +1389,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
// initialize first elem of coeff_bas_level_greater1_flag
|
||||
int ctx_set = (i > 0 && c_idx == 0) ? 2 : 0;
|
||||
|
||||
if (s->sps->persistent_rice_adaptation_enabled_flag) {
|
||||
if (s->ps.sps->persistent_rice_adaptation_enabled_flag) {
|
||||
if (!transform_skip_flag && !lc->cu.cu_transquant_bypass_flag)
|
||||
sb_type = 2 * (c_idx == 0 ? 1 : 0);
|
||||
else
|
||||
@ -1418,7 +1418,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
|
||||
if (lc->cu.cu_transquant_bypass_flag ||
|
||||
(lc->cu.pred_mode == MODE_INTRA &&
|
||||
s->sps->implicit_rdpcm_enabled_flag && transform_skip_flag &&
|
||||
s->ps.sps->implicit_rdpcm_enabled_flag && transform_skip_flag &&
|
||||
(pred_mode_intra == 10 || pred_mode_intra == 26 )) ||
|
||||
explicit_rdpcm_flag)
|
||||
sign_hidden = 0;
|
||||
@ -1428,7 +1428,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
if (first_greater1_coeff_idx != -1) {
|
||||
coeff_abs_level_greater1_flag[first_greater1_coeff_idx] += coeff_abs_level_greater2_flag_decode(s, c_idx, ctx_set);
|
||||
}
|
||||
if (!s->pps->sign_data_hiding_flag || !sign_hidden ) {
|
||||
if (!s->ps.pps->sign_data_hiding_flag || !sign_hidden ) {
|
||||
coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag);
|
||||
} else {
|
||||
coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1));
|
||||
@ -1444,8 +1444,8 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
|
||||
trans_coeff_level += last_coeff_abs_level_remaining;
|
||||
if (trans_coeff_level > (3 << c_rice_param))
|
||||
c_rice_param = s->sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4);
|
||||
if (s->sps->persistent_rice_adaptation_enabled_flag && !rice_init) {
|
||||
c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4);
|
||||
if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) {
|
||||
int c_rice_p_init = lc->stat_coeff[sb_type] / 4;
|
||||
if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init))
|
||||
lc->stat_coeff[sb_type]++;
|
||||
@ -1460,8 +1460,8 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
|
||||
trans_coeff_level = 1 + last_coeff_abs_level_remaining;
|
||||
if (trans_coeff_level > (3 << c_rice_param))
|
||||
c_rice_param = s->sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4);
|
||||
if (s->sps->persistent_rice_adaptation_enabled_flag && !rice_init) {
|
||||
c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4);
|
||||
if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) {
|
||||
int c_rice_p_init = lc->stat_coeff[sb_type] / 4;
|
||||
if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init))
|
||||
lc->stat_coeff[sb_type]++;
|
||||
@ -1471,7 +1471,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
rice_init = 1;
|
||||
}
|
||||
}
|
||||
if (s->pps->sign_data_hiding_flag && sign_hidden) {
|
||||
if (s->ps.pps->sign_data_hiding_flag && sign_hidden) {
|
||||
sum_abs += trans_coeff_level;
|
||||
if (n == first_nz_pos_in_cg && (sum_abs&1))
|
||||
trans_coeff_level = -trans_coeff_level;
|
||||
@ -1480,7 +1480,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
trans_coeff_level = -trans_coeff_level;
|
||||
coeff_sign_flag <<= 1;
|
||||
if(!lc->cu.cu_transquant_bypass_flag) {
|
||||
if (s->sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) {
|
||||
if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) {
|
||||
if(y_c || x_c || log2_trafo_size < 4) {
|
||||
switch(log2_trafo_size) {
|
||||
case 3: pos = (y_c << 3) + x_c; break;
|
||||
@ -1508,15 +1508,15 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
}
|
||||
|
||||
if (lc->cu.cu_transquant_bypass_flag) {
|
||||
if (explicit_rdpcm_flag || (s->sps->implicit_rdpcm_enabled_flag &&
|
||||
if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag &&
|
||||
(pred_mode_intra == 10 || pred_mode_intra == 26))) {
|
||||
int mode = s->sps->implicit_rdpcm_enabled_flag ? (pred_mode_intra == 26) : explicit_rdpcm_dir_flag;
|
||||
int mode = s->ps.sps->implicit_rdpcm_enabled_flag ? (pred_mode_intra == 26) : explicit_rdpcm_dir_flag;
|
||||
|
||||
s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode);
|
||||
}
|
||||
} else {
|
||||
if (transform_skip_flag) {
|
||||
int rot = s->sps->transform_skip_rotation_enabled_flag &&
|
||||
int rot = s->ps.sps->transform_skip_rotation_enabled_flag &&
|
||||
log2_trafo_size == 2 &&
|
||||
lc->cu.pred_mode == MODE_INTRA;
|
||||
if (rot) {
|
||||
@ -1526,7 +1526,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
|
||||
|
||||
s->hevcdsp.transform_skip(coeffs, log2_trafo_size);
|
||||
|
||||
if (explicit_rdpcm_flag || (s->sps->implicit_rdpcm_enabled_flag &&
|
||||
if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag &&
|
||||
lc->cu.pred_mode == MODE_INTRA &&
|
||||
(pred_mode_intra == 10 || pred_mode_intra == 26))) {
|
||||
int mode = explicit_rdpcm_flag ? explicit_rdpcm_dir_flag : (pred_mode_intra == 26);
|
||||
|
@ -56,12 +56,12 @@ static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset)
|
||||
|
||||
// slice qp offset is not used for deblocking
|
||||
if (c_idx == 1)
|
||||
offset = s->pps->cb_qp_offset;
|
||||
offset = s->ps.pps->cb_qp_offset;
|
||||
else
|
||||
offset = s->pps->cr_qp_offset;
|
||||
offset = s->ps.pps->cr_qp_offset;
|
||||
|
||||
qp_i = av_clip(qp_y + offset, 0, 57);
|
||||
if (s->sps->chroma_format_idc == 1) {
|
||||
if (s->ps.sps->chroma_format_idc == 1) {
|
||||
if (qp_i < 30)
|
||||
qp = qp_i;
|
||||
else if (qp_i > 43)
|
||||
@ -79,14 +79,14 @@ static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset)
|
||||
static int get_qPy_pred(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
|
||||
{
|
||||
HEVCLocalContext *lc = s->HEVClc;
|
||||
int ctb_size_mask = (1 << s->sps->log2_ctb_size) - 1;
|
||||
int MinCuQpDeltaSizeMask = (1 << (s->sps->log2_ctb_size -
|
||||
s->pps->diff_cu_qp_delta_depth)) - 1;
|
||||
int ctb_size_mask = (1 << s->ps.sps->log2_ctb_size) - 1;
|
||||
int MinCuQpDeltaSizeMask = (1 << (s->ps.sps->log2_ctb_size -
|
||||
s->ps.pps->diff_cu_qp_delta_depth)) - 1;
|
||||
int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
|
||||
int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
|
||||
int min_cb_width = s->sps->min_cb_width;
|
||||
int x_cb = xQgBase >> s->sps->log2_min_cb_size;
|
||||
int y_cb = yQgBase >> s->sps->log2_min_cb_size;
|
||||
int min_cb_width = s->ps.sps->min_cb_width;
|
||||
int x_cb = xQgBase >> s->ps.sps->log2_min_cb_size;
|
||||
int y_cb = yQgBase >> s->ps.sps->log2_min_cb_size;
|
||||
int availableA = (xBase & ctb_size_mask) &&
|
||||
(xQgBase & ctb_size_mask);
|
||||
int availableB = (yBase & ctb_size_mask) &&
|
||||
@ -113,8 +113,8 @@ static int get_qPy_pred(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
|
||||
else
|
||||
qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
|
||||
|
||||
av_assert2(qPy_a >= -s->sps->qp_bd_offset && qPy_a < 52);
|
||||
av_assert2(qPy_b >= -s->sps->qp_bd_offset && qPy_b < 52);
|
||||
av_assert2(qPy_a >= -s->ps.sps->qp_bd_offset && qPy_a < 52);
|
||||
av_assert2(qPy_b >= -s->ps.sps->qp_bd_offset && qPy_b < 52);
|
||||
|
||||
return (qPy_a + qPy_b + 1) >> 1;
|
||||
}
|
||||
@ -124,7 +124,7 @@ void ff_hevc_set_qPy(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
|
||||
int qp_y = get_qPy_pred(s, xBase, yBase, log2_cb_size);
|
||||
|
||||
if (s->HEVClc->tu.cu_qp_delta != 0) {
|
||||
int off = s->sps->qp_bd_offset;
|
||||
int off = s->ps.sps->qp_bd_offset;
|
||||
s->HEVClc->qp_y = FFUMOD(qp_y + s->HEVClc->tu.cu_qp_delta + 52 + 2 * off,
|
||||
52 + off) - off;
|
||||
} else
|
||||
@ -133,10 +133,10 @@ void ff_hevc_set_qPy(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
|
||||
|
||||
static int get_qPy(HEVCContext *s, int xC, int yC)
|
||||
{
|
||||
int log2_min_cb_size = s->sps->log2_min_cb_size;
|
||||
int log2_min_cb_size = s->ps.sps->log2_min_cb_size;
|
||||
int x = xC >> log2_min_cb_size;
|
||||
int y = yC >> log2_min_cb_size;
|
||||
return s->qp_y_tab[x + y * s->sps->min_cb_width];
|
||||
return s->qp_y_tab[x + y * s->ps.sps->min_cb_width];
|
||||
}
|
||||
|
||||
static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height,
|
||||
@ -193,9 +193,9 @@ static void copy_CTB_to_hv(HEVCContext *s, const uint8_t *src,
|
||||
int stride_src, int x, int y, int width, int height,
|
||||
int c_idx, int x_ctb, int y_ctb)
|
||||
{
|
||||
int sh = s->sps->pixel_shift;
|
||||
int w = s->sps->width >> s->sps->hshift[c_idx];
|
||||
int h = s->sps->height >> s->sps->vshift[c_idx];
|
||||
int sh = s->ps.sps->pixel_shift;
|
||||
int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
|
||||
int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
|
||||
|
||||
/* copy horizontal edges */
|
||||
memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << sh),
|
||||
@ -214,23 +214,23 @@ static void restore_tqb_pixels(HEVCContext *s,
|
||||
ptrdiff_t stride_src, ptrdiff_t stride_dst,
|
||||
int x0, int y0, int width, int height, int c_idx)
|
||||
{
|
||||
if ( s->pps->transquant_bypass_enable_flag ||
|
||||
(s->sps->pcm.loop_filter_disable_flag && s->sps->pcm_enabled_flag)) {
|
||||
if ( s->ps.pps->transquant_bypass_enable_flag ||
|
||||
(s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
|
||||
int x, y;
|
||||
int min_pu_size = 1 << s->sps->log2_min_pu_size;
|
||||
int hshift = s->sps->hshift[c_idx];
|
||||
int vshift = s->sps->vshift[c_idx];
|
||||
int x_min = ((x0 ) >> s->sps->log2_min_pu_size);
|
||||
int y_min = ((y0 ) >> s->sps->log2_min_pu_size);
|
||||
int x_max = ((x0 + width ) >> s->sps->log2_min_pu_size);
|
||||
int y_max = ((y0 + height) >> s->sps->log2_min_pu_size);
|
||||
int len = (min_pu_size >> hshift) << s->sps->pixel_shift;
|
||||
int min_pu_size = 1 << s->ps.sps->log2_min_pu_size;
|
||||
int hshift = s->ps.sps->hshift[c_idx];
|
||||
int vshift = s->ps.sps->vshift[c_idx];
|
||||
int x_min = ((x0 ) >> s->ps.sps->log2_min_pu_size);
|
||||
int y_min = ((y0 ) >> s->ps.sps->log2_min_pu_size);
|
||||
int x_max = ((x0 + width ) >> s->ps.sps->log2_min_pu_size);
|
||||
int y_max = ((y0 + height) >> s->ps.sps->log2_min_pu_size);
|
||||
int len = (min_pu_size >> hshift) << s->ps.sps->pixel_shift;
|
||||
for (y = y_min; y < y_max; y++) {
|
||||
for (x = x_min; x < x_max; x++) {
|
||||
if (s->is_pcm[y * s->sps->min_pu_width + x]) {
|
||||
if (s->is_pcm[y * s->ps.sps->min_pu_width + x]) {
|
||||
int n;
|
||||
uint8_t *src = src1 + (((y << s->sps->log2_min_pu_size) - y0) >> vshift) * stride_src + ((((x << s->sps->log2_min_pu_size) - x0) >> hshift) << s->sps->pixel_shift);
|
||||
const uint8_t *dst = dst1 + (((y << s->sps->log2_min_pu_size) - y0) >> vshift) * stride_dst + ((((x << s->sps->log2_min_pu_size) - x0) >> hshift) << s->sps->pixel_shift);
|
||||
uint8_t *src = src1 + (((y << s->ps.sps->log2_min_pu_size) - y0) >> vshift) * stride_src + ((((x << s->ps.sps->log2_min_pu_size) - x0) >> hshift) << s->ps.sps->pixel_shift);
|
||||
const uint8_t *dst = dst1 + (((y << s->ps.sps->log2_min_pu_size) - y0) >> vshift) * stride_dst + ((((x << s->ps.sps->log2_min_pu_size) - x0) >> hshift) << s->ps.sps->pixel_shift);
|
||||
for (n = 0; n < (min_pu_size >> vshift); n++) {
|
||||
memcpy(src, dst, len);
|
||||
src += stride_src;
|
||||
@ -242,7 +242,7 @@ static void restore_tqb_pixels(HEVCContext *s,
|
||||
}
|
||||
}
|
||||
|
||||
#define CTB(tab, x, y) ((tab)[(y) * s->sps->ctb_width + (x)])
|
||||
#define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
|
||||
|
||||
static void sao_filter_CTB(HEVCContext *s, int x, int y)
|
||||
{
|
||||
@ -250,18 +250,18 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
|
||||
HEVCLocalContext *lc = s->HEVClc;
|
||||
int c_idx;
|
||||
int edges[4]; // 0 left 1 top 2 right 3 bottom
|
||||
int x_ctb = x >> s->sps->log2_ctb_size;
|
||||
int y_ctb = y >> s->sps->log2_ctb_size;
|
||||
int ctb_addr_rs = y_ctb * s->sps->ctb_width + x_ctb;
|
||||
int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[ctb_addr_rs];
|
||||
int x_ctb = x >> s->ps.sps->log2_ctb_size;
|
||||
int y_ctb = y >> s->ps.sps->log2_ctb_size;
|
||||
int ctb_addr_rs = y_ctb * s->ps.sps->ctb_width + x_ctb;
|
||||
int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
|
||||
SAOParams *sao = &CTB(s->sao, x_ctb, y_ctb);
|
||||
// flags indicating unfilterable edges
|
||||
uint8_t vert_edge[] = { 0, 0 };
|
||||
uint8_t horiz_edge[] = { 0, 0 };
|
||||
uint8_t diag_edge[] = { 0, 0, 0, 0 };
|
||||
uint8_t lfase = CTB(s->filter_slice_edges, x_ctb, y_ctb);
|
||||
uint8_t no_tile_filter = s->pps->tiles_enabled_flag &&
|
||||
!s->pps->loop_filter_across_tiles_enabled_flag;
|
||||
uint8_t no_tile_filter = s->ps.pps->tiles_enabled_flag &&
|
||||
!s->ps.pps->loop_filter_across_tiles_enabled_flag;
|
||||
uint8_t restore = no_tile_filter || !lfase;
|
||||
uint8_t left_tile_edge = 0;
|
||||
uint8_t right_tile_edge = 0;
|
||||
@ -270,24 +270,24 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
|
||||
|
||||
edges[0] = x_ctb == 0;
|
||||
edges[1] = y_ctb == 0;
|
||||
edges[2] = x_ctb == s->sps->ctb_width - 1;
|
||||
edges[3] = y_ctb == s->sps->ctb_height - 1;
|
||||
edges[2] = x_ctb == s->ps.sps->ctb_width - 1;
|
||||
edges[3] = y_ctb == s->ps.sps->ctb_height - 1;
|
||||
|
||||
if (restore) {
|
||||
if (!edges[0]) {
|
||||
left_tile_edge = no_tile_filter && s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]];
|
||||
left_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]];
|
||||
vert_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb)) || left_tile_edge;
|
||||
}
|
||||
if (!edges[2]) {
|
||||
right_tile_edge = no_tile_filter && s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs+1]];
|
||||
right_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs+1]];
|
||||
vert_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb)) || right_tile_edge;
|
||||
}
|
||||
if (!edges[1]) {
|
||||
up_tile_edge = no_tile_filter && s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs - s->sps->ctb_width]];
|
||||
up_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs - s->ps.sps->ctb_width]];
|
||||
horiz_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb, y_ctb - 1)) || up_tile_edge;
|
||||
}
|
||||
if (!edges[3]) {
|
||||
bottom_tile_edge = no_tile_filter && s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs + s->sps->ctb_width]];
|
||||
bottom_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs + s->ps.sps->ctb_width]];
|
||||
horiz_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb, y_ctb + 1)) || bottom_tile_edge;
|
||||
}
|
||||
if (!edges[0] && !edges[1]) {
|
||||
@ -304,16 +304,16 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
for (c_idx = 0; c_idx < (s->sps->chroma_format_idc ? 3 : 1); c_idx++) {
|
||||
int x0 = x >> s->sps->hshift[c_idx];
|
||||
int y0 = y >> s->sps->vshift[c_idx];
|
||||
for (c_idx = 0; c_idx < (s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
|
||||
int x0 = x >> s->ps.sps->hshift[c_idx];
|
||||
int y0 = y >> s->ps.sps->vshift[c_idx];
|
||||
int stride_src = s->frame->linesize[c_idx];
|
||||
int ctb_size_h = (1 << (s->sps->log2_ctb_size)) >> s->sps->hshift[c_idx];
|
||||
int ctb_size_v = (1 << (s->sps->log2_ctb_size)) >> s->sps->vshift[c_idx];
|
||||
int width = FFMIN(ctb_size_h, (s->sps->width >> s->sps->hshift[c_idx]) - x0);
|
||||
int height = FFMIN(ctb_size_v, (s->sps->height >> s->sps->vshift[c_idx]) - y0);
|
||||
int ctb_size_h = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->hshift[c_idx];
|
||||
int ctb_size_v = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->vshift[c_idx];
|
||||
int width = FFMIN(ctb_size_h, (s->ps.sps->width >> s->ps.sps->hshift[c_idx]) - x0);
|
||||
int height = FFMIN(ctb_size_v, (s->ps.sps->height >> s->ps.sps->vshift[c_idx]) - y0);
|
||||
int tab = sao_tab[(FFALIGN(width, 8) >> 3) - 1];
|
||||
uint8_t *src = &s->frame->data[c_idx][y0 * stride_src + (x0 << s->sps->pixel_shift)];
|
||||
uint8_t *src = &s->frame->data[c_idx][y0 * stride_src + (x0 << s->ps.sps->pixel_shift)];
|
||||
int stride_dst;
|
||||
uint8_t *dst;
|
||||
|
||||
@ -321,11 +321,11 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
|
||||
case SAO_BAND:
|
||||
copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
|
||||
x_ctb, y_ctb);
|
||||
if (s->pps->transquant_bypass_enable_flag ||
|
||||
(s->sps->pcm.loop_filter_disable_flag && s->sps->pcm_enabled_flag)) {
|
||||
if (s->ps.pps->transquant_bypass_enable_flag ||
|
||||
(s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
|
||||
dst = lc->edge_emu_buffer;
|
||||
stride_dst = 2*MAX_PB_SIZE;
|
||||
copy_CTB(dst, src, width << s->sps->pixel_shift, height, stride_dst, stride_src);
|
||||
copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src);
|
||||
s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst,
|
||||
sao->offset_val[c_idx], sao->band_position[c_idx],
|
||||
width, height);
|
||||
@ -340,13 +340,13 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
|
||||
break;
|
||||
case SAO_EDGE:
|
||||
{
|
||||
int w = s->sps->width >> s->sps->hshift[c_idx];
|
||||
int h = s->sps->height >> s->sps->vshift[c_idx];
|
||||
int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
|
||||
int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
|
||||
int left_edge = edges[0];
|
||||
int top_edge = edges[1];
|
||||
int right_edge = edges[2];
|
||||
int bottom_edge = edges[3];
|
||||
int sh = s->sps->pixel_shift;
|
||||
int sh = s->ps.sps->pixel_shift;
|
||||
int left_pixels, right_pixels;
|
||||
|
||||
stride_dst = 2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE;
|
||||
@ -455,7 +455,7 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
|
||||
|
||||
static int get_pcm(HEVCContext *s, int x, int y)
|
||||
{
|
||||
int log2_min_pu_size = s->sps->log2_min_pu_size;
|
||||
int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
|
||||
int x_pu, y_pu;
|
||||
|
||||
if (x < 0 || y < 0)
|
||||
@ -464,9 +464,9 @@ static int get_pcm(HEVCContext *s, int x, int y)
|
||||
x_pu = x >> log2_min_pu_size;
|
||||
y_pu = y >> log2_min_pu_size;
|
||||
|
||||
if (x_pu >= s->sps->min_pu_width || y_pu >= s->sps->min_pu_height)
|
||||
if (x_pu >= s->ps.sps->min_pu_width || y_pu >= s->ps.sps->min_pu_height)
|
||||
return 2;
|
||||
return s->is_pcm[y_pu * s->sps->min_pu_width + x_pu];
|
||||
return s->is_pcm[y_pu * s->ps.sps->min_pu_width + x_pu];
|
||||
}
|
||||
|
||||
#define TC_CALC(qp, bs) \
|
||||
@ -483,18 +483,18 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
uint8_t no_p[2] = { 0 };
|
||||
uint8_t no_q[2] = { 0 };
|
||||
|
||||
int log2_ctb_size = s->sps->log2_ctb_size;
|
||||
int log2_ctb_size = s->ps.sps->log2_ctb_size;
|
||||
int x_end, x_end2, y_end;
|
||||
int ctb_size = 1 << log2_ctb_size;
|
||||
int ctb = (x0 >> log2_ctb_size) +
|
||||
(y0 >> log2_ctb_size) * s->sps->ctb_width;
|
||||
(y0 >> log2_ctb_size) * s->ps.sps->ctb_width;
|
||||
int cur_tc_offset = s->deblock[ctb].tc_offset;
|
||||
int cur_beta_offset = s->deblock[ctb].beta_offset;
|
||||
int left_tc_offset, left_beta_offset;
|
||||
int tc_offset, beta_offset;
|
||||
int pcmf = (s->sps->pcm_enabled_flag &&
|
||||
s->sps->pcm.loop_filter_disable_flag) ||
|
||||
s->pps->transquant_bypass_enable_flag;
|
||||
int pcmf = (s->ps.sps->pcm_enabled_flag &&
|
||||
s->ps.sps->pcm.loop_filter_disable_flag) ||
|
||||
s->ps.pps->transquant_bypass_enable_flag;
|
||||
|
||||
if (x0) {
|
||||
left_tc_offset = s->deblock[ctb - 1].tc_offset;
|
||||
@ -505,17 +505,17 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
}
|
||||
|
||||
x_end = x0 + ctb_size;
|
||||
if (x_end > s->sps->width)
|
||||
x_end = s->sps->width;
|
||||
if (x_end > s->ps.sps->width)
|
||||
x_end = s->ps.sps->width;
|
||||
y_end = y0 + ctb_size;
|
||||
if (y_end > s->sps->height)
|
||||
y_end = s->sps->height;
|
||||
if (y_end > s->ps.sps->height)
|
||||
y_end = s->ps.sps->height;
|
||||
|
||||
tc_offset = cur_tc_offset;
|
||||
beta_offset = cur_beta_offset;
|
||||
|
||||
x_end2 = x_end;
|
||||
if (x_end2 != s->sps->width)
|
||||
if (x_end2 != s->ps.sps->width)
|
||||
x_end2 -= 8;
|
||||
for (y = y0; y < y_end; y += 8) {
|
||||
// vertical filtering luma
|
||||
@ -529,7 +529,7 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
|
||||
tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
|
||||
tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
|
||||
src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->sps->pixel_shift)];
|
||||
src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
|
||||
if (pcmf) {
|
||||
no_p[0] = get_pcm(s, x - 1, y);
|
||||
no_p[1] = get_pcm(s, x - 1, y + 4);
|
||||
@ -561,7 +561,7 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
|
||||
tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
|
||||
tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
|
||||
src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->sps->pixel_shift)];
|
||||
src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
|
||||
if (pcmf) {
|
||||
no_p[0] = get_pcm(s, x, y - 1);
|
||||
no_p[1] = get_pcm(s, x + 4, y - 1);
|
||||
@ -578,10 +578,10 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
}
|
||||
}
|
||||
|
||||
if (s->sps->chroma_format_idc) {
|
||||
if (s->ps.sps->chroma_format_idc) {
|
||||
for (chroma = 1; chroma <= 2; chroma++) {
|
||||
int h = 1 << s->sps->hshift[chroma];
|
||||
int v = 1 << s->sps->vshift[chroma];
|
||||
int h = 1 << s->ps.sps->hshift[chroma];
|
||||
int v = 1 << s->ps.sps->vshift[chroma];
|
||||
|
||||
// vertical filtering chroma
|
||||
for (y = y0; y < y_end; y += (8 * v)) {
|
||||
@ -595,7 +595,7 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
|
||||
c_tc[0] = (bs0 == 2) ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
|
||||
c_tc[1] = (bs1 == 2) ? chroma_tc(s, qp1, chroma, tc_offset) : 0;
|
||||
src = &s->frame->data[chroma][(y >> s->sps->vshift[chroma]) * s->frame->linesize[chroma] + ((x >> s->sps->hshift[chroma]) << s->sps->pixel_shift)];
|
||||
src = &s->frame->data[chroma][(y >> s->ps.sps->vshift[chroma]) * s->frame->linesize[chroma] + ((x >> s->ps.sps->hshift[chroma]) << s->ps.sps->pixel_shift)];
|
||||
if (pcmf) {
|
||||
no_p[0] = get_pcm(s, x - 1, y);
|
||||
no_p[1] = get_pcm(s, x - 1, y + (4 * v));
|
||||
@ -617,7 +617,7 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
// horizontal filtering chroma
|
||||
tc_offset = x0 ? left_tc_offset : cur_tc_offset;
|
||||
x_end2 = x_end;
|
||||
if (x_end != s->sps->width)
|
||||
if (x_end != s->ps.sps->width)
|
||||
x_end2 = x_end - 8 * h;
|
||||
for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
|
||||
const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
|
||||
@ -628,7 +628,7 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
|
||||
|
||||
c_tc[0] = bs0 == 2 ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
|
||||
c_tc[1] = bs1 == 2 ? chroma_tc(s, qp1, chroma, cur_tc_offset) : 0;
|
||||
src = &s->frame->data[chroma][(y >> s->sps->vshift[1]) * s->frame->linesize[chroma] + ((x >> s->sps->hshift[1]) << s->sps->pixel_shift)];
|
||||
src = &s->frame->data[chroma][(y >> s->ps.sps->vshift[1]) * s->frame->linesize[chroma] + ((x >> s->ps.sps->hshift[1]) << s->ps.sps->pixel_shift)];
|
||||
if (pcmf) {
|
||||
no_p[0] = get_pcm(s, x, y - 1);
|
||||
no_p[1] = get_pcm(s, x + (4 * h), y - 1);
|
||||
@ -717,10 +717,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
|
||||
{
|
||||
HEVCLocalContext *lc = s->HEVClc;
|
||||
MvField *tab_mvf = s->ref->tab_mvf;
|
||||
int log2_min_pu_size = s->sps->log2_min_pu_size;
|
||||
int log2_min_tu_size = s->sps->log2_min_tb_size;
|
||||
int min_pu_width = s->sps->min_pu_width;
|
||||
int min_tu_width = s->sps->min_tb_width;
|
||||
int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
|
||||
int log2_min_tu_size = s->ps.sps->log2_min_tb_size;
|
||||
int min_pu_width = s->ps.sps->min_pu_width;
|
||||
int min_tu_width = s->ps.sps->min_tb_width;
|
||||
int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
|
||||
(x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
|
||||
int boundary_upper, boundary_left;
|
||||
@ -730,10 +730,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
|
||||
if (boundary_upper &&
|
||||
((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
|
||||
lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
|
||||
(y0 % (1 << s->sps->log2_ctb_size)) == 0) ||
|
||||
(!s->pps->loop_filter_across_tiles_enabled_flag &&
|
||||
(y0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
|
||||
(!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
|
||||
lc->boundary_flags & BOUNDARY_UPPER_TILE &&
|
||||
(y0 % (1 << s->sps->log2_ctb_size)) == 0)))
|
||||
(y0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
|
||||
boundary_upper = 0;
|
||||
|
||||
if (boundary_upper) {
|
||||
@ -768,10 +768,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
|
||||
if (boundary_left &&
|
||||
((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
|
||||
lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
|
||||
(x0 % (1 << s->sps->log2_ctb_size)) == 0) ||
|
||||
(!s->pps->loop_filter_across_tiles_enabled_flag &&
|
||||
(x0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
|
||||
(!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
|
||||
lc->boundary_flags & BOUNDARY_LEFT_TILE &&
|
||||
(x0 % (1 << s->sps->log2_ctb_size)) == 0)))
|
||||
(x0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
|
||||
boundary_left = 0;
|
||||
|
||||
if (boundary_left) {
|
||||
@ -842,10 +842,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
|
||||
|
||||
void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
|
||||
{
|
||||
int x_end = x >= s->sps->width - ctb_size;
|
||||
int x_end = x >= s->ps.sps->width - ctb_size;
|
||||
deblocking_filter_CTB(s, x, y);
|
||||
if (s->sps->sao_enabled) {
|
||||
int y_end = y >= s->sps->height - ctb_size;
|
||||
if (s->ps.sps->sao_enabled) {
|
||||
int y_end = y >= s->ps.sps->height - ctb_size;
|
||||
if (y && x)
|
||||
sao_filter_CTB(s, x - ctb_size, y - ctb_size);
|
||||
if (x && y_end)
|
||||
@ -866,8 +866,8 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
|
||||
|
||||
void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size)
|
||||
{
|
||||
int x_end = x_ctb >= s->sps->width - ctb_size;
|
||||
int y_end = y_ctb >= s->sps->height - ctb_size;
|
||||
int x_end = x_ctb >= s->ps.sps->width - ctb_size;
|
||||
int y_end = y_ctb >= s->ps.sps->height - ctb_size;
|
||||
if (y_ctb && x_ctb)
|
||||
ff_hevc_hls_filter(s, x_ctb - ctb_size, y_ctb - ctb_size, ctb_size);
|
||||
if (y_ctb && x_end)
|
||||
|
@ -42,14 +42,14 @@ void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0,
|
||||
int nPbW, int nPbH)
|
||||
{
|
||||
HEVCLocalContext *lc = s->HEVClc;
|
||||
int x0b = av_mod_uintp2(x0, s->sps->log2_ctb_size);
|
||||
int y0b = av_mod_uintp2(y0, s->sps->log2_ctb_size);
|
||||
int x0b = av_mod_uintp2(x0, s->ps.sps->log2_ctb_size);
|
||||
int y0b = av_mod_uintp2(y0, s->ps.sps->log2_ctb_size);
|
||||
|
||||
lc->na.cand_up = (lc->ctb_up_flag || y0b);
|
||||
lc->na.cand_left = (lc->ctb_left_flag || x0b);
|
||||
lc->na.cand_up_left = (!x0b && !y0b) ? lc->ctb_up_left_flag : lc->na.cand_left && lc->na.cand_up;
|
||||
lc->na.cand_up_right_sap =
|
||||
((x0b + nPbW) == (1 << s->sps->log2_ctb_size)) ?
|
||||
((x0b + nPbW) == (1 << s->ps.sps->log2_ctb_size)) ?
|
||||
lc->ctb_up_right_flag && !y0b : lc->na.cand_up;
|
||||
lc->na.cand_up_right =
|
||||
lc->na.cand_up_right_sap
|
||||
@ -64,19 +64,19 @@ static av_always_inline int z_scan_block_avail(HEVCContext *s, int xCurr, int yC
|
||||
int xN, int yN)
|
||||
{
|
||||
#define MIN_TB_ADDR_ZS(x, y) \
|
||||
s->pps->min_tb_addr_zs[(y) * (s->sps->tb_mask+2) + (x)]
|
||||
s->ps.pps->min_tb_addr_zs[(y) * (s->ps.sps->tb_mask+2) + (x)]
|
||||
|
||||
int xCurr_ctb = xCurr >> s->sps->log2_ctb_size;
|
||||
int yCurr_ctb = yCurr >> s->sps->log2_ctb_size;
|
||||
int xN_ctb = xN >> s->sps->log2_ctb_size;
|
||||
int yN_ctb = yN >> s->sps->log2_ctb_size;
|
||||
int xCurr_ctb = xCurr >> s->ps.sps->log2_ctb_size;
|
||||
int yCurr_ctb = yCurr >> s->ps.sps->log2_ctb_size;
|
||||
int xN_ctb = xN >> s->ps.sps->log2_ctb_size;
|
||||
int yN_ctb = yN >> s->ps.sps->log2_ctb_size;
|
||||
if( yN_ctb < yCurr_ctb || xN_ctb < xCurr_ctb )
|
||||
return 1;
|
||||
else {
|
||||
int Curr = MIN_TB_ADDR_ZS((xCurr >> s->sps->log2_min_tb_size) & s->sps->tb_mask,
|
||||
(yCurr >> s->sps->log2_min_tb_size) & s->sps->tb_mask);
|
||||
int N = MIN_TB_ADDR_ZS((xN >> s->sps->log2_min_tb_size) & s->sps->tb_mask,
|
||||
(yN >> s->sps->log2_min_tb_size) & s->sps->tb_mask);
|
||||
int Curr = MIN_TB_ADDR_ZS((xCurr >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask,
|
||||
(yCurr >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask);
|
||||
int N = MIN_TB_ADDR_ZS((xN >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask,
|
||||
(yN >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask);
|
||||
return N <= Curr;
|
||||
}
|
||||
}
|
||||
@ -84,7 +84,7 @@ static av_always_inline int z_scan_block_avail(HEVCContext *s, int xCurr, int yC
|
||||
//check if the two luma locations belong to the same mostion estimation region
|
||||
static av_always_inline int is_diff_mer(HEVCContext *s, int xN, int yN, int xP, int yP)
|
||||
{
|
||||
uint8_t plevel = s->pps->log2_parallel_merge_level;
|
||||
uint8_t plevel = s->ps.pps->log2_parallel_merge_level;
|
||||
|
||||
return xN >> plevel == xP >> plevel &&
|
||||
yN >> plevel == yP >> plevel;
|
||||
@ -203,8 +203,8 @@ static int derive_temporal_colocated_mvs(HEVCContext *s, MvField temp_col,
|
||||
tab_mvf[(y) * min_pu_width + x]
|
||||
|
||||
#define TAB_MVF_PU(v) \
|
||||
TAB_MVF(((x ## v) >> s->sps->log2_min_pu_size), \
|
||||
((y ## v) >> s->sps->log2_min_pu_size))
|
||||
TAB_MVF(((x ## v) >> s->ps.sps->log2_min_pu_size), \
|
||||
((y ## v) >> s->ps.sps->log2_min_pu_size))
|
||||
|
||||
#define DERIVE_TEMPORAL_COLOCATED_MVS \
|
||||
derive_temporal_colocated_mvs(s, temp_col, \
|
||||
@ -221,7 +221,7 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
|
||||
MvField *tab_mvf;
|
||||
MvField temp_col;
|
||||
int x, y, x_pu, y_pu;
|
||||
int min_pu_width = s->sps->min_pu_width;
|
||||
int min_pu_width = s->ps.sps->min_pu_width;
|
||||
int availableFlagLXCol = 0;
|
||||
int colPic;
|
||||
|
||||
@ -240,15 +240,15 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
|
||||
y = y0 + nPbH;
|
||||
|
||||
if (tab_mvf &&
|
||||
(y0 >> s->sps->log2_ctb_size) == (y >> s->sps->log2_ctb_size) &&
|
||||
y < s->sps->height &&
|
||||
x < s->sps->width) {
|
||||
(y0 >> s->ps.sps->log2_ctb_size) == (y >> s->ps.sps->log2_ctb_size) &&
|
||||
y < s->ps.sps->height &&
|
||||
x < s->ps.sps->width) {
|
||||
x &= ~15;
|
||||
y &= ~15;
|
||||
if (s->threads_type == FF_THREAD_FRAME)
|
||||
ff_thread_await_progress(&ref->tf, y, 0);
|
||||
x_pu = x >> s->sps->log2_min_pu_size;
|
||||
y_pu = y >> s->sps->log2_min_pu_size;
|
||||
x_pu = x >> s->ps.sps->log2_min_pu_size;
|
||||
y_pu = y >> s->ps.sps->log2_min_pu_size;
|
||||
temp_col = TAB_MVF(x_pu, y_pu);
|
||||
availableFlagLXCol = DERIVE_TEMPORAL_COLOCATED_MVS;
|
||||
}
|
||||
@ -261,8 +261,8 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
|
||||
y &= ~15;
|
||||
if (s->threads_type == FF_THREAD_FRAME)
|
||||
ff_thread_await_progress(&ref->tf, y, 0);
|
||||
x_pu = x >> s->sps->log2_min_pu_size;
|
||||
y_pu = y >> s->sps->log2_min_pu_size;
|
||||
x_pu = x >> s->ps.sps->log2_min_pu_size;
|
||||
y_pu = y >> s->ps.sps->log2_min_pu_size;
|
||||
temp_col = TAB_MVF(x_pu, y_pu);
|
||||
availableFlagLXCol = DERIVE_TEMPORAL_COLOCATED_MVS;
|
||||
}
|
||||
@ -292,7 +292,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0,
|
||||
RefPicList *refPicList = s->ref->refPicList;
|
||||
MvField *tab_mvf = s->ref->tab_mvf;
|
||||
|
||||
const int min_pu_width = s->sps->min_pu_width;
|
||||
const int min_pu_width = s->ps.sps->min_pu_width;
|
||||
|
||||
const int cand_bottom_left = lc->na.cand_bottom_left;
|
||||
const int cand_left = lc->na.cand_left;
|
||||
@ -365,7 +365,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0,
|
||||
|
||||
// above right spatial merge candidate
|
||||
is_available_b0 = AVAILABLE(cand_up_right, B0) &&
|
||||
xB0 < s->sps->width &&
|
||||
xB0 < s->ps.sps->width &&
|
||||
PRED_BLOCK_AVAILABLE(B0) &&
|
||||
!is_diff_mer(s, xB0, yB0, x0, y0);
|
||||
|
||||
@ -379,7 +379,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0,
|
||||
|
||||
// left bottom spatial merge candidate
|
||||
is_available_a0 = AVAILABLE(cand_bottom_left, A0) &&
|
||||
yA0 < s->sps->height &&
|
||||
yA0 < s->ps.sps->height &&
|
||||
PRED_BLOCK_AVAILABLE(A0) &&
|
||||
!is_diff_mer(s, xA0, yA0, x0, y0);
|
||||
|
||||
@ -486,7 +486,7 @@ void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0, int nPbW,
|
||||
int nPbH2 = nPbH;
|
||||
HEVCLocalContext *lc = s->HEVClc;
|
||||
|
||||
if (s->pps->log2_parallel_merge_level > 2 && nCS == 8) {
|
||||
if (s->ps.pps->log2_parallel_merge_level > 2 && nCS == 8) {
|
||||
singleMCLFlag = 1;
|
||||
x0 = lc->cu.x;
|
||||
y0 = lc->cu.y;
|
||||
@ -529,7 +529,7 @@ static int mv_mp_mode_mx(HEVCContext *s, int x, int y, int pred_flag_index,
|
||||
Mv *mv, int ref_idx_curr, int ref_idx)
|
||||
{
|
||||
MvField *tab_mvf = s->ref->tab_mvf;
|
||||
int min_pu_width = s->sps->min_pu_width;
|
||||
int min_pu_width = s->ps.sps->min_pu_width;
|
||||
|
||||
RefPicList *refPicList = s->ref->refPicList;
|
||||
|
||||
@ -545,7 +545,7 @@ static int mv_mp_mode_mx_lt(HEVCContext *s, int x, int y, int pred_flag_index,
|
||||
Mv *mv, int ref_idx_curr, int ref_idx)
|
||||
{
|
||||
MvField *tab_mvf = s->ref->tab_mvf;
|
||||
int min_pu_width = s->sps->min_pu_width;
|
||||
int min_pu_width = s->ps.sps->min_pu_width;
|
||||
|
||||
RefPicList *refPicList = s->ref->refPicList;
|
||||
|
||||
@ -568,14 +568,14 @@ static int mv_mp_mode_mx_lt(HEVCContext *s, int x, int y, int pred_flag_index,
|
||||
|
||||
#define MP_MX(v, pred, mx) \
|
||||
mv_mp_mode_mx(s, \
|
||||
(x ## v) >> s->sps->log2_min_pu_size, \
|
||||
(y ## v) >> s->sps->log2_min_pu_size, \
|
||||
(x ## v) >> s->ps.sps->log2_min_pu_size, \
|
||||
(y ## v) >> s->ps.sps->log2_min_pu_size, \
|
||||
pred, &mx, ref_idx_curr, ref_idx)
|
||||
|
||||
#define MP_MX_LT(v, pred, mx) \
|
||||
mv_mp_mode_mx_lt(s, \
|
||||
(x ## v) >> s->sps->log2_min_pu_size, \
|
||||
(y ## v) >> s->sps->log2_min_pu_size, \
|
||||
(x ## v) >> s->ps.sps->log2_min_pu_size, \
|
||||
(y ## v) >> s->ps.sps->log2_min_pu_size, \
|
||||
pred, &mx, ref_idx_curr, ref_idx)
|
||||
|
||||
void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW,
|
||||
@ -589,7 +589,7 @@ void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW,
|
||||
int availableFlagLXA0 = 1;
|
||||
int availableFlagLXB0 = 1;
|
||||
int numMVPCandLX = 0;
|
||||
int min_pu_width = s->sps->min_pu_width;
|
||||
int min_pu_width = s->ps.sps->min_pu_width;
|
||||
|
||||
int xA0, yA0;
|
||||
int is_available_a0;
|
||||
@ -625,7 +625,7 @@ void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW,
|
||||
yA0 = y0 + nPbH;
|
||||
|
||||
is_available_a0 = AVAILABLE(cand_bottom_left, A0) &&
|
||||
yA0 < s->sps->height &&
|
||||
yA0 < s->ps.sps->height &&
|
||||
PRED_BLOCK_AVAILABLE(A0);
|
||||
|
||||
//left spatial merge candidate
|
||||
@ -680,7 +680,7 @@ b_candidates:
|
||||
yB0 = y0 - 1;
|
||||
|
||||
is_available_b0 = AVAILABLE(cand_up_right, B0) &&
|
||||
xB0 < s->sps->width &&
|
||||
xB0 < s->ps.sps->width &&
|
||||
PRED_BLOCK_AVAILABLE(B0);
|
||||
|
||||
// above spatial merge candidate
|
||||
|
@ -90,6 +90,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx
|
||||
HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h;
|
||||
GetBitContext *gb = &h->HEVClc->gb;
|
||||
SliceHeader *sh = &h->sh;
|
||||
HEVCParamSets *ps = &h->ps;
|
||||
const uint8_t *buf_end = buf + buf_size;
|
||||
int state = -1, i;
|
||||
HEVCNAL *nal;
|
||||
@ -137,13 +138,13 @@ static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx
|
||||
init_get_bits8(gb, nal->data + 2, nal->size);
|
||||
switch (h->nal_unit_type) {
|
||||
case NAL_VPS:
|
||||
ff_hevc_decode_nal_vps(h);
|
||||
ff_hevc_decode_nal_vps(gb, avctx, ps);
|
||||
break;
|
||||
case NAL_SPS:
|
||||
ff_hevc_decode_nal_sps(h);
|
||||
ff_hevc_decode_nal_sps(gb, avctx, ps, h->apply_defdispwin);
|
||||
break;
|
||||
case NAL_PPS:
|
||||
ff_hevc_decode_nal_pps(h);
|
||||
ff_hevc_decode_nal_pps(gb, avctx, ps);
|
||||
break;
|
||||
case NAL_SEI_PREFIX:
|
||||
case NAL_SEI_SUFFIX:
|
||||
@ -175,33 +176,33 @@ static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx
|
||||
}
|
||||
|
||||
sh->pps_id = get_ue_golomb(gb);
|
||||
if (sh->pps_id >= MAX_PPS_COUNT || !h->pps_list[sh->pps_id]) {
|
||||
if (sh->pps_id >= MAX_PPS_COUNT || !ps->pps_list[sh->pps_id]) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
h->pps = (HEVCPPS*)h->pps_list[sh->pps_id]->data;
|
||||
ps->pps = (HEVCPPS*)ps->pps_list[sh->pps_id]->data;
|
||||
|
||||
if (h->pps->sps_id >= MAX_SPS_COUNT || !h->sps_list[h->pps->sps_id]) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", h->pps->sps_id);
|
||||
if (ps->pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (h->sps != (HEVCSPS*)h->sps_list[h->pps->sps_id]->data) {
|
||||
h->sps = (HEVCSPS*)h->sps_list[h->pps->sps_id]->data;
|
||||
h->vps = (HEVCVPS*)h->vps_list[h->sps->vps_id]->data;
|
||||
if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) {
|
||||
ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data;
|
||||
ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data;
|
||||
}
|
||||
|
||||
if (!sh->first_slice_in_pic_flag) {
|
||||
int slice_address_length;
|
||||
|
||||
if (h->pps->dependent_slice_segments_enabled_flag)
|
||||
if (ps->pps->dependent_slice_segments_enabled_flag)
|
||||
sh->dependent_slice_segment_flag = get_bits1(gb);
|
||||
else
|
||||
sh->dependent_slice_segment_flag = 0;
|
||||
|
||||
slice_address_length = av_ceil_log2_c(h->sps->ctb_width *
|
||||
h->sps->ctb_height);
|
||||
slice_address_length = av_ceil_log2_c(ps->sps->ctb_width *
|
||||
ps->sps->ctb_height);
|
||||
sh->slice_segment_addr = slice_address_length ? get_bits(gb, slice_address_length) : 0;
|
||||
if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) {
|
||||
if (sh->slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
|
||||
sh->slice_segment_addr);
|
||||
return AVERROR_INVALIDDATA;
|
||||
@ -212,7 +213,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx
|
||||
if (sh->dependent_slice_segment_flag)
|
||||
break;
|
||||
|
||||
for (i = 0; i < h->pps->num_extra_slice_header_bits; i++)
|
||||
for (i = 0; i < ps->pps->num_extra_slice_header_bits; i++)
|
||||
skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
|
||||
|
||||
sh->slice_type = get_ue_golomb(gb);
|
||||
@ -226,14 +227,14 @@ static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx
|
||||
sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P :
|
||||
AV_PICTURE_TYPE_I;
|
||||
|
||||
if (h->pps->output_flag_present_flag)
|
||||
if (ps->pps->output_flag_present_flag)
|
||||
sh->pic_output_flag = get_bits1(gb);
|
||||
|
||||
if (h->sps->separate_colour_plane_flag)
|
||||
if (ps->sps->separate_colour_plane_flag)
|
||||
sh->colour_plane_id = get_bits(gb, 2);
|
||||
|
||||
if (!IS_IDR(h)) {
|
||||
sh->pic_order_cnt_lsb = get_bits(gb, h->sps->log2_max_poc_lsb);
|
||||
sh->pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb);
|
||||
s->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb);
|
||||
} else
|
||||
s->output_picture_number = h->poc = 0;
|
||||
@ -321,19 +322,20 @@ static void hevc_close(AVCodecParserContext *s)
|
||||
int i;
|
||||
HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h;
|
||||
ParseContext *pc = &((HEVCParseContext *)s->priv_data)->pc;
|
||||
HEVCParamSets *ps = &h->ps;
|
||||
|
||||
av_freep(&h->skipped_bytes_pos);
|
||||
av_freep(&h->HEVClc);
|
||||
av_freep(&pc->buffer);
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(h->vps_list); i++)
|
||||
av_buffer_unref(&h->vps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(h->sps_list); i++)
|
||||
av_buffer_unref(&h->sps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(h->pps_list); i++)
|
||||
av_buffer_unref(&h->pps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ps->vps_list); i++)
|
||||
av_buffer_unref(&ps->vps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ps->sps_list); i++)
|
||||
av_buffer_unref(&ps->sps_list[i]);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ps->pps_list); i++)
|
||||
av_buffer_unref(&ps->pps_list[i]);
|
||||
|
||||
h->sps = NULL;
|
||||
ps->sps = NULL;
|
||||
|
||||
for (i = 0; i < h->nals_allocated; i++)
|
||||
av_freep(&h->nals[i].rbsp_buffer);
|
||||
|
@ -69,14 +69,14 @@ static const AVRational vui_sar[] = {
|
||||
{ 2, 1 },
|
||||
};
|
||||
|
||||
static void remove_pps(HEVCContext *s, int id)
|
||||
static void remove_pps(HEVCParamSets *s, int id)
|
||||
{
|
||||
if (s->pps_list[id] && s->pps == (const HEVCPPS*)s->pps_list[id]->data)
|
||||
s->pps = NULL;
|
||||
av_buffer_unref(&s->pps_list[id]);
|
||||
}
|
||||
|
||||
static void remove_sps(HEVCContext *s, int id)
|
||||
static void remove_sps(HEVCParamSets *s, int id)
|
||||
{
|
||||
int i;
|
||||
if (s->sps_list[id]) {
|
||||
@ -93,7 +93,7 @@ static void remove_sps(HEVCContext *s, int id)
|
||||
av_buffer_unref(&s->sps_list[id]);
|
||||
}
|
||||
|
||||
static void remove_vps(HEVCContext *s, int id)
|
||||
static void remove_vps(HEVCParamSets *s, int id)
|
||||
{
|
||||
int i;
|
||||
if (s->vps_list[id]) {
|
||||
@ -389,10 +389,10 @@ static int decode_hrd(GetBitContext *gb, int common_inf_present,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCParamSets *ps)
|
||||
{
|
||||
int i,j;
|
||||
GetBitContext *gb = &s->HEVClc->gb;
|
||||
int vps_id = 0;
|
||||
HEVCVPS *vps;
|
||||
AVBufferRef *vps_buf = av_buffer_allocz(sizeof(*vps));
|
||||
@ -401,16 +401,16 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
return AVERROR(ENOMEM);
|
||||
vps = (HEVCVPS*)vps_buf->data;
|
||||
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "Decoding VPS\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "Decoding VPS\n");
|
||||
|
||||
vps_id = get_bits(gb, 4);
|
||||
if (vps_id >= MAX_VPS_COUNT) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id);
|
||||
av_log(avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (get_bits(gb, 2) != 3) { // vps_reserved_three_2bits
|
||||
av_log(s->avctx, AV_LOG_ERROR, "vps_reserved_three_2bits is not three\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "vps_reserved_three_2bits is not three\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -419,17 +419,17 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
vps->vps_temporal_id_nesting_flag = get_bits1(gb);
|
||||
|
||||
if (get_bits(gb, 16) != 0xffff) { // vps_reserved_ffff_16bits
|
||||
av_log(s->avctx, AV_LOG_ERROR, "vps_reserved_ffff_16bits is not 0xffff\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "vps_reserved_ffff_16bits is not 0xffff\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (vps->vps_max_sub_layers > MAX_SUB_LAYERS) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "vps_max_sub_layers out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "vps_max_sub_layers out of range: %d\n",
|
||||
vps->vps_max_sub_layers);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (parse_ptl(gb, s->avctx, &vps->ptl, vps->vps_max_sub_layers) < 0)
|
||||
if (parse_ptl(gb, avctx, &vps->ptl, vps->vps_max_sub_layers) < 0)
|
||||
goto err;
|
||||
|
||||
vps->vps_sub_layer_ordering_info_present_flag = get_bits1(gb);
|
||||
@ -441,14 +441,14 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
vps->vps_max_latency_increase[i] = get_ue_golomb_long(gb) - 1;
|
||||
|
||||
if (vps->vps_max_dec_pic_buffering[i] > MAX_DPB_SIZE || !vps->vps_max_dec_pic_buffering[i]) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "vps_max_dec_pic_buffering_minus1 out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "vps_max_dec_pic_buffering_minus1 out of range: %d\n",
|
||||
vps->vps_max_dec_pic_buffering[i] - 1);
|
||||
goto err;
|
||||
}
|
||||
if (vps->vps_num_reorder_pics[i] > vps->vps_max_dec_pic_buffering[i] - 1) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "vps_max_num_reorder_pics out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_WARNING, "vps_max_num_reorder_pics out of range: %d\n",
|
||||
vps->vps_num_reorder_pics[i]);
|
||||
if (s->avctx->err_recognition & AV_EF_EXPLODE)
|
||||
if (avctx->err_recognition & AV_EF_EXPLODE)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@ -457,7 +457,7 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
vps->vps_num_layer_sets = get_ue_golomb_long(gb) + 1;
|
||||
if (vps->vps_num_layer_sets < 1 || vps->vps_num_layer_sets > 1024 ||
|
||||
(vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "too many layer_id_included_flags\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "too many layer_id_included_flags\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -474,7 +474,7 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
vps->vps_num_ticks_poc_diff_one = get_ue_golomb_long(gb) + 1;
|
||||
vps->vps_num_hrd_parameters = get_ue_golomb_long(gb);
|
||||
if (vps->vps_num_hrd_parameters > (unsigned)vps->vps_num_layer_sets) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"vps_num_hrd_parameters %d is invalid\n", vps->vps_num_hrd_parameters);
|
||||
goto err;
|
||||
}
|
||||
@ -490,18 +490,18 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
get_bits1(gb); /* vps_extension_flag */
|
||||
|
||||
if (get_bits_left(gb) < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Overread VPS by %d bits\n", -get_bits_left(gb));
|
||||
if (s->vps_list[vps_id])
|
||||
if (ps->vps_list[vps_id])
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (s->vps_list[vps_id] &&
|
||||
!memcmp(s->vps_list[vps_id]->data, vps_buf->data, vps_buf->size)) {
|
||||
if (ps->vps_list[vps_id] &&
|
||||
!memcmp(ps->vps_list[vps_id]->data, vps_buf->data, vps_buf->size)) {
|
||||
av_buffer_unref(&vps_buf);
|
||||
} else {
|
||||
remove_vps(s, vps_id);
|
||||
s->vps_list[vps_id] = vps_buf;
|
||||
remove_vps(ps, vps_id);
|
||||
ps->vps_list[vps_id] = vps_buf;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1135,7 +1135,8 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_hevc_decode_nal_sps(HEVCContext *s)
|
||||
int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCParamSets *ps, int apply_defdispwin)
|
||||
{
|
||||
HEVCSPS *sps;
|
||||
AVBufferRef *sps_buf = av_buffer_allocz(sizeof(*sps));
|
||||
@ -1146,18 +1147,18 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
|
||||
return AVERROR(ENOMEM);
|
||||
sps = (HEVCSPS*)sps_buf->data;
|
||||
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "Decoding SPS\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "Decoding SPS\n");
|
||||
|
||||
ret = ff_hevc_parse_sps(sps, &s->HEVClc->gb, &sps_id,
|
||||
s->apply_defdispwin,
|
||||
s->vps_list, s->avctx);
|
||||
ret = ff_hevc_parse_sps(sps, gb, &sps_id,
|
||||
apply_defdispwin,
|
||||
ps->vps_list, avctx);
|
||||
if (ret < 0) {
|
||||
av_buffer_unref(&sps_buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (s->avctx->debug & FF_DEBUG_BITSTREAM) {
|
||||
av_log(s->avctx, AV_LOG_DEBUG,
|
||||
if (avctx->debug & FF_DEBUG_BITSTREAM) {
|
||||
av_log(avctx, AV_LOG_DEBUG,
|
||||
"Parsed SPS: id %d; coded wxh: %dx%d; "
|
||||
"cropped wxh: %dx%d; pix_fmt: %s.\n",
|
||||
sps_id, sps->width, sps->height,
|
||||
@ -1168,12 +1169,12 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
|
||||
/* check if this is a repeat of an already parsed SPS, then keep the
|
||||
* original one.
|
||||
* otherwise drop all PPSes that depend on it */
|
||||
if (s->sps_list[sps_id] &&
|
||||
!memcmp(s->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) {
|
||||
if (ps->sps_list[sps_id] &&
|
||||
!memcmp(ps->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) {
|
||||
av_buffer_unref(&sps_buf);
|
||||
} else {
|
||||
remove_sps(s, sps_id);
|
||||
s->sps_list[sps_id] = sps_buf;
|
||||
remove_sps(ps, sps_id);
|
||||
ps->sps_list[sps_id] = sps_buf;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1197,8 +1198,8 @@ static void hevc_pps_free(void *opaque, uint8_t *data)
|
||||
av_freep(&pps);
|
||||
}
|
||||
|
||||
static int pps_range_extensions(HEVCContext *s, HEVCPPS *pps, HEVCSPS *sps) {
|
||||
GetBitContext *gb = &s->HEVClc->gb;
|
||||
static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCPPS *pps, HEVCSPS *sps) {
|
||||
int i;
|
||||
|
||||
if (pps->transform_skip_enabled_flag) {
|
||||
@ -1210,19 +1211,19 @@ static int pps_range_extensions(HEVCContext *s, HEVCPPS *pps, HEVCSPS *sps) {
|
||||
pps->diff_cu_chroma_qp_offset_depth = get_ue_golomb_long(gb);
|
||||
pps->chroma_qp_offset_list_len_minus1 = get_ue_golomb_long(gb);
|
||||
if (pps->chroma_qp_offset_list_len_minus1 && pps->chroma_qp_offset_list_len_minus1 >= 5) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"chroma_qp_offset_list_len_minus1 shall be in the range [0, 5].\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
for (i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) {
|
||||
pps->cb_qp_offset_list[i] = get_se_golomb_long(gb);
|
||||
if (pps->cb_qp_offset_list[i]) {
|
||||
av_log(s->avctx, AV_LOG_WARNING,
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"cb_qp_offset_list not tested yet.\n");
|
||||
}
|
||||
pps->cr_qp_offset_list[i] = get_se_golomb_long(gb);
|
||||
if (pps->cr_qp_offset_list[i]) {
|
||||
av_log(s->avctx, AV_LOG_WARNING,
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"cb_qp_offset_list not tested yet.\n");
|
||||
}
|
||||
}
|
||||
@ -1233,9 +1234,9 @@ static int pps_range_extensions(HEVCContext *s, HEVCPPS *pps, HEVCSPS *sps) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
||||
HEVCParamSets *ps)
|
||||
{
|
||||
GetBitContext *gb = &s->HEVClc->gb;
|
||||
HEVCSPS *sps = NULL;
|
||||
int pic_area_in_ctbs;
|
||||
int log2_diff_ctb_min_tb_size;
|
||||
@ -1256,7 +1257,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "Decoding PPS\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "Decoding PPS\n");
|
||||
|
||||
// Default values
|
||||
pps->loop_filter_across_tiles_enabled_flag = 1;
|
||||
@ -1271,22 +1272,22 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
// Coded parameters
|
||||
pps_id = get_ue_golomb_long(gb);
|
||||
if (pps_id >= MAX_PPS_COUNT) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id);
|
||||
av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
pps->sps_id = get_ue_golomb_long(gb);
|
||||
if (pps->sps_id >= MAX_SPS_COUNT) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", pps->sps_id);
|
||||
av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", pps->sps_id);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
if (!s->sps_list[pps->sps_id]) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "SPS %u does not exist.\n", pps->sps_id);
|
||||
if (!ps->sps_list[pps->sps_id]) {
|
||||
av_log(avctx, AV_LOG_ERROR, "SPS %u does not exist.\n", pps->sps_id);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
sps = (HEVCSPS *)s->sps_list[pps->sps_id]->data;
|
||||
sps = (HEVCSPS *)ps->sps_list[pps->sps_id]->data;
|
||||
|
||||
pps->dependent_slice_segments_enabled_flag = get_bits1(gb);
|
||||
pps->output_flag_present_flag = get_bits1(gb);
|
||||
@ -1311,7 +1312,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
|
||||
if (pps->diff_cu_qp_delta_depth < 0 ||
|
||||
pps->diff_cu_qp_delta_depth > sps->log2_diff_max_min_coding_block_size) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "diff_cu_qp_delta_depth %d is invalid\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "diff_cu_qp_delta_depth %d is invalid\n",
|
||||
pps->diff_cu_qp_delta_depth);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
@ -1319,14 +1320,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
|
||||
pps->cb_qp_offset = get_se_golomb(gb);
|
||||
if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n",
|
||||
pps->cb_qp_offset);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
pps->cr_qp_offset = get_se_golomb(gb);
|
||||
if (pps->cr_qp_offset < -12 || pps->cr_qp_offset > 12) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "pps_cr_qp_offset out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "pps_cr_qp_offset out of range: %d\n",
|
||||
pps->cr_qp_offset);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
@ -1345,14 +1346,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
pps->num_tile_rows = get_ue_golomb_long(gb) + 1;
|
||||
if (pps->num_tile_columns <= 0 ||
|
||||
pps->num_tile_columns >= sps->width) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n",
|
||||
pps->num_tile_columns - 1);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
if (pps->num_tile_rows <= 0 ||
|
||||
pps->num_tile_rows >= sps->height) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n",
|
||||
pps->num_tile_rows - 1);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
@ -1373,7 +1374,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
sum += pps->column_width[i];
|
||||
}
|
||||
if (sum >= sps->ctb_width) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid tile widths.\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid tile widths.\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
@ -1385,7 +1386,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
sum += pps->row_height[i];
|
||||
}
|
||||
if (sum >= sps->ctb_height) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid tile heights.\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid tile heights.\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
@ -1404,13 +1405,13 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
pps->beta_offset = get_se_golomb(gb) * 2;
|
||||
pps->tc_offset = get_se_golomb(gb) * 2;
|
||||
if (pps->beta_offset/2 < -6 || pps->beta_offset/2 > 6) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "pps_beta_offset_div2 out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "pps_beta_offset_div2 out of range: %d\n",
|
||||
pps->beta_offset/2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
}
|
||||
if (pps->tc_offset/2 < -6 || pps->tc_offset/2 > 6) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "pps_tc_offset_div2 out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "pps_tc_offset_div2 out of range: %d\n",
|
||||
pps->tc_offset/2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
@ -1421,14 +1422,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
pps->scaling_list_data_present_flag = get_bits1(gb);
|
||||
if (pps->scaling_list_data_present_flag) {
|
||||
set_default_scaling_list_data(&pps->scaling_list);
|
||||
ret = scaling_list_data(gb, s->avctx, &pps->scaling_list, sps);
|
||||
ret = scaling_list_data(gb, avctx, &pps->scaling_list, sps);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
}
|
||||
pps->lists_modification_present_flag = get_bits1(gb);
|
||||
pps->log2_parallel_merge_level = get_ue_golomb_long(gb) + 2;
|
||||
if (pps->log2_parallel_merge_level > sps->log2_ctb_size) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "log2_parallel_merge_level_minus2 out of range: %d\n",
|
||||
av_log(avctx, AV_LOG_ERROR, "log2_parallel_merge_level_minus2 out of range: %d\n",
|
||||
pps->log2_parallel_merge_level - 2);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto err;
|
||||
@ -1440,7 +1441,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
int pps_range_extensions_flag = get_bits1(gb);
|
||||
/* int pps_extension_7bits = */ get_bits(gb, 7);
|
||||
if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps_range_extensions_flag) {
|
||||
if ((ret = pps_range_extensions(s, pps, sps)) < 0)
|
||||
if ((ret = pps_range_extensions(gb, avctx, pps, sps)) < 0)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@ -1575,13 +1576,13 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
}
|
||||
|
||||
if (get_bits_left(gb) < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Overread PPS by %d bits\n", -get_bits_left(gb));
|
||||
goto err;
|
||||
}
|
||||
|
||||
remove_pps(s, pps_id);
|
||||
s->pps_list[pps_id] = pps_buf;
|
||||
remove_pps(ps, pps_id);
|
||||
ps->pps_list[pps_id] = pps_buf;
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -55,10 +55,10 @@ void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
|
||||
|
||||
RefPicList *ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *ref, int x0, int y0)
|
||||
{
|
||||
int x_cb = x0 >> s->sps->log2_ctb_size;
|
||||
int y_cb = y0 >> s->sps->log2_ctb_size;
|
||||
int pic_width_cb = s->sps->ctb_width;
|
||||
int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb];
|
||||
int x_cb = x0 >> s->ps.sps->log2_ctb_size;
|
||||
int y_cb = y0 >> s->ps.sps->log2_ctb_size;
|
||||
int pic_width_cb = s->ps.sps->ctb_width;
|
||||
int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb];
|
||||
return (RefPicList *)ref->rpl_tab[ctb_addr_ts];
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
|
||||
if (!frame->rpl_tab_buf)
|
||||
goto fail;
|
||||
frame->rpl_tab = (RefPicListTab **)frame->rpl_tab_buf->data;
|
||||
frame->ctb_count = s->sps->ctb_width * s->sps->ctb_height;
|
||||
frame->ctb_count = s->ps.sps->ctb_width * s->ps.sps->ctb_height;
|
||||
for (j = 0; j < frame->ctb_count; j++)
|
||||
frame->rpl_tab[j] = (RefPicListTab *)frame->rpl_buf->data;
|
||||
|
||||
@ -162,7 +162,7 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
|
||||
|
||||
ref->poc = poc;
|
||||
ref->sequence = s->seq_decode;
|
||||
ref->window = s->sps->output_window;
|
||||
ref->window = s->ps.sps->output_window;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -197,8 +197,8 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
|
||||
}
|
||||
|
||||
/* wait for more frames before output */
|
||||
if (!flush && s->seq_output == s->seq_decode && s->sps &&
|
||||
nb_output <= s->sps->temporal_layer[s->sps->max_sub_layers - 1].num_reorder_pics)
|
||||
if (!flush && s->seq_output == s->seq_decode && s->ps.sps &&
|
||||
nb_output <= s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].num_reorder_pics)
|
||||
return 0;
|
||||
|
||||
if (nb_output) {
|
||||
@ -252,7 +252,7 @@ void ff_hevc_bump_frame(HEVCContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
if (s->sps && dpb >= s->sps->temporal_layer[s->sps->max_sub_layers - 1].max_dec_pic_buffering) {
|
||||
if (s->ps.sps && dpb >= s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].max_dec_pic_buffering) {
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
|
||||
HEVCFrame *frame = &s->DPB[i];
|
||||
if ((frame->flags) &&
|
||||
@ -281,7 +281,7 @@ static int init_slice_rpl(HEVCContext *s)
|
||||
{
|
||||
HEVCFrame *frame = s->ref;
|
||||
int ctb_count = frame->ctb_count;
|
||||
int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr];
|
||||
int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr];
|
||||
int i;
|
||||
|
||||
if (s->slice_idx >= frame->rpl_buf->size / sizeof(RefPicListTab))
|
||||
@ -368,7 +368,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
|
||||
static HEVCFrame *find_ref_idx(HEVCContext *s, int poc)
|
||||
{
|
||||
int i;
|
||||
int LtMask = (1 << s->sps->log2_max_poc_lsb) - 1;
|
||||
int LtMask = (1 << s->ps.sps->log2_max_poc_lsb) - 1;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
|
||||
HEVCFrame *ref = &s->DPB[i];
|
||||
@ -408,16 +408,16 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
|
||||
return NULL;
|
||||
|
||||
if (!s->avctx->hwaccel) {
|
||||
if (!s->sps->pixel_shift) {
|
||||
if (!s->ps.sps->pixel_shift) {
|
||||
for (i = 0; frame->frame->buf[i]; i++)
|
||||
memset(frame->frame->buf[i]->data, 1 << (s->sps->bit_depth - 1),
|
||||
memset(frame->frame->buf[i]->data, 1 << (s->ps.sps->bit_depth - 1),
|
||||
frame->frame->buf[i]->size);
|
||||
} else {
|
||||
for (i = 0; frame->frame->data[i]; i++)
|
||||
for (y = 0; y < (s->sps->height >> s->sps->vshift[i]); y++)
|
||||
for (x = 0; x < (s->sps->width >> s->sps->hshift[i]); x++) {
|
||||
for (y = 0; y < (s->ps.sps->height >> s->ps.sps->vshift[i]); y++)
|
||||
for (x = 0; x < (s->ps.sps->width >> s->ps.sps->hshift[i]); x++) {
|
||||
AV_WN16(frame->frame->data[i] + y * frame->frame->linesize[i] + 2 * x,
|
||||
1 << (s->sps->bit_depth - 1));
|
||||
1 << (s->ps.sps->bit_depth - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -517,7 +517,7 @@ fail:
|
||||
|
||||
int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb)
|
||||
{
|
||||
int max_poc_lsb = 1 << s->sps->log2_max_poc_lsb;
|
||||
int max_poc_lsb = 1 << s->ps.sps->log2_max_poc_lsb;
|
||||
int prev_poc_lsb = s->pocTid0 % max_poc_lsb;
|
||||
int prev_poc_msb = s->pocTid0 - prev_poc_lsb;
|
||||
int poc_msb;
|
||||
|
@ -94,9 +94,9 @@ static int decode_pic_timing(HEVCContext *s)
|
||||
GetBitContext *gb = &s->HEVClc->gb;
|
||||
HEVCSPS *sps;
|
||||
|
||||
if (!s->sps_list[s->active_seq_parameter_set_id])
|
||||
if (!s->ps.sps_list[s->active_seq_parameter_set_id])
|
||||
return(AVERROR(ENOMEM));
|
||||
sps = (HEVCSPS*)s->sps_list[s->active_seq_parameter_set_id]->data;
|
||||
sps = (HEVCSPS*)s->ps.sps_list[s->active_seq_parameter_set_id]->data;
|
||||
|
||||
if (sps->vui.frame_field_info_present_flag) {
|
||||
int pic_struct = get_bits(gb, 4);
|
||||
|
@ -31,7 +31,7 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
|
||||
int log2_size, int c_idx)
|
||||
{
|
||||
#define PU(x) \
|
||||
((x) >> s->sps->log2_min_pu_size)
|
||||
((x) >> s->ps.sps->log2_min_pu_size)
|
||||
#define MVF(x, y) \
|
||||
(s->ref->tab_mvf[(x) + (y) * min_pu_width])
|
||||
#define MVF_PU(x, y) \
|
||||
@ -39,7 +39,7 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
|
||||
#define IS_INTRA(x, y) \
|
||||
(MVF_PU(x, y).pred_flag == PF_INTRA)
|
||||
#define MIN_TB_ADDR_ZS(x, y) \
|
||||
s->pps->min_tb_addr_zs[(y) * (s->sps->tb_mask+2) + (x)]
|
||||
s->ps.pps->min_tb_addr_zs[(y) * (s->ps.sps->tb_mask+2) + (x)]
|
||||
#define EXTEND(ptr, val, len) \
|
||||
do { \
|
||||
pixel4 pix = PIXEL_SPLAT_X4(val); \
|
||||
@ -72,24 +72,24 @@ do { \
|
||||
|
||||
HEVCLocalContext *lc = s->HEVClc;
|
||||
int i;
|
||||
int hshift = s->sps->hshift[c_idx];
|
||||
int vshift = s->sps->vshift[c_idx];
|
||||
int hshift = s->ps.sps->hshift[c_idx];
|
||||
int vshift = s->ps.sps->vshift[c_idx];
|
||||
int size = (1 << log2_size);
|
||||
int size_in_luma_h = size << hshift;
|
||||
int size_in_tbs_h = size_in_luma_h >> s->sps->log2_min_tb_size;
|
||||
int size_in_tbs_h = size_in_luma_h >> s->ps.sps->log2_min_tb_size;
|
||||
int size_in_luma_v = size << vshift;
|
||||
int size_in_tbs_v = size_in_luma_v >> s->sps->log2_min_tb_size;
|
||||
int size_in_tbs_v = size_in_luma_v >> s->ps.sps->log2_min_tb_size;
|
||||
int x = x0 >> hshift;
|
||||
int y = y0 >> vshift;
|
||||
int x_tb = (x0 >> s->sps->log2_min_tb_size) & s->sps->tb_mask;
|
||||
int y_tb = (y0 >> s->sps->log2_min_tb_size) & s->sps->tb_mask;
|
||||
int x_tb = (x0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
|
||||
int y_tb = (y0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
|
||||
|
||||
int cur_tb_addr = MIN_TB_ADDR_ZS(x_tb, y_tb);
|
||||
|
||||
ptrdiff_t stride = s->frame->linesize[c_idx] / sizeof(pixel);
|
||||
pixel *src = (pixel*)s->frame->data[c_idx] + x + y * stride;
|
||||
|
||||
int min_pu_width = s->sps->min_pu_width;
|
||||
int min_pu_width = s->ps.sps->min_pu_width;
|
||||
|
||||
enum IntraPredMode mode = c_idx ? lc->tu.intra_pred_mode_c :
|
||||
lc->tu.intra_pred_mode;
|
||||
@ -103,28 +103,28 @@ do { \
|
||||
pixel *top = top_array + 1;
|
||||
pixel *filtered_left = filtered_left_array + 1;
|
||||
pixel *filtered_top = filtered_top_array + 1;
|
||||
int cand_bottom_left = lc->na.cand_bottom_left && cur_tb_addr > MIN_TB_ADDR_ZS( x_tb - 1, (y_tb + size_in_tbs_v) & s->sps->tb_mask);
|
||||
int cand_bottom_left = lc->na.cand_bottom_left && cur_tb_addr > MIN_TB_ADDR_ZS( x_tb - 1, (y_tb + size_in_tbs_v) & s->ps.sps->tb_mask);
|
||||
int cand_left = lc->na.cand_left;
|
||||
int cand_up_left = lc->na.cand_up_left;
|
||||
int cand_up = lc->na.cand_up;
|
||||
int cand_up_right = lc->na.cand_up_right && cur_tb_addr > MIN_TB_ADDR_ZS((x_tb + size_in_tbs_h) & s->sps->tb_mask, y_tb - 1);
|
||||
int cand_up_right = lc->na.cand_up_right && cur_tb_addr > MIN_TB_ADDR_ZS((x_tb + size_in_tbs_h) & s->ps.sps->tb_mask, y_tb - 1);
|
||||
|
||||
int bottom_left_size = (FFMIN(y0 + 2 * size_in_luma_v, s->sps->height) -
|
||||
int bottom_left_size = (FFMIN(y0 + 2 * size_in_luma_v, s->ps.sps->height) -
|
||||
(y0 + size_in_luma_v)) >> vshift;
|
||||
int top_right_size = (FFMIN(x0 + 2 * size_in_luma_h, s->sps->width) -
|
||||
int top_right_size = (FFMIN(x0 + 2 * size_in_luma_h, s->ps.sps->width) -
|
||||
(x0 + size_in_luma_h)) >> hshift;
|
||||
|
||||
if (s->pps->constrained_intra_pred_flag == 1) {
|
||||
if (s->ps.pps->constrained_intra_pred_flag == 1) {
|
||||
int size_in_luma_pu_v = PU(size_in_luma_v);
|
||||
int size_in_luma_pu_h = PU(size_in_luma_h);
|
||||
int on_pu_edge_x = !av_mod_uintp2(x0, s->sps->log2_min_pu_size);
|
||||
int on_pu_edge_y = !av_mod_uintp2(y0, s->sps->log2_min_pu_size);
|
||||
int on_pu_edge_x = !av_mod_uintp2(x0, s->ps.sps->log2_min_pu_size);
|
||||
int on_pu_edge_y = !av_mod_uintp2(y0, s->ps.sps->log2_min_pu_size);
|
||||
if (!size_in_luma_pu_h)
|
||||
size_in_luma_pu_h++;
|
||||
if (cand_bottom_left == 1 && on_pu_edge_x) {
|
||||
int x_left_pu = PU(x0 - 1);
|
||||
int y_bottom_pu = PU(y0 + size_in_luma_v);
|
||||
int max = FFMIN(size_in_luma_pu_v, s->sps->min_pu_height - y_bottom_pu);
|
||||
int max = FFMIN(size_in_luma_pu_v, s->ps.sps->min_pu_height - y_bottom_pu);
|
||||
cand_bottom_left = 0;
|
||||
for (i = 0; i < max; i += 2)
|
||||
cand_bottom_left |= (MVF(x_left_pu, y_bottom_pu + i).pred_flag == PF_INTRA);
|
||||
@ -132,7 +132,7 @@ do { \
|
||||
if (cand_left == 1 && on_pu_edge_x) {
|
||||
int x_left_pu = PU(x0 - 1);
|
||||
int y_left_pu = PU(y0);
|
||||
int max = FFMIN(size_in_luma_pu_v, s->sps->min_pu_height - y_left_pu);
|
||||
int max = FFMIN(size_in_luma_pu_v, s->ps.sps->min_pu_height - y_left_pu);
|
||||
cand_left = 0;
|
||||
for (i = 0; i < max; i += 2)
|
||||
cand_left |= (MVF(x_left_pu, y_left_pu + i).pred_flag == PF_INTRA);
|
||||
@ -145,7 +145,7 @@ do { \
|
||||
if (cand_up == 1 && on_pu_edge_y) {
|
||||
int x_top_pu = PU(x0);
|
||||
int y_top_pu = PU(y0 - 1);
|
||||
int max = FFMIN(size_in_luma_pu_h, s->sps->min_pu_width - x_top_pu);
|
||||
int max = FFMIN(size_in_luma_pu_h, s->ps.sps->min_pu_width - x_top_pu);
|
||||
cand_up = 0;
|
||||
for (i = 0; i < max; i += 2)
|
||||
cand_up |= (MVF(x_top_pu + i, y_top_pu).pred_flag == PF_INTRA);
|
||||
@ -153,7 +153,7 @@ do { \
|
||||
if (cand_up_right == 1 && on_pu_edge_y) {
|
||||
int y_top_pu = PU(y0 - 1);
|
||||
int x_right_pu = PU(x0 + size_in_luma_h);
|
||||
int max = FFMIN(size_in_luma_pu_h, s->sps->min_pu_width - x_right_pu);
|
||||
int max = FFMIN(size_in_luma_pu_h, s->ps.sps->min_pu_width - x_right_pu);
|
||||
cand_up_right = 0;
|
||||
for (i = 0; i < max; i += 2)
|
||||
cand_up_right |= (MVF(x_right_pu + i, y_top_pu).pred_flag == PF_INTRA);
|
||||
@ -183,20 +183,20 @@ do { \
|
||||
size - bottom_left_size);
|
||||
}
|
||||
|
||||
if (s->pps->constrained_intra_pred_flag == 1) {
|
||||
if (s->ps.pps->constrained_intra_pred_flag == 1) {
|
||||
if (cand_bottom_left || cand_left || cand_up_left || cand_up || cand_up_right) {
|
||||
int size_max_x = x0 + ((2 * size) << hshift) < s->sps->width ?
|
||||
2 * size : (s->sps->width - x0) >> hshift;
|
||||
int size_max_y = y0 + ((2 * size) << vshift) < s->sps->height ?
|
||||
2 * size : (s->sps->height - y0) >> vshift;
|
||||
int size_max_x = x0 + ((2 * size) << hshift) < s->ps.sps->width ?
|
||||
2 * size : (s->ps.sps->width - x0) >> hshift;
|
||||
int size_max_y = y0 + ((2 * size) << vshift) < s->ps.sps->height ?
|
||||
2 * size : (s->ps.sps->height - y0) >> vshift;
|
||||
int j = size + (cand_bottom_left? bottom_left_size: 0) -1;
|
||||
if (!cand_up_right) {
|
||||
size_max_x = x0 + ((size) << hshift) < s->sps->width ?
|
||||
size : (s->sps->width - x0) >> hshift;
|
||||
size_max_x = x0 + ((size) << hshift) < s->ps.sps->width ?
|
||||
size : (s->ps.sps->width - x0) >> hshift;
|
||||
}
|
||||
if (!cand_bottom_left) {
|
||||
size_max_y = y0 + (( size) << vshift) < s->sps->height ?
|
||||
size : (s->sps->height - y0) >> vshift;
|
||||
size_max_y = y0 + (( size) << vshift) < s->ps.sps->height ?
|
||||
size : (s->ps.sps->height - y0) >> vshift;
|
||||
}
|
||||
if (cand_bottom_left || cand_left || cand_up_left) {
|
||||
while (j > -1 && !IS_INTRA(-1, j))
|
||||
@ -287,14 +287,14 @@ do { \
|
||||
top[-1] = left[-1];
|
||||
|
||||
// Filtering process
|
||||
if (!s->sps->intra_smoothing_disabled_flag && (c_idx == 0 || s->sps->chroma_format_idc == 3)) {
|
||||
if (!s->ps.sps->intra_smoothing_disabled_flag && (c_idx == 0 || s->ps.sps->chroma_format_idc == 3)) {
|
||||
if (mode != INTRA_DC && size != 4){
|
||||
int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
|
||||
int min_dist_vert_hor = FFMIN(FFABS((int)(mode - 26U)),
|
||||
FFABS((int)(mode - 10U)));
|
||||
if (min_dist_vert_hor > intra_hor_ver_dist_thresh[log2_size - 3]) {
|
||||
int threshold = 1 << (BIT_DEPTH - 5);
|
||||
if (s->sps->sps_strong_intra_smoothing_enable_flag && c_idx == 0 &&
|
||||
if (s->ps.sps->sps_strong_intra_smoothing_enable_flag && c_idx == 0 &&
|
||||
log2_size == 5 &&
|
||||
FFABS(top[-1] + top[63] - 2 * top[31]) < threshold &&
|
||||
FFABS(left[-1] + left[63] - 2 * left[31]) < threshold) {
|
||||
|
Loading…
Reference in New Issue
Block a user