diff options
author | hkuang <hkuang@google.com> | 2013-11-14 22:50:46 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-14 22:50:46 -0800 |
commit | aa43d6ba5f5fb7eaeca1d0573ecb16ea4d388197 (patch) | |
tree | 6ff3bfc5090953c49fa26fac842b924d88e0983d /libvpx/vp9/encoder/vp9_onyx_if.c | |
parent | a1b7a7bb1ccf3f479bbca69a52a76eb05789dbaf (diff) | |
parent | 9b35249446b07f40ac5fcc3205f2c048616efacc (diff) | |
download | android_external_libvpx-aa43d6ba5f5fb7eaeca1d0573ecb16ea4d388197.tar.gz android_external_libvpx-aa43d6ba5f5fb7eaeca1d0573ecb16ea4d388197.tar.bz2 android_external_libvpx-aa43d6ba5f5fb7eaeca1d0573ecb16ea4d388197.zip |
am 9b352494: Roll latest libvpx to fix scalling bug. Checkout is from master:Ib748eb287520c794631697204da6ebe19523ce95
* commit '9b35249446b07f40ac5fcc3205f2c048616efacc':
Roll latest libvpx to fix scalling bug. Checkout is from master:Ib748eb287520c794631697204da6ebe19523ce95
Diffstat (limited to 'libvpx/vp9/encoder/vp9_onyx_if.c')
-rw-r--r-- | libvpx/vp9/encoder/vp9_onyx_if.c | 106 |
1 files changed, 70 insertions, 36 deletions
diff --git a/libvpx/vp9/encoder/vp9_onyx_if.c b/libvpx/vp9/encoder/vp9_onyx_if.c index f922f90..dd4705d 100644 --- a/libvpx/vp9/encoder/vp9_onyx_if.c +++ b/libvpx/vp9/encoder/vp9_onyx_if.c @@ -834,6 +834,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->adaptive_rd_thresh = 2; sf->recode_loop = 2; + sf->use_lp32x32fdct = 1; sf->mode_skip_start = 11; sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; @@ -1436,90 +1437,121 @@ static void cal_nmvsadcosts_hp(int *mvsadcost[2]) { } while (++i <= MV_MAX); } +static void alloc_mode_context(VP9_COMMON *cm, int num_4x4_blk, + PICK_MODE_CONTEXT *ctx) { + int num_pix = num_4x4_blk << 4; + int i, k; + ctx->num_4x4_blk = num_4x4_blk; + CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, + vpx_calloc(num_4x4_blk, sizeof(uint8_t))); + for (i = 0; i < MAX_MB_PLANE; ++i) { + for (k = 0; k < 3; ++k) { + CHECK_MEM_ERROR(cm, ctx->coeff[i][k], + vpx_memalign(16, num_pix * sizeof(int16_t))); + CHECK_MEM_ERROR(cm, ctx->qcoeff[i][k], + vpx_memalign(16, num_pix * sizeof(int16_t))); + CHECK_MEM_ERROR(cm, ctx->dqcoeff[i][k], + vpx_memalign(16, num_pix * sizeof(int16_t))); + CHECK_MEM_ERROR(cm, ctx->eobs[i][k], + vpx_memalign(16, num_pix * sizeof(uint16_t))); + ctx->coeff_pbuf[i][k] = ctx->coeff[i][k]; + ctx->qcoeff_pbuf[i][k] = ctx->qcoeff[i][k]; + ctx->dqcoeff_pbuf[i][k] = ctx->dqcoeff[i][k]; + ctx->eobs_pbuf[i][k] = ctx->eobs[i][k]; + } + } +} + +static void free_mode_context(PICK_MODE_CONTEXT *ctx) { + int i, k; + vpx_free(ctx->zcoeff_blk); + ctx->zcoeff_blk = 0; + for (i = 0; i < MAX_MB_PLANE; ++i) { + for (k = 0; k < 3; ++k) { + vpx_free(ctx->coeff[i][k]); + ctx->coeff[i][k] = 0; + vpx_free(ctx->qcoeff[i][k]); + ctx->qcoeff[i][k] = 0; + vpx_free(ctx->dqcoeff[i][k]); + ctx->dqcoeff[i][k] = 0; + vpx_free(ctx->eobs[i][k]); + ctx->eobs[i][k] = 0; + } + } +} + static void init_pick_mode_context(VP9_COMP *cpi) { int i; - MACROBLOCK *x = &cpi->mb; - MACROBLOCKD *xd = &x->e_mbd; - VP9_COMMON *cm = &cpi->common; + VP9_COMMON *const cm = &cpi->common; + MACROBLOCK *const x = &cpi->mb; + for (i = 0; i < BLOCK_SIZES; ++i) { const int num_4x4_w = num_4x4_blocks_wide_lookup[i]; const int num_4x4_h = num_4x4_blocks_high_lookup[i]; const int num_4x4_blk = MAX(4, num_4x4_w * num_4x4_h); if (i < BLOCK_16X16) { - for (xd->sb_index = 0; xd->sb_index < 4; ++xd->sb_index) { - for (xd->mb_index = 0; xd->mb_index < 4; ++xd->mb_index) { - for (xd->b_index = 0; xd->b_index < 16 / num_4x4_blk; ++xd->b_index) { + for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index) { + for (x->mb_index = 0; x->mb_index < 4; ++x->mb_index) { + for (x->b_index = 0; x->b_index < 16 / num_4x4_blk; ++x->b_index) { PICK_MODE_CONTEXT *ctx = get_block_context(x, i); - ctx->num_4x4_blk = num_4x4_blk; - CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, - vpx_calloc(num_4x4_blk, sizeof(uint8_t))); + alloc_mode_context(cm, num_4x4_blk, ctx); } } } } else if (i < BLOCK_32X32) { - for (xd->sb_index = 0; xd->sb_index < 4; ++xd->sb_index) { - for (xd->mb_index = 0; xd->mb_index < 64 / num_4x4_blk; - ++xd->mb_index) { + for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index) { + for (x->mb_index = 0; x->mb_index < 64 / num_4x4_blk; ++x->mb_index) { PICK_MODE_CONTEXT *ctx = get_block_context(x, i); ctx->num_4x4_blk = num_4x4_blk; - CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, - vpx_calloc(num_4x4_blk, sizeof(uint8_t))); + alloc_mode_context(cm, num_4x4_blk, ctx); } } } else if (i < BLOCK_64X64) { - for (xd->sb_index = 0; xd->sb_index < 256 / num_4x4_blk; ++xd->sb_index) { + for (x->sb_index = 0; x->sb_index < 256 / num_4x4_blk; ++x->sb_index) { PICK_MODE_CONTEXT *ctx = get_block_context(x, i); ctx->num_4x4_blk = num_4x4_blk; - CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, - vpx_calloc(num_4x4_blk, sizeof(uint8_t))); + alloc_mode_context(cm, num_4x4_blk, ctx); } } else { PICK_MODE_CONTEXT *ctx = get_block_context(x, i); ctx->num_4x4_blk = num_4x4_blk; - CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, - vpx_calloc(num_4x4_blk, sizeof(uint8_t))); + alloc_mode_context(cm, num_4x4_blk, ctx); } } } static void free_pick_mode_context(MACROBLOCK *x) { int i; - MACROBLOCKD *xd = &x->e_mbd; for (i = 0; i < BLOCK_SIZES; ++i) { const int num_4x4_w = num_4x4_blocks_wide_lookup[i]; const int num_4x4_h = num_4x4_blocks_high_lookup[i]; const int num_4x4_blk = MAX(4, num_4x4_w * num_4x4_h); if (i < BLOCK_16X16) { - for (xd->sb_index = 0; xd->sb_index < 4; ++xd->sb_index) { - for (xd->mb_index = 0; xd->mb_index < 4; ++xd->mb_index) { - for (xd->b_index = 0; xd->b_index < 16 / num_4x4_blk; ++xd->b_index) { + for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index) { + for (x->mb_index = 0; x->mb_index < 4; ++x->mb_index) { + for (x->b_index = 0; x->b_index < 16 / num_4x4_blk; ++x->b_index) { PICK_MODE_CONTEXT *ctx = get_block_context(x, i); - vpx_free(ctx->zcoeff_blk); - ctx->zcoeff_blk = 0; + free_mode_context(ctx); } } } } else if (i < BLOCK_32X32) { - for (xd->sb_index = 0; xd->sb_index < 4; ++xd->sb_index) { - for (xd->mb_index = 0; xd->mb_index < 64 / num_4x4_blk; - ++xd->mb_index) { + for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index) { + for (x->mb_index = 0; x->mb_index < 64 / num_4x4_blk; ++x->mb_index) { PICK_MODE_CONTEXT *ctx = get_block_context(x, i); - vpx_free(ctx->zcoeff_blk); - ctx->zcoeff_blk = 0; + free_mode_context(ctx); } } } else if (i < BLOCK_64X64) { - for (xd->sb_index = 0; xd->sb_index < 256 / num_4x4_blk; ++xd->sb_index) { + for (x->sb_index = 0; x->sb_index < 256 / num_4x4_blk; ++x->sb_index) { PICK_MODE_CONTEXT *ctx = get_block_context(x, i); - vpx_free(ctx->zcoeff_blk); - ctx->zcoeff_blk = 0; + free_mode_context(ctx); } } else { PICK_MODE_CONTEXT *ctx = get_block_context(x, i); - vpx_free(ctx->zcoeff_blk); - ctx->zcoeff_blk = 0; + free_mode_context(ctx); } } } @@ -3404,7 +3436,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, // Post encode loop adjustment of Q prediction. if (!active_worst_qchanged) - vp9_update_rate_correction_factors(cpi, (cpi->sf.recode_loop) ? 2 : 0); + vp9_update_rate_correction_factors(cpi, (cpi->sf.recode_loop || + cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) ? 2 : 0); + cpi->last_q[cm->frame_type] = cm->base_qindex; |