summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_blockd.h2
-rw-r--r--vp9/decoder/vp9_idct_blk.h11
-rw-r--r--vp9/encoder/vp9_encodeframe.c16
-rw-r--r--vp9/encoder/vp9_encodemv.c52
-rw-r--r--vp9/encoder/vp9_encodemv.h4
5 files changed, 37 insertions, 48 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index f7d5de1f4..9ab2cc31b 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -247,7 +247,7 @@ typedef struct macroblockd {
} MACROBLOCKD;
-static INLINE unsigned char *get_sb_index(MACROBLOCKD *xd, BLOCK_SIZE subsize) {
+static INLINE uint8_t *get_sb_index(MACROBLOCKD *xd, BLOCK_SIZE subsize) {
switch (subsize) {
case BLOCK_64X64:
case BLOCK_64X32:
diff --git a/vp9/decoder/vp9_idct_blk.h b/vp9/decoder/vp9_idct_blk.h
index 1810bd02f..00f1bc6a6 100644
--- a/vp9/decoder/vp9_idct_blk.h
+++ b/vp9/decoder/vp9_idct_blk.h
@@ -14,17 +14,16 @@
#include "vp9/common/vp9_blockd.h"
+void vp9_idct_add_lossless_c(int16_t *input, uint8_t *dest,
+ int stride, int eob);
-void vp9_idct_add_lossless_c(int16_t *input, unsigned char *dest, int stride,
- int eob);
-
-void vp9_iht_add_c(TX_TYPE tx_type, int16_t *input, unsigned char *dest,
+void vp9_iht_add_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest,
int stride, int eob);
-void vp9_iht_add_8x8_c(TX_TYPE tx_type, int16_t *input, unsigned char *dest,
+void vp9_iht_add_8x8_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest,
int stride, int eob);
-void vp9_iht_add_16x16_c(TX_TYPE tx_type, int16_t *input, unsigned char *dest,
+void vp9_iht_add_16x16_c(TX_TYPE tx_type, int16_t *input, uint8_t *dest,
int stride, int eob);
#endif // VP9_DECODER_VP9_IDCT_BLK_H_
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 90a584e6e..fd3341b0b 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -431,19 +431,19 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
cpi->mode_chosen_counts[mb_mode_index]++;
if (is_inter_block(mbmi)
&& (mbmi->sb_type < BLOCK_8X8 || mbmi->mode == NEWMV)) {
- int_mv best_mv, best_second_mv;
+ int_mv best_mv[2];
const MV_REFERENCE_FRAME rf1 = mbmi->ref_frame[0];
const MV_REFERENCE_FRAME rf2 = mbmi->ref_frame[1];
- best_mv.as_int = ctx->best_ref_mv.as_int;
- best_second_mv.as_int = ctx->second_best_ref_mv.as_int;
+ best_mv[0].as_int = ctx->best_ref_mv.as_int;
+ best_mv[1].as_int = ctx->second_best_ref_mv.as_int;
if (mbmi->mode == NEWMV) {
- best_mv.as_int = mbmi->ref_mvs[rf1][0].as_int;
+ best_mv[0].as_int = mbmi->ref_mvs[rf1][0].as_int;
if (rf2 > 0)
- best_second_mv.as_int = mbmi->ref_mvs[rf2][0].as_int;
+ best_mv[1].as_int = mbmi->ref_mvs[rf2][0].as_int;
}
- mbmi->best_mv[0].as_int = best_mv.as_int;
- mbmi->best_mv[1].as_int = best_second_mv.as_int;
- vp9_update_nmv_count(cpi, x, &best_mv, &best_second_mv);
+ mbmi->best_mv[0].as_int = best_mv[0].as_int;
+ mbmi->best_mv[1].as_int = best_mv[1].as_int;
+ vp9_update_mv_count(cpi, x, best_mv);
}
if (cm->mcomp_filter_type == SWITCHABLE && is_inter_mode(mbmi->mode)) {
diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c
index ed3a2bb64..db08ee856 100644
--- a/vp9/encoder/vp9_encodemv.c
+++ b/vp9/encoder/vp9_encodemv.c
@@ -314,44 +314,34 @@ void vp9_build_nmv_cost_table(int *mvjoint,
build_nmv_component_cost_table(mvcost[1], &mvctx->comps[1], usehp);
}
-void vp9_update_nmv_count(VP9_COMP *cpi, MACROBLOCK *x,
- int_mv *best_ref_mv, int_mv *second_best_ref_mv) {
+static void inc_mvs(int_mv mv[2], int_mv ref[2], int is_compound,
+ nmv_context_counts *counts) {
+ int i;
+ for (i = 0; i < 1 + is_compound; ++i) {
+ const MV diff = { mv[i].as_mv.row - ref[i].as_mv.row,
+ mv[i].as_mv.col - ref[i].as_mv.col };
+ vp9_inc_mv(&diff, counts);
+ }
+}
+
+void vp9_update_mv_count(VP9_COMP *cpi, MACROBLOCK *x, int_mv best_ref_mv[2]) {
MODE_INFO *mi = x->e_mbd.mi_8x8[0];
MB_MODE_INFO *const mbmi = &mi->mbmi;
- MV diff;
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mbmi->sb_type];
- int idx, idy;
+ const int is_compound = has_second_ref(mbmi);
if (mbmi->sb_type < BLOCK_8X8) {
- PARTITION_INFO *pi = x->partition_info;
- for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
- for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
+ const int num_4x4_w = num_4x4_blocks_wide_lookup[mbmi->sb_type];
+ const int num_4x4_h = num_4x4_blocks_high_lookup[mbmi->sb_type];
+ int idx, idy;
+
+ for (idy = 0; idy < 2; idy += num_4x4_h) {
+ for (idx = 0; idx < 2; idx += num_4x4_w) {
const int i = idy * 2 + idx;
- if (pi->bmi[i].mode == NEWMV) {
- diff.row = mi->bmi[i].as_mv[0].as_mv.row - best_ref_mv->as_mv.row;
- diff.col = mi->bmi[i].as_mv[0].as_mv.col - best_ref_mv->as_mv.col;
- vp9_inc_mv(&diff, &cpi->NMVcount);
-
- if (mi->mbmi.ref_frame[1] > INTRA_FRAME) {
- diff.row = mi->bmi[i].as_mv[1].as_mv.row -
- second_best_ref_mv->as_mv.row;
- diff.col = mi->bmi[i].as_mv[1].as_mv.col -
- second_best_ref_mv->as_mv.col;
- vp9_inc_mv(&diff, &cpi->NMVcount);
- }
- }
+ if (x->partition_info->bmi[i].mode == NEWMV)
+ inc_mvs(mi->bmi[i].as_mv, best_ref_mv, is_compound, &cpi->NMVcount);
}
}
} else if (mbmi->mode == NEWMV) {
- diff.row = mbmi->mv[0].as_mv.row - best_ref_mv->as_mv.row;
- diff.col = mbmi->mv[0].as_mv.col - best_ref_mv->as_mv.col;
- vp9_inc_mv(&diff, &cpi->NMVcount);
-
- if (mbmi->ref_frame[1] > INTRA_FRAME) {
- diff.row = mbmi->mv[1].as_mv.row - second_best_ref_mv->as_mv.row;
- diff.col = mbmi->mv[1].as_mv.col - second_best_ref_mv->as_mv.col;
- vp9_inc_mv(&diff, &cpi->NMVcount);
- }
+ inc_mvs(mbmi->mv, best_ref_mv, is_compound, &cpi->NMVcount);
}
}
diff --git a/vp9/encoder/vp9_encodemv.h b/vp9/encoder/vp9_encodemv.h
index 2789ce114..633177885 100644
--- a/vp9/encoder/vp9_encodemv.h
+++ b/vp9/encoder/vp9_encodemv.h
@@ -25,7 +25,7 @@ void vp9_build_nmv_cost_table(int *mvjoint,
int usehp,
int mvc_flag_v,
int mvc_flag_h);
-void vp9_update_nmv_count(VP9_COMP *cpi, MACROBLOCK *x,
- int_mv *best_ref_mv, int_mv *second_best_ref_mv);
+
+void vp9_update_mv_count(VP9_COMP *cpi, MACROBLOCK *x, int_mv best_ref_mv[2]);
#endif // VP9_ENCODER_VP9_ENCODEMV_H_