From 765485cab21021ac4ba9d1cbddce2432f421de99 Mon Sep 17 00:00:00 2001 From: Yunqing Wang Date: Tue, 15 Jul 2014 16:18:34 -0700 Subject: [PATCH] Add -DNDEBUG when config option debug is disabled For gcc, when libvpx config option debug is disabled, added the flag -DNDEBUG to disable the assertions in libvpx for some speedup. Change-Id: Ifcb7b9e8ef5cbe5d07a24407b53b9a2923f596ee --- build/make/configure.sh | 7 ++++++- vp8/encoder/onyx_if.c | 5 +++-- vp9/decoder/vp9_decodeframe.c | 2 +- vp9/encoder/vp9_encodeframe.c | 2 ++ vp9/encoder/vp9_rdopt.c | 3 +-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/build/make/configure.sh b/build/make/configure.sh index f22e3e0ac..d25f31333 100755 --- a/build/make/configure.sh +++ b/build/make/configure.sh @@ -1222,7 +1222,12 @@ EOF fi fi - enabled debug && check_add_cflags -g && check_add_ldflags -g + if enabled debug; then + check_add_cflags -g && check_add_ldflags -g + else + check_add_cflags -DNDEBUG + fi + enabled gprof && check_add_cflags -pg && check_add_ldflags -pg enabled gcov && check_add_cflags -fprofile-arcs -ftest-coverage && diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 373dbebd9..63d69269b 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -1405,7 +1405,7 @@ static void update_layer_contexts (VP8_COMP *cpi) double prev_layer_framerate=0; assert(oxcf->number_of_layers <= VPX_TS_MAX_LAYERS); - for (i=0; inumber_of_layers; i++) + for (i = 0; i < oxcf->number_of_layers && i < VPX_TS_MAX_LAYERS; ++i) { LAYER_CONTEXT *lc = &cpi->layer_context[i]; @@ -5037,7 +5037,8 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l /* Update frame rates for each layer */ assert(cpi->oxcf.number_of_layers <= VPX_TS_MAX_LAYERS); - for (i=0; ioxcf.number_of_layers; i++) + for (i = 0; i < cpi->oxcf.number_of_layers && + i < VPX_TS_MAX_LAYERS; ++i) { LAYER_CONTEXT *lc = &cpi->layer_context[i]; lc->framerate = cpi->ref_framerate / diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 614bf4bc0..15c8410f5 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -194,7 +194,7 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block, int eob) { struct macroblockd_plane *const pd = &xd->plane[plane]; if (eob > 0) { - TX_TYPE tx_type; + TX_TYPE tx_type = DCT_DCT; int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); if (xd->lossless) { tx_type = DCT_DCT; diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index c43ef5b38..3672e62b3 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -260,6 +260,8 @@ typedef enum { static void tree_to_node(void *data, BLOCK_SIZE bsize, variance_node *node) { int i; + node->part_variances = NULL; + vpx_memset(node->split, 0, sizeof(node->split)); switch (bsize) { case BLOCK_64X64: { v64x64 *vt = (v64x64 *) data; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index eae469dab..7236d93b8 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -3019,7 +3019,6 @@ int64_t vp9_rd_pick_inter_mode_sb_seg_skip(VP9_COMP *cpi, MACROBLOCK *x, RD_OPT *const rd_opt = &cpi->rd; MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; - const struct segmentation *const seg = &cm->seg; unsigned char segment_id = mbmi->segment_id; const int comp_pred = 0; int i; @@ -3045,7 +3044,7 @@ int64_t vp9_rd_pick_inter_mode_sb_seg_skip(VP9_COMP *cpi, MACROBLOCK *x, *returnrate = INT_MAX; - assert(vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)); + assert(vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)); mbmi->mode = ZEROMV; mbmi->uv_mode = DC_PRED; -- 2.40.0