From: James Zern Date: Wed, 20 Jul 2016 03:56:25 +0000 (-0700) Subject: vp8: correct if/else '{' placement X-Git-Tag: v1.7.0~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acb9460929ac31ec221102c5d2cdb400a92f4e6f;p=libvpx vp8: correct if/else '{' placement swap '{' and c-style comments removing a few redundant ones along the way; covers most leftovers from the clang-tidy run against an x86_64-linux config. Change-Id: I67a45596f80a12389faca49c5be440875092a7df --- diff --git a/vp8/common/mfqe.c b/vp8/common/mfqe.c index 5aace8c99..b6f8146b8 100644 --- a/vp8/common/mfqe.c +++ b/vp8/common/mfqe.c @@ -74,8 +74,7 @@ static void apply_ifactor(unsigned char *y_src, int y_src_stride, src_weight); vp8_filter_by_weight8x8(v_src, uv_src_stride, v_dst, uv_dst_stride, src_weight); - } else /* if (block_size == 8) */ - { + } else { vp8_filter_by_weight8x8(y_src, y_src_stride, y_dst, y_dst_stride, src_weight); vp8_filter_by_weight4x4(u_src, uv_src_stride, u_dst, uv_dst_stride, @@ -136,8 +135,7 @@ static void multiframe_quality_enhance_block( usad = (vpx_sad8x8(u, uv_stride, ud, uvd_stride) + 32) >> 6; vsad = (vpx_sad8x8(v, uv_stride, vd, uvd_stride) + 32) >> 6; #endif - } else /* if (blksize == 8) */ - { + } else { actd = (vpx_variance8x8(yd, yd_stride, VP8_ZEROS, 0, &sse) + 32) >> 6; act = (vpx_variance8x8(y, y_stride, VP8_ZEROS, 0, &sse) + 32) >> 6; #ifdef USE_SSD @@ -186,14 +184,12 @@ static void multiframe_quality_enhance_block( apply_ifactor(y, y_stride, yd, yd_stride, u, v, uv_stride, ud, vd, uvd_stride, blksize, ifactor); } - } else /* else implicitly copy from previous frame */ - { + } else { /* else implicitly copy from previous frame */ if (blksize == 16) { vp8_copy_mem16x16(y, y_stride, yd, yd_stride); vp8_copy_mem8x8(u, uv_stride, ud, uvd_stride); vp8_copy_mem8x8(v, uv_stride, vd, uvd_stride); - } else /* if (blksize == 8) */ - { + } else { vp8_copy_mem8x8(y, y_stride, yd, yd_stride); for (up = u, udp = ud, i = 0; i < uvblksize; ++i, up += uv_stride, udp += uvd_stride) { @@ -297,8 +293,7 @@ void vp8_multiframe_quality_enhance(VP8_COMMON *cm) { } } } - } else /* totmap = 4 */ - { + } else { /* totmap = 4 */ multiframe_quality_enhance_block( 16, qcurr, qprev, y_ptr, u_ptr, v_ptr, show->y_stride, show->uv_stride, yd_ptr, ud_ptr, vd_ptr, dest->y_stride, diff --git a/vp8/common/vp8_loopfilter.c b/vp8/common/vp8_loopfilter.c index c6430be46..9fb125065 100644 --- a/vp8/common/vp8_loopfilter.c +++ b/vp8/common/vp8_loopfilter.c @@ -111,11 +111,9 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm, MACROBLOCKD *mbd, /* Note the baseline filter values for each segment */ if (mbd->segmentation_enabled) { - /* Abs value */ if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA) { lvl_seg = mbd->segment_feature_data[MB_LVL_ALT_LF][seg]; - } else /* Delta Value */ - { + } else { /* Delta Value */ lvl_seg += mbd->segment_feature_data[MB_LVL_ALT_LF][seg]; } lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63 : lvl_seg) : 0; @@ -344,8 +342,7 @@ void vp8_loop_filter_frame(VP8_COMMON *cm, MACROBLOCKD *mbd, int frame_type) { mode_info_context++; /* Skip border mb */ } - } else /* SIMPLE_LOOPFILTER */ - { + } else { /* SIMPLE_LOOPFILTER */ for (mb_row = 0; mb_row < mb_rows; ++mb_row) { for (mb_col = 0; mb_col < mb_cols; ++mb_col) { int skip_lf = (mode_info_context->mbmi.mode != B_PRED && diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c index 58a26c1c9..8e9600c6d 100644 --- a/vp8/decoder/decodemv.c +++ b/vp8/decoder/decodemv.c @@ -65,8 +65,7 @@ static int read_mvcomponent(vp8_reader *r, const MV_CONTEXT *mvc) { const vp8_prob *const p = (const vp8_prob *)mvc; int x = 0; - if (vp8_read(r, p[mvpis_short])) /* Large */ - { + if (vp8_read(r, p[mvpis_short])) { /* Large */ int i = 0; do { @@ -285,8 +284,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi) { vp8_reader *const bc = &pbi->mbc[8]; mbmi->ref_frame = (MV_REFERENCE_FRAME)vp8_read(bc, pbi->prob_intra); - if (mbmi->ref_frame) /* inter MB */ - { + if (mbmi->ref_frame) { /* inter MB */ enum { CNT_INTRA, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV }; int cnt[4]; int *cntx = cnt; diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index d7a17b749..8cacb6450 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -500,8 +500,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) { } write_uv_mode(w, mi->uv_mode, pc->fc.uv_mode_prob); - } else /* inter coded */ - { + } else { /* inter coded */ int_mv best_mv; vp8_prob mv_ref_p[VP8_MVREFS - 1]; diff --git a/vp8/encoder/encodemv.c b/vp8/encoder/encodemv.c index 36e9a9078..ea93ccd71 100644 --- a/vp8/encoder/encodemv.c +++ b/vp8/encoder/encodemv.c @@ -25,14 +25,12 @@ static void encode_mvcomponent(vp8_writer *const w, const int v, const vp8_prob *p = mvc->prob; const int x = v < 0 ? -v : v; - if (x < mvnum_short) /* Small */ - { + if (x < mvnum_short) { /* Small */ vp8_write(w, 0, p[mvpis_short]); vp8_treed_write(w, vp8_small_mvtree, p + MVPshort, x, 3); if (!x) return; /* no sign bit */ - } else /* Large */ - { + } else { /* Large */ int i = 0; vp8_write(w, 1, p[mvpis_short]); diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 5d714e122..224318242 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -2925,8 +2925,7 @@ static void update_reference_frames(VP8_COMP *cpi) { cpi->current_ref_frames[GOLDEN_FRAME] = cm->current_video_frame; cpi->current_ref_frames[ALTREF_FRAME] = cm->current_video_frame; - } else /* For non key frames */ - { + } else { if (cm->refresh_alt_ref_frame) { assert(!cm->copy_buffer_to_arf); @@ -2947,8 +2946,7 @@ static void update_reference_frames(VP8_COMP *cpi) { cpi->current_ref_frames[ALTREF_FRAME] = cpi->current_ref_frames[LAST_FRAME]; } - } else /* if (cm->copy_buffer_to_arf == 2) */ - { + } else { if (cm->alt_fb_idx != cm->gld_fb_idx) { yv12_fb[cm->gld_fb_idx].flags |= VP8_ALTR_FRAME; yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME; @@ -2980,8 +2978,7 @@ static void update_reference_frames(VP8_COMP *cpi) { cpi->current_ref_frames[GOLDEN_FRAME] = cpi->current_ref_frames[LAST_FRAME]; } - } else /* if (cm->copy_buffer_to_gf == 2) */ - { + } else { if (cm->alt_fb_idx != cm->gld_fb_idx) { yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FRAME; yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME; @@ -3012,8 +3009,7 @@ static void update_reference_frames(VP8_COMP *cpi) { int i; for (i = LAST_FRAME; i < MAX_REF_FRAMES; ++i) vp8_yv12_copy_frame(cpi->Source, &cpi->denoiser.yv12_running_avg[i]); - } else /* For non key frames */ - { + } else { vp8_yv12_extend_frame_borders( &cpi->denoiser.yv12_running_avg[INTRA_FRAME]); diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index 70aef6bc8..e58c31098 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -498,11 +498,9 @@ static void calc_gf_params(VP8_COMP *cpi) { * This is updated once the real frame size/boost is known. */ if (cpi->oxcf.fixed_q == -1) { - if (cpi->pass == 2) /* 2 Pass */ - { + if (cpi->pass == 2) { /* 2 Pass */ cpi->frames_till_gf_update_due = cpi->baseline_gf_interval; - } else /* 1 Pass */ - { + } else { /* 1 Pass */ cpi->frames_till_gf_update_due = cpi->baseline_gf_interval; if (cpi->last_boost > 750) cpi->frames_till_gf_update_due++; diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index c9513eb68..67230d673 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -853,8 +853,7 @@ static int labels2mode(MACROBLOCK *x, int const *labelings, int which_label, default: break; } - if (m == ABOVE4X4) /* replace above with left if same */ - { + if (m == ABOVE4X4) { /* replace above with left if same */ int_mv left_mv; left_mv.as_int = col ? d[-1].bmi.mv.as_int : left_block_mv(mic, i); diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c index 292877252..f20283c1e 100644 --- a/vp8/vp8_dx_iface.c +++ b/vp8/vp8_dx_iface.c @@ -144,8 +144,7 @@ static vpx_codec_err_t vp8_peek_si_internal(const uint8_t *data, } si->is_kf = 0; - if (data_sz >= 10 && !(clear[0] & 0x01)) /* I-Frame */ - { + if (data_sz >= 10 && !(clear[0] & 0x01)) { /* I-Frame */ si->is_kf = 1; /* vet via sync code */