From 1a6948fa708d7f0a950f9caa0256e2d73740e924 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Nov 2013 11:59:02 +0100 Subject: [PATCH] libavcodec/hevc: reduce bracket differences to 064698d381e1e7790f21b0199a8930ea04e2e942 Signed-off-by: Michael Niedermayer --- libavcodec/hevc.c | 38 ++++++++++++++++---------------- libavcodec/hevc_cabac.c | 23 ++++++++++--------- libavcodec/hevc_filter.c | 26 +++++++++++----------- libavcodec/hevc_mvs.c | 13 +++++------ libavcodec/hevc_parser.c | 7 +++--- libavcodec/hevc_refs.c | 8 +++---- libavcodec/hevc_sei.c | 5 ++--- libavcodec/hevcdsp_template.c | 40 ++++++++++++---------------------- libavcodec/hevcpred_template.c | 6 ++--- 9 files changed, 74 insertions(+), 92 deletions(-) diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 642ab6857c..62ae09bbe8 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -443,7 +443,7 @@ static int hls_slice_header(HEVCContext *s) } 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]; } @@ -768,7 +768,7 @@ static void hls_transform_unit(HEVCContext *s, int x0, int y0, 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); @@ -867,10 +867,10 @@ static void hls_transform_tree(HEVCContext *s, int x0, int y0, 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 && @@ -878,9 +878,9 @@ static void hls_transform_tree(HEVCContext *s, int x0, int y0, !(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) { @@ -1686,8 +1686,8 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, 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); @@ -1777,14 +1777,14 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, 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; @@ -1811,8 +1811,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) 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); diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c index 43fd8924bc..da7a21373d 100644 --- a/libavcodec/hevc_cabac.c +++ b/libavcodec/hevc_cabac.c @@ -498,9 +498,9 @@ 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 || + (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); } } @@ -550,14 +550,14 @@ 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]) { 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) @@ -566,7 +566,7 @@ void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts) } } 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 @@ -574,7 +574,7 @@ void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts) 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); @@ -634,7 +634,7 @@ int ff_hevc_sao_offset_sign_decode(HEVCContext *s) 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; } @@ -789,7 +789,7 @@ int ff_hevc_intra_chroma_pred_mode_decode(HEVCContext *s) 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; } @@ -990,11 +990,10 @@ static av_always_inline int significant_coeff_flag_decode(HEVCContext *s, int c_ } } - 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); } diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 8d967a3d7f..c45e9f9f30 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -220,8 +220,8 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) 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; @@ -333,7 +333,7 @@ static int get_pcm(HEVCContext *s, int x, int y) 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) { @@ -383,8 +383,8 @@ 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)]; @@ -416,7 +416,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 / 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); @@ -448,8 +448,8 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) 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)]; @@ -488,13 +488,13 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) } 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); diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c index 6b3a8da143..d2a6169097 100644 --- a/libavcodec/hevc_mvs.c +++ b/libavcodec/hevc_mvs.c @@ -70,9 +70,9 @@ static int z_scan_block_avail(HEVCContext *s, int xCurr, int yCurr, 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, @@ -516,8 +516,8 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, 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++; @@ -691,9 +691,8 @@ void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, 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); diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c index 3801e1ffa1..09de43fcd8 100644 --- a/libavcodec/hevc_parser.c +++ b/libavcodec/hevc_parser.c @@ -294,13 +294,12 @@ static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size) 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; diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 0ca3f403af..1fe7b10d3c 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -263,7 +263,7 @@ int ff_hevc_slice_rpl(HEVCContext *s) 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++; } } @@ -312,7 +312,7 @@ static HEVCFrame *find_ref_idx(HEVCContext *s, int poc) 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; } @@ -450,9 +450,9 @@ int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb) 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; diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 24f27c88b5..2de9ac0107 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -38,10 +38,9 @@ static void decode_nal_sei_decoded_picture_hash(HEVCContext *s, 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) { diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index b91ed3dfa9..eea3cca54b 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -491,17 +491,15 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, 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--; } } @@ -672,17 +670,15 @@ static void FUNC(sao_edge_filter_2)(uint8_t *_dst, uint8_t *_src, 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--; } } @@ -936,9 +932,8 @@ static void FUNC(put_hevc_epel_pixels)(int16_t *dst, ptrdiff_t dststride, 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; } @@ -961,9 +956,8 @@ static void FUNC(put_hevc_epel_h)(int16_t *dst, ptrdiff_t 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; } @@ -984,9 +978,8 @@ static void FUNC(put_hevc_epel_v)(int16_t *dst, ptrdiff_t 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; } @@ -1012,9 +1005,8 @@ static void FUNC(put_hevc_epel_hv)(int16_t *dst, ptrdiff_t 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; } @@ -1025,9 +1017,8 @@ static void FUNC(put_hevc_epel_hv)(int16_t *dst, ptrdiff_t dststride, 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; } @@ -1048,9 +1039,8 @@ static void FUNC(put_unweighted_pred)(uint8_t *_dst, ptrdiff_t _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; } @@ -1073,9 +1063,8 @@ static void FUNC(put_weighted_pred_avg)(uint8_t *_dst, ptrdiff_t _dststride, #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; @@ -1137,14 +1126,13 @@ static void FUNC(weighted_pred_avg)(uint8_t denom, 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; diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c index 2276023252..07bc1ea795 100644 --- a/libavcodec/hevcpred_template.c +++ b/libavcodec/hevcpred_template.c @@ -491,9 +491,8 @@ static av_always_inline void FUNC(pred_angular)(uint8_t *_src, 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) { @@ -519,9 +518,8 @@ static av_always_inline void FUNC(pred_angular)(uint8_t *_src, 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) {