summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_firstpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder/vp9_firstpass.c')
-rw-r--r--vp9/encoder/vp9_firstpass.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 1b574758b..e21ce2354 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -709,18 +709,11 @@ void vp9_first_pass(VP9_COMP *cpi) {
// intra predication statistics
cpi->twopass.frame_mb_stats_buf[mb_index] = 0;
cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_DCINTRA_MASK;
- cpi->twopass.frame_mb_stats_buf[mb_index] &=
- ~FPMB_NONZERO_MOTION_MASK;
- if (this_error > FPMB_ERROR_LEVEL4_TH) {
- cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_ERROR_LEVEL4_MASK;
- } else if (this_error > FPMB_ERROR_LEVEL3_TH) {
- cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_ERROR_LEVEL3_MASK;
- } else if (this_error > FPMB_ERROR_LEVEL2_TH) {
- cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_ERROR_LEVEL2_MASK;
- } else if (this_error > FPMB_ERROR_LEVEL1_TH) {
- cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_ERROR_LEVEL1_MASK;
- } else {
- cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_ERROR_LEVEL0_MASK;
+ cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_MOTION_ZERO_MASK;
+ if (this_error > FPMB_ERROR_LARGE_TH) {
+ cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_ERROR_LARGE_MASK;
+ } else if (this_error < FPMB_ERROR_SMALL_TH) {
+ cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_ERROR_SMALL_MASK;
}
}
#endif
@@ -758,23 +751,13 @@ void vp9_first_pass(VP9_COMP *cpi) {
// inter predication statistics
cpi->twopass.frame_mb_stats_buf[mb_index] = 0;
cpi->twopass.frame_mb_stats_buf[mb_index] &= ~FPMB_DCINTRA_MASK;
- cpi->twopass.frame_mb_stats_buf[mb_index] &=
- ~FPMB_NONZERO_MOTION_MASK;
- if (this_error > FPMB_ERROR_LEVEL4_TH) {
- cpi->twopass.frame_mb_stats_buf[mb_index] |=
- FPMB_ERROR_LEVEL4_MASK;
- } else if (this_error > FPMB_ERROR_LEVEL3_TH) {
- cpi->twopass.frame_mb_stats_buf[mb_index] |=
- FPMB_ERROR_LEVEL3_MASK;
- } else if (this_error > FPMB_ERROR_LEVEL2_TH) {
+ cpi->twopass.frame_mb_stats_buf[mb_index] |= FPMB_MOTION_ZERO_MASK;
+ if (this_error > FPMB_ERROR_LARGE_TH) {
cpi->twopass.frame_mb_stats_buf[mb_index] |=
- FPMB_ERROR_LEVEL2_MASK;
- } else if (this_error > FPMB_ERROR_LEVEL1_TH) {
+ FPMB_ERROR_LARGE_MASK;
+ } else if (this_error < FPMB_ERROR_SMALL_TH) {
cpi->twopass.frame_mb_stats_buf[mb_index] |=
- FPMB_ERROR_LEVEL1_MASK;
- } else {
- cpi->twopass.frame_mb_stats_buf[mb_index] |=
- FPMB_ERROR_LEVEL0_MASK;
+ FPMB_ERROR_SMALL_MASK;
}
}
#endif
@@ -784,8 +767,28 @@ void vp9_first_pass(VP9_COMP *cpi) {
#if CONFIG_FP_MB_STATS
if (cpi->use_fp_mb_stats) {
- cpi->twopass.frame_mb_stats_buf[mb_index] |=
- FPMB_NONZERO_MOTION_MASK;
+ cpi->twopass.frame_mb_stats_buf[mb_index] &=
+ ~FPMB_MOTION_ZERO_MASK;
+ // check estimated motion direction
+ if (mv.as_mv.col > 0 && mv.as_mv.col >= abs(mv.as_mv.row)) {
+ // right direction
+ cpi->twopass.frame_mb_stats_buf[mb_index] |=
+ FPMB_MOTION_RIGHT_MASK;
+ } else if (mv.as_mv.row < 0 &&
+ abs(mv.as_mv.row) >= abs(mv.as_mv.col)) {
+ // up direction
+ cpi->twopass.frame_mb_stats_buf[mb_index] |=
+ FPMB_MOTION_UP_MASK;
+ } else if (mv.as_mv.col < 0 &&
+ abs(mv.as_mv.col) >= abs(mv.as_mv.row)) {
+ // left direction
+ cpi->twopass.frame_mb_stats_buf[mb_index] |=
+ FPMB_MOTION_LEFT_MASK;
+ } else {
+ // down direction
+ cpi->twopass.frame_mb_stats_buf[mb_index] |=
+ FPMB_MOTION_DOWN_MASK;
+ }
}
#endif