}
numbits = av_ceil_log2(s->sps->nb_st_rps);
- rps_idx = (numbits > 0) ? get_bits(gb, numbits) : 0;
+ rps_idx = numbits > 0 ? get_bits(gb, numbits) : 0;
sh->short_term_rps = &s->sps->st_rps[rps_idx];
}
s->hpc.intra_pred(s, x0, y0, log2_trafo_size - 1, 1);
s->hpc.intra_pred(s, x0, y0, log2_trafo_size - 1, 2);
} else if (blk_idx == 3) {
- trafo_size = trafo_size << (s->sps->hshift[1]);
+ trafo_size = trafo_size << s->sps->hshift[1];
ff_hevc_set_neighbour_available(s, xBase, yBase,
trafo_size, trafo_size);
s->hpc.intra_pred(s, xBase, yBase, log2_trafo_size, 1);
lc->tt.cbf_luma = 1;
- lc->tt.inter_split_flag = (s->sps->max_transform_hierarchy_depth_inter == 0 &&
+ lc->tt.inter_split_flag = s->sps->max_transform_hierarchy_depth_inter == 0 &&
lc->cu.pred_mode == MODE_INTER &&
lc->cu.part_mode != PART_2Nx2N &&
- trafo_depth == 0);
+ trafo_depth == 0;
if (log2_trafo_size <= s->sps->log2_max_trafo_size &&
log2_trafo_size > s->sps->log2_min_tb_size &&
!(lc->cu.intra_split_flag && trafo_depth == 0)) {
split_transform_flag = ff_hevc_split_transform_flag_decode(s, log2_trafo_size);
} else {
- split_transform_flag = (log2_trafo_size > s->sps->log2_max_trafo_size ||
- (lc->cu.intra_split_flag && (trafo_depth == 0)) ||
- lc->tt.inter_split_flag);
+ split_transform_flag = log2_trafo_size > s->sps->log2_max_trafo_size ||
+ (lc->cu.intra_split_flag && trafo_depth == 0) ||
+ lc->tt.inter_split_flag;
}
if (log2_trafo_size > 2) {
int ret;
lc->ct.depth = cb_depth;
- if ((x0 + cb_size <= s->sps->width) &&
- (y0 + cb_size <= s->sps->height) &&
+ if (x0 + cb_size <= s->sps->width &&
+ y0 + cb_size <= s->sps->height &&
log2_cb_size > s->sps->log2_min_cb_size) {
SAMPLE(s->split_cu_flag, x0, y0) =
ff_hevc_split_coding_unit_flag_decode(s, cb_depth, x0, y0);
lc->end_of_tiles_y = FFMIN(y_ctb + ctb_size, s->sps->height);
if (s->pps->tiles_enabled_flag) {
- tile_left_boundary = ((x_ctb > 0) &&
- (s->pps->tile_id[ctb_addr_ts] == s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs - 1]]));
- slice_left_boundary = ((x_ctb > 0) &&
- (s->tab_slice_address[ctb_addr_rs] == s->tab_slice_address[ctb_addr_rs - 1]));
- tile_up_boundary = ((y_ctb > 0) &&
- (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]]));
- slice_up_boundary = ((y_ctb > 0) &&
- (s->tab_slice_address[ctb_addr_rs] == s->tab_slice_address[ctb_addr_rs - s->sps->ctb_width]));
+ tile_left_boundary = x_ctb > 0 &&
+ s->pps->tile_id[ctb_addr_ts] == s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs - 1]];
+ slice_left_boundary = x_ctb > 0 &&
+ s->tab_slice_address[ctb_addr_rs] == s->tab_slice_address[ctb_addr_rs - 1];
+ tile_up_boundary = y_ctb > 0 &&
+ 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]];
+ slice_up_boundary = y_ctb > 0 &&
+ s->tab_slice_address[ctb_addr_rs] == s->tab_slice_address[ctb_addr_rs - s->sps->ctb_width];
} else {
tile_left_boundary =
tile_up_boundary = 1;
while (more_data && ctb_addr_ts < s->sps->ctb_size) {
int ctb_addr_rs = s->pps->ctb_addr_ts_to_rs[ctb_addr_ts];
- x_ctb = (ctb_addr_rs % ((s->sps->width + (ctb_size - 1)) >> s->sps->log2_ctb_size)) << s->sps->log2_ctb_size;
- y_ctb = (ctb_addr_rs / ((s->sps->width + (ctb_size - 1)) >> s->sps->log2_ctb_size)) << s->sps->log2_ctb_size;
+ x_ctb = (ctb_addr_rs % ((s->sps->width + ctb_size - 1) >> s->sps->log2_ctb_size)) << s->sps->log2_ctb_size;
+ y_ctb = (ctb_addr_rs / ((s->sps->width + ctb_size - 1) >> s->sps->log2_ctb_size)) << s->sps->log2_ctb_size;
hls_decode_neighbour(s, x_ctb, y_ctb, ctb_addr_ts);
ff_hevc_cabac_init(s, ctb_addr_ts);
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 ||
+ (ctb_addr_ts % s->sps->ctb_width == 2 ||
(s->sps->ctb_width == 2 &&
- (ctb_addr_ts % s->sps->ctb_width) == 0))) {
+ ctb_addr_ts % s->sps->ctb_width == 0))) {
memcpy(s->cabac_state, s->HEVClc->cabac_state, HEVC_CONTEXTS);
}
}
{
if (ctb_addr_ts == s->pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]) {
cabac_init_decoder(s);
- if ((s->sh.dependent_slice_segment_flag == 0) ||
+ 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->pps->tile_id[ctb_addr_ts] != s->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 (ctb_addr_ts % s->sps->ctb_width == 0) {
if (s->sps->ctb_width == 1)
cabac_init_state(s);
else if (s->sh.dependent_slice_segment_flag == 1)
}
} else {
if (s->pps->tiles_enabled_flag &&
- (s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[ctb_addr_ts - 1])) {
+ s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[ctb_addr_ts - 1]) {
if (s->threads_number == 1)
cabac_reinit(s->HEVClc);
else
cabac_init_state(s);
}
if (s->pps->entropy_coding_sync_enabled_flag) {
- if ((ctb_addr_ts % s->sps->ctb_width) == 0) {
+ if (ctb_addr_ts % s->sps->ctb_width == 0) {
get_cabac_terminate(&s->HEVClc->cc);
if (s->threads_number == 1)
cabac_reinit(s->HEVClc);
int ff_hevc_sao_eo_class_decode(HEVCContext *s)
{
- int ret = (get_cabac_bypass(&s->HEVClc->cc) << 1);
+ int ret = get_cabac_bypass(&s->HEVClc->cc) << 1;
ret |= get_cabac_bypass(&s->HEVClc->cc);
return ret;
}
if (!GET_CABAC(elem_offset[INTRA_CHROMA_PRED_MODE]))
return 4;
- ret = (get_cabac_bypass(&s->HEVClc->cc) << 1);
+ ret = get_cabac_bypass(&s->HEVClc->cc) << 1;
ret |= get_cabac_bypass(&s->HEVClc->cc);
return ret;
}
}
}
- if (c_idx == 0) {
+ if (c_idx == 0)
inc = sig_ctx;
- } else {
+ else
inc = sig_ctx + 27;
- }
return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + inc);
}
sao[0] = &CTB(s->sao, x_ctb, y_ctb);
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->sps->ctb_width - 1;
+ edges[3] = y_ctb == s->sps->ctb_height - 1;
lfase[0] = CTB(s->filter_slice_edges, x_ctb, y_ctb);
classes[0] = 0;
return s->is_pcm[y_pu * s->sps->min_pu_width + x_pu];
}
-#define TC_CALC(qp, bs) tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + ((tc_offset >> 1) << 1), 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
+#define TC_CALC(qp, bs) tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + (tc_offset >> 1 << 1), 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
{
const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
const int qp1 = (get_qPy(s, x - 1, y + 4) + get_qPy(s, x, y + 4) + 1) >> 1;
- beta[0] = betatable[av_clip(qp0 + ((beta_offset >> 1) << 1), 0, MAX_QP)];
- beta[1] = betatable[av_clip(qp1 + ((beta_offset >> 1) << 1), 0, MAX_QP)];
+ beta[0] = betatable[av_clip(qp0 + (beta_offset >> 1 << 1), 0, MAX_QP)];
+ beta[1] = betatable[av_clip(qp1 + (beta_offset >> 1 << 1), 0, MAX_QP)];
tc[0] = bs0 ? TC_CALC(qp0, bs0) : 0;
tc[1] = bs1 ? TC_CALC(qp1, bs1) : 0;
src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->sps->pixel_shift)];
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 / 2) * s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
+ src = &s->frame->data[chroma][y / 2 * s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
if (pcmf) {
no_p[0] = get_pcm(s, x - 1, y);
no_p[1] = get_pcm(s, x - 1, y + 8);
tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
- beta[0] = betatable[av_clip(qp0 + ((beta_offset >> 1) << 1), 0, MAX_QP)];
- beta[1] = betatable[av_clip(qp1 + ((beta_offset >> 1) << 1), 0, MAX_QP)];
+ beta[0] = betatable[av_clip(qp0 + (beta_offset >> 1 << 1), 0, MAX_QP)];
+ beta[1] = betatable[av_clip(qp1 + (beta_offset >> 1 << 1), 0, MAX_QP)];
tc[0] = bs0 ? TC_CALC(qp0, bs0) : 0;
tc[1] = bs1 ? TC_CALC(qp1, bs1) : 0;
src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->sps->pixel_shift)];
}
if ((bs0 == 2) || (bs1 == 2)) {
- const int qp0 = (bs0 == 2) ? ((get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1) : 0;
- const int qp1 = (bs1 == 2) ? ((get_qPy(s, x + 8, y - 1) + get_qPy(s, x + 8, y) + 1) >> 1) : 0;
+ const int qp0 = bs0 == 2 ? (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1 : 0;
+ const int qp1 = bs1 == 2 ? (get_qPy(s, x + 8, y - 1) + get_qPy(s, x + 8, y) + 1) >> 1 : 0;
tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
- 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 / 2) * s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
+ 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 / 2 * s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
if (pcmf) {
no_p[0] = get_pcm(s, x, y - 1);
no_p[1] = get_pcm(s, x + 8, y - 1);
yCurr >> s->sps->log2_min_tb_size);
int N;
- if ((xN < 0) || (yN < 0) ||
- (xN >= s->sps->width) ||
- (yN >= s->sps->height))
+ if (xN < 0 || yN < 0 ||
+ xN >= s->sps->width ||
+ yN >= s->sps->height)
return 0;
N = MIN_TB_ADDR_ZS(xN >> s->sps->log2_min_tb_size,
mergecandlist[nb_merge_cand].mv[1].x = 0;
mergecandlist[nb_merge_cand].mv[1].y = 0;
mergecandlist[nb_merge_cand].is_intra = 0;
- mergecandlist[nb_merge_cand].ref_idx[0] = (zero_idx < nb_refs) ? zero_idx : 0;
- mergecandlist[nb_merge_cand].ref_idx[1] = (zero_idx < nb_refs) ? zero_idx : 0;
+ mergecandlist[nb_merge_cand].ref_idx[0] = zero_idx < nb_refs ? zero_idx : 0;
+ mergecandlist[nb_merge_cand].ref_idx[1] = zero_idx < nb_refs ? zero_idx : 0;
nb_merge_cand++;
zero_idx++;
yA1_pu = yA1 >> s->sps->log2_min_pu_size;
is_available_a1 = AVAILABLE(cand_left, A1);
- if (is_available_a0 || is_available_a1) {
+ if (is_available_a0 || is_available_a1)
isScaledFlag_L0 = 1;
- }
if (is_available_a0) {
availableFlagLXA0 = MP_MX(A0, pred_flag_index_l0, mxA);
state = (state << 8) | buf[i];
if (((state >> 8) & 0xFFFFFF) == START_CODE) {
int nut = (state >> 1) & 0x3F;
- if (nut >= NAL_VPS && nut <= NAL_PPS) {
+ if (nut >= NAL_VPS && nut <= NAL_PPS)
has_ps = 1;
- } else if (has_ps) {
+ else if (has_ps)
return i - 3;
- } else { // no parameter set at the beginning of the stream
+ else // no parameter set at the beginning of the stream
return 0;
- }
}
}
return 0;
for (j = 0; j < rps->nb_refs && rpl_tmp.nb_refs < MAX_REFS; j++) {
rpl_tmp.list[rpl_tmp.nb_refs] = rps->list[j];
rpl_tmp.ref[rpl_tmp.nb_refs] = rps->ref[j];
- rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = (i == 2);
+ rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = i == 2;
rpl_tmp.nb_refs++;
}
}
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *ref = &s->DPB[i];
- if (ref->frame->buf[0] && (ref->sequence == s->seq_decode)) {
+ if (ref->frame->buf[0] && ref->sequence == s->seq_decode) {
if (ref->poc == poc || (ref->poc & LtMask) == poc)
return ref;
}
int prev_poc_msb = s->pocTid0 - prev_poc_lsb;
int poc_msb;
- if ((poc_lsb < prev_poc_lsb) && ((prev_poc_lsb - poc_lsb) >= max_poc_lsb / 2))
+ if (poc_lsb < prev_poc_lsb && prev_poc_lsb - poc_lsb >= max_poc_lsb / 2)
poc_msb = prev_poc_msb + max_poc_lsb;
- else if ((poc_lsb > prev_poc_lsb) && ((poc_lsb - prev_poc_lsb) > (max_poc_lsb / 2)))
+ else if (poc_lsb > prev_poc_lsb && poc_lsb - prev_poc_lsb > max_poc_lsb / 2)
poc_msb = prev_poc_msb - max_poc_lsb;
else
poc_msb = prev_poc_msb;
for (cIdx = 0; cIdx < 3/*((s->sps->chroma_format_idc == 0) ? 1 : 3)*/; cIdx++) {
if (hash_type == 0) {
s->is_md5 = 1;
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++)
s->md5[cIdx][i] = get_bits(gb, 8);
- }
- } else if( hash_type == 1) {
+ } else if (hash_type == 1) {
// picture_crc = get_bits(gb, 16);
skip_bits(gb, 16);
} else if (hash_type == 2) {
if (sao_eo_class != SAO_EO_HORIZ) {
if (borders[1]) {
int offset_val = sao_offset_val[0];
- for (x = init_x; x < width; x++) {
+ for (x = init_x; x < width; x++)
dst[x] = av_clip_pixel(src[x] + offset_val);
- }
init_y = 1;
}
if (borders[3]) {
int offset_val = sao_offset_val[0];
int y_stride = stride * (height - 1);
- for (x = init_x; x < width; x++) {
+ for (x = init_x; x < width; x++)
dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + offset_val);
- }
height--;
}
}
if (sao_eo_class != SAO_EO_HORIZ) {
if (borders[1]) {
int offset_val = sao_offset_val[0];
- for (x = init_x; x < width; x++) {
+ for (x = init_x; x < width; x++)
dst[x] = av_clip_pixel(src[x] + offset_val);
- }
init_y = 1;
}
if (borders[3]) {
int offset_val = sao_offset_val[0];
int y_stride = stride * (height - 1);
- for (x = init_x; x < width; x++) {
+ for (x = init_x; x < width; x++)
dst[x + y_stride] = av_clip_pixel(src[x + y_stride] + offset_val);
- }
height--;
}
}
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
+ for (x = 0; x < width; x++)
dst[x] = src[x] << (14 - BIT_DEPTH);
- }
src += srcstride;
dst += dststride;
}
int8_t filter_2 = filter[2];
int8_t filter_3 = filter[3];
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
+ for (x = 0; x < width; x++)
dst[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
- }
src += srcstride;
dst += dststride;
}
int8_t filter_3 = filter[3];
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
+ for (x = 0; x < width; x++)
dst[x] = EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8);
- }
src += srcstride;
dst += dststride;
}
src -= EPEL_EXTRA_BEFORE * srcstride;
for (y = 0; y < height + EPEL_EXTRA; y++) {
- for (x = 0; x < width; x++) {
+ for (x = 0; x < width; x++)
tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
- }
src += srcstride;
tmp += MAX_PB_SIZE;
}
filter_2 = filter_v[2];
filter_3 = filter_v[3];
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
+ for (x = 0; x < width; x++)
dst[x] = EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6;
- }
tmp += MAX_PB_SIZE;
dst += dststride;
}
int offset = 0;
#endif
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
+ for (x = 0; x < width; x++)
dst[x] = av_clip_pixel((src[x] + offset) >> shift);
- }
dst += dststride;
src += srcstride;
}
#endif
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
+ for (x = 0; x < width; x++)
dst[x] = av_clip_pixel((src1[x] + src2[x] + offset) >> shift);
- }
dst += dststride;
src1 += srcstride;
src2 += srcstride;
log2Wd = denom + shift;
w0 = wl0Flag;
w1 = wl1Flag;
- o0 = (ol0Flag) * (1 << (BIT_DEPTH - 8));
- o1 = (ol1Flag) * (1 << (BIT_DEPTH - 8));
+ o0 = ol0Flag * (1 << (BIT_DEPTH - 8));
+ o1 = ol1Flag * (1 << (BIT_DEPTH - 8));
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
+ for (x = 0; x < width; x++)
dst[x] = av_clip_pixel((src1[x] * w0 + src2[x] * w1 +
((o0 + o1 + 1) << log2Wd)) >> (log2Wd + 1));
- }
dst += dststride;
src1 += srcstride;
src2 += srcstride;
fact * ref[x + idx + 2] + 16) >> 5;
}
} else {
- for (x = 0; x < size; x++) {
+ for (x = 0; x < size; x++)
POS(x, y) = ref[x + idx + 1];
- }
}
}
if (mode == 26 && c_idx == 0 && size < 32) {
fact * ref[y + idx + 2] + 16) >> 5;
}
} else {
- for (y = 0; y < size; y++) {
+ for (y = 0; y < size; y++)
POS(x, y) = ref[y + idx + 1];
- }
}
}
if (mode == 10 && c_idx == 0 && size < 32) {