diff options
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/common/vp9_postproc.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemb.c | 65 | ||||
-rw-r--r-- | vp9/encoder/vp9_speed_features.c | 2 | ||||
-rw-r--r-- | vp9/vp9_cx_iface.c | 5 |
4 files changed, 5 insertions, 69 deletions
diff --git a/vp9/common/vp9_postproc.c b/vp9/common/vp9_postproc.c index a3697b9b9..15f6e2c00 100644 --- a/vp9/common/vp9_postproc.c +++ b/vp9/common/vp9_postproc.c @@ -35,7 +35,7 @@ static const int16_t kernel5[] = { static const uint8_t q_diff_thresh = 20; static const uint8_t last_q_thresh = 170; -extern int16_t vpx_rv[]; +extern const int16_t vpx_rv[]; #if CONFIG_VP9_HIGHBITDEPTH void vp9_highbd_post_proc_down_and_across_c(const uint16_t *src_ptr, diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index d533bed86..7375b9014 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -31,9 +31,6 @@ struct optimize_ctx { ENTROPY_CONTEXT tl[MAX_MB_PLANE][16]; }; -#define HETEROMULT 12 -#define HETEROCOEF 4 - void vp9_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { struct macroblock_plane *const p = &x->plane[plane]; const struct macroblockd_plane *const pd = &x->e_mbd.plane[plane]; @@ -70,48 +67,6 @@ static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] ={ {10, 6}, {8, 5}, }; rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);\ } -// This function eliminates isolated small nonzero coefficients. -static void eliminate_small_coeff(const tran_low_t *const coeff_ptr, - const TX_SIZE tx_size, - const int16_t *const zbin_ptr, - tran_low_t *const qcoeff_ptr, - tran_low_t *const dqcoeff_ptr, - uint16_t *const eob_ptr, - const int16_t *const scan) { - const int zbins[2] = - {tx_size == TX_32X32 ? ROUND_POWER_OF_TWO(zbin_ptr[0], 1) : zbin_ptr[0], - tx_size == TX_32X32 ? ROUND_POWER_OF_TWO(zbin_ptr[1], 1) : zbin_ptr[1]}; - const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; - const int hetero_zbins[2] = {(HETEROCOEF + 1) * zbins[0] / HETEROCOEF, - (HETEROCOEF + 1) * zbins[1] / HETEROCOEF}; - const int hetero_nzbins[2] = {hetero_zbins[0] * -1, hetero_zbins[1] * -1}; - int eob = *eob_ptr, i = eob - 1, rc, tail_count = 0; - - assert(i >= 0); - rc = scan[i]; - while (i > 0 && coeff_ptr[rc] <= hetero_zbins[rc != 0] && - coeff_ptr[rc] >= hetero_nzbins[rc != 0]) { - if (coeff_ptr[rc] > zbins[rc != 0] || coeff_ptr[rc] < nzbins[rc != 0]) - ++tail_count; - if ((eob - i) * HETEROMULT >= tail_count * zbins[1]) { - eob = i; - tail_count = 0; - } - --i; - rc = scan[i]; - } - - for (i = eob; i < (*eob_ptr); ++i) { - rc = scan[i]; - qcoeff_ptr[rc] = 0; - dqcoeff_ptr[rc] = 0; - } - - while (eob > 0 && qcoeff_ptr[scan[eob - 1]] == 0) --eob; - - *eob_ptr = eob; -} - // This function is a place holder for now but may ultimately need // to scan previous tokens to work out the correct context. static int trellis_get_coeff_context(const int16_t *scan, @@ -631,10 +586,6 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block, int row, int col, assert(0); break; } - if (!x->skip_block && *eob > 0) { - eliminate_small_coeff(coeff, tx_size, p->zbin, qcoeff, dqcoeff, eob, - scan_order->scan); - } } static void encode_block(int plane, int block, int row, int col, @@ -968,10 +919,6 @@ void vp9_encode_block_intra(int plane, int block, int row, int col, p->quant, p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob, scan_order->scan, scan_order->iscan); - if (!x->skip_block && *eob > 0) { - eliminate_small_coeff(coeff, tx_size, p->zbin, qcoeff, dqcoeff, - eob, scan_order->scan); - } } if (args->enable_coeff_opt && !x->skip_recode) { *a = *l = vp9_optimize_b(x, plane, block, tx_size, entropy_ctx) > 0; @@ -988,10 +935,6 @@ void vp9_encode_block_intra(int plane, int block, int row, int col, p->quant, p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob, scan_order->scan, scan_order->iscan); - if (!x->skip_block && *eob > 0) { - eliminate_small_coeff(coeff, tx_size, p->zbin, qcoeff, dqcoeff, - eob, scan_order->scan); - } } if (args->enable_coeff_opt && !x->skip_recode) { *a = *l = vp9_optimize_b(x, plane, block, tx_size, entropy_ctx) > 0; @@ -1008,10 +951,6 @@ void vp9_encode_block_intra(int plane, int block, int row, int col, p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob, scan_order->scan, scan_order->iscan); - if (!x->skip_block && *eob > 0) { - eliminate_small_coeff(coeff, tx_size, p->zbin, qcoeff, dqcoeff, - eob, scan_order->scan); - } } if (args->enable_coeff_opt && !x->skip_recode) { *a = *l = vp9_optimize_b(x, plane, block, tx_size, entropy_ctx) > 0; @@ -1031,10 +970,6 @@ void vp9_encode_block_intra(int plane, int block, int row, int col, p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob, scan_order->scan, scan_order->iscan); - if (!x->skip_block && *eob > 0) { - eliminate_small_coeff(coeff, tx_size, p->zbin, qcoeff, dqcoeff, - eob, scan_order->scan); - } } if (args->enable_coeff_opt && !x->skip_recode) { *a = *l = vp9_optimize_b(x, plane, block, tx_size, entropy_ctx) > 0; diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index 794daeeef..5ad9df82a 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -546,7 +546,7 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) { sf->adaptive_interp_filter_search = 0; sf->allow_partition_search_skip = 0; sf->txfm_domain_distortion = 0; - sf->quant_coeff_opt = 1; + sf->quant_coeff_opt = sf->optimize_coefficients; for (i = 0; i < TX_SIZES; i++) { sf->intra_y_mode_mask[i] = INTRA_ALL; diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 51c6fbb02..f4e989fb5 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -992,6 +992,7 @@ static vpx_codec_frame_flags_t get_frame_pkt_flags(const VP9_COMP *cpi, return flags; } +const size_t kMinCompressedSize = 8192; static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, const vpx_image_t *img, vpx_codec_pts_t pts, @@ -1013,8 +1014,8 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, // instance for its status to determine the compressed data size. data_sz = ctx->cfg.g_w * ctx->cfg.g_h * get_image_bps(img) / 8 * (cpi->multi_arf_allowed ? 8 : 2); - if (data_sz < 4096) - data_sz = 4096; + if (data_sz < kMinCompressedSize) + data_sz = kMinCompressedSize; if (ctx->cx_data == NULL || ctx->cx_data_sz < data_sz) { ctx->cx_data_sz = data_sz; free(ctx->cx_data); |