diff options
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_encodemb.c | 61 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemv.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_firstpass.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_mbgraph.c | 15 | ||||
-rw-r--r-- | vp9/encoder/vp9_rdopt.c | 18 |
5 files changed, 34 insertions, 66 deletions
diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 76a5d33e7..a610d6340 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -8,16 +8,21 @@ * be found in the AUTHORS file in the root of the source tree. */ + +#include "./vp9_rtcd.h" #include "./vpx_config.h" -#include "vp9/encoder/vp9_encodemb.h" + +#include "vpx_mem/vpx_mem.h" + +#include "vp9/common/vp9_idct.h" #include "vp9/common/vp9_reconinter.h" -#include "vp9/encoder/vp9_quantize.h" -#include "vp9/encoder/vp9_tokenize.h" #include "vp9/common/vp9_reconintra.h" -#include "vpx_mem/vpx_mem.h" -#include "vp9/encoder/vp9_rdopt.h" #include "vp9/common/vp9_systemdependent.h" -#include "vp9_rtcd.h" + +#include "vp9/encoder/vp9_encodemb.h" +#include "vp9/encoder/vp9_quantize.h" +#include "vp9/encoder/vp9_rdopt.h" +#include "vp9/encoder/vp9_tokenize.h" DECLARE_ALIGNED(16, extern const uint8_t, vp9_pt_energy_class[MAX_ENTROPY_TOKENS]); @@ -47,28 +52,6 @@ static void inverse_transform_b_4x4_add(MACROBLOCKD *xd, int eob, xd->inv_txm4x4_add(dqcoeff, dest, stride); } -static void inverse_transform_b_8x8_add(int eob, - int16_t *dqcoeff, uint8_t *dest, - int stride) { - if (eob <= 1) - vp9_short_idct8x8_1_add(dqcoeff, dest, stride); - else if (eob <= 10) - vp9_short_idct8x8_10_add(dqcoeff, dest, stride); - else - vp9_short_idct8x8_add(dqcoeff, dest, stride); -} - -static void inverse_transform_b_16x16_add(int eob, - int16_t *dqcoeff, uint8_t *dest, - int stride) { - if (eob <= 1) - vp9_short_idct16x16_1_add(dqcoeff, dest, stride); - else if (eob <= 10) - vp9_short_idct16x16_10_add(dqcoeff, dest, stride); - else - vp9_short_idct16x16_add(dqcoeff, dest, stride); -} - static void subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { struct macroblock_plane *const p = &x->plane[plane]; const MACROBLOCKD *const xd = &x->e_mbd; @@ -476,12 +459,10 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, vp9_short_idct32x32_add(dqcoeff, dst, pd->dst.stride); break; case TX_16X16: - inverse_transform_b_16x16_add(pd->eobs[block], dqcoeff, dst, - pd->dst.stride); + vp9_idct_add_16x16(dqcoeff, dst, pd->dst.stride, pd->eobs[block]); break; case TX_8X8: - inverse_transform_b_8x8_add(pd->eobs[block], dqcoeff, dst, - pd->dst.stride); + vp9_idct_add_8x8(dqcoeff, dst, pd->dst.stride, pd->eobs[block]); break; case TX_4X4: // this is like vp9_short_idct4x4 but has a special case around eob<=1 @@ -597,12 +578,8 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant, p->quant_shift, qcoeff, dqcoeff, pd->dequant, p->zbin_extra, eob, scan, iscan); - if (!x->skip_encode && *eob) { - if (tx_type == DCT_DCT) - inverse_transform_b_16x16_add(*eob, dqcoeff, dst, pd->dst.stride); - else - vp9_short_iht16x16_add(dqcoeff, dst, pd->dst.stride, tx_type); - } + if (!x->skip_encode && *eob) + vp9_iht_add_16x16(tx_type, dqcoeff, dst, pd->dst.stride, *eob); break; case TX_8X8: tx_type = get_tx_type_8x8(pd->plane_type, xd); @@ -626,12 +603,8 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant, p->quant_shift, qcoeff, dqcoeff, pd->dequant, p->zbin_extra, eob, scan, iscan); - if (!x->skip_encode && *eob) { - if (tx_type == DCT_DCT) - inverse_transform_b_8x8_add(*eob, dqcoeff, dst, pd->dst.stride); - else - vp9_short_iht8x8_add(dqcoeff, dst, pd->dst.stride, tx_type); - } + if (!x->skip_encode && *eob) + vp9_iht_add_8x8(tx_type, dqcoeff, dst, pd->dst.stride, *eob); break; case TX_4X4: tx_type = get_tx_type_4x4(pd->plane_type, xd, block); diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index db08ee856..04a4172a5 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -8,13 +8,13 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <math.h> #include "vp9/common/vp9_common.h" -#include "vp9/encoder/vp9_encodemv.h" #include "vp9/common/vp9_entropymode.h" #include "vp9/common/vp9_systemdependent.h" +#include "vp9/encoder/vp9_encodemv.h" -#include <math.h> #ifdef ENTROPY_STATS extern unsigned int active_section; diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index eaa3bd183..471931349 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -569,7 +569,7 @@ void vp9_first_pass(VP9_COMP *cpi) { mb_row << 1, 1 << mi_height_log2(xd->this_mi->mbmi.sb_type), mb_col << 1, - 1 << mi_height_log2(xd->this_mi->mbmi.sb_type)); + 1 << mi_width_log2(xd->this_mi->mbmi.sb_type)); // do intra 16x16 prediction this_error = vp9_encode_intra(x, use_dc_pred); diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index 0a6576eb5..f83fcc531 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -103,7 +103,8 @@ static int do_16x16_motion_search(VP9_COMP *cpi, int_mv *ref_mv, int_mv *dst_mv, dst_mv->as_int = tmp_mv.as_int; } - // If the current best reference mv is not centred on 0,0 then do a 0,0 based search as well + // If the current best reference mv is not centered on 0,0 then do a 0,0 + // based search as well. if (ref_mv->as_int) { unsigned int tmp_err; int_mv zero_ref_mv, tmp_mv; @@ -217,7 +218,8 @@ static void update_mbgraph_mb_stats stats->ref[GOLDEN_FRAME].m.mv.as_int = 0; } - // Alt-ref frame MV search, if it exists and is different than last/golden frame + // Do an Alt-ref frame MV search, if it exists and is different than + // last/golden frame. if (alt_ref) { int a_motion_error; xd->plane[0].pre[0].buf = alt_ref->y_buffer + mb_y_offset; @@ -246,7 +248,8 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi, int_mv arf_top_mv, gld_top_mv; MODE_INFO mi_local = { { 0 } }; - // Set up limit values for motion vectors to prevent them extending outside the UMV borders + // Set up limit values for motion vectors to prevent them extending outside + // the UMV borders. arf_top_mv.as_int = 0; gld_top_mv.as_int = 0; x->mv_row_min = -BORDER_MV_PIXELS_B16; @@ -266,7 +269,8 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi, int arf_y_in_offset = arf_y_offset; int gld_y_in_offset = gld_y_offset; - // Set up limit values for motion vectors to prevent them extending outside the UMV borders + // Set up limit values for motion vectors to prevent them extending outside + // the UMV borders. arf_left_mv.as_int = arf_top_mv.as_int; gld_left_mv.as_int = gld_top_mv.as_int; x->mv_col_min = -BORDER_MV_PIXELS_B16; @@ -407,7 +411,8 @@ void vp9_update_mbgraph_stats(VP9_COMP *cpi) { for (i = 0; i < n_frames; i++) { MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i]; vpx_memset(frame_stats->mb_stats, 0, - cm->mb_rows * cm->mb_cols * sizeof(*cpi->mbgraph_stats[i].mb_stats)); + cm->mb_rows * cm->mb_cols * + sizeof(*cpi->mbgraph_stats[i].mb_stats)); } // do motion search to find contribution of each reference to data diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 77661e953..26bbc825e 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -4046,7 +4046,6 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, for (i = 0; i < TX_MODES; ++i) tx_cache[i] = tx_cache[ONLY_4X4]; } else { - const int is_comp_pred = second_ref_frame > 0; int rate; int64_t distortion; int64_t this_rd_thresh; @@ -4055,23 +4054,14 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, int64_t tmp_best_distortion = INT_MAX, tmp_best_sse, uv_sse; int tmp_best_skippable = 0; int switchable_filter_index; - int_mv *second_ref = is_comp_pred ? - &mbmi->ref_mvs[second_ref_frame][0] : NULL; + int_mv *second_ref = comp_pred ? + &mbmi->ref_mvs[second_ref_frame][0] : NULL; b_mode_info tmp_best_bmodes[16]; MB_MODE_INFO tmp_best_mbmode; PARTITION_INFO tmp_best_partition; BEST_SEG_INFO bsi[SWITCHABLE_FILTERS]; int pred_exists = 0; int uv_skippable; - if (is_comp_pred) { - if (cpi->sf.mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA) - if (vp9_ref_order[best_mode_index].ref_frame == INTRA_FRAME) - continue; - if (cpi->sf.mode_search_skip_flags & FLAG_SKIP_COMP_REFMISMATCH) - if (ref_frame != best_inter_ref_frame && - second_ref_frame != best_inter_ref_frame) - continue; - } this_rd_thresh = (ref_frame == LAST_FRAME) ? cpi->rd_thresh_sub8x8[bsize][THR_LAST] : @@ -4196,12 +4186,12 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, rate2 += get_switchable_rate(x); if (!mode_excluded) { - if (is_comp_pred) + if (comp_pred) mode_excluded = cpi->common.comp_pred_mode == SINGLE_PREDICTION_ONLY; else mode_excluded = cpi->common.comp_pred_mode == COMP_PREDICTION_ONLY; } - compmode_cost = vp9_cost_bit(comp_mode_p, is_comp_pred); + compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred); tmp_best_rdu = best_rd - MIN(RDCOST(x->rdmult, x->rddiv, rate2, distortion2), |