Store first pass motion vector directions
Re-organize the one-byte structure for 16x16 first pass block. Add bits to indicate motion vector directions. Change-Id: Id10754ba343dfc712c7fed5bcc85c67fa0bbcb89
This commit is contained in:
parent
a3b062c56f
commit
233e0ccc73
@ -2087,10 +2087,10 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
|
||||
for (r = mb_row; r < mb_row_end; r++) {
|
||||
for (c = mb_col; c < mb_col_end; c++) {
|
||||
const int mb_index = r * cm->mb_cols + c;
|
||||
if ((cpi->twopass.this_frame_mb_stats[mb_index] &
|
||||
FPMB_NONZERO_MOTION_MASK) ||
|
||||
if (!(cpi->twopass.this_frame_mb_stats[mb_index] &
|
||||
FPMB_MOTION_ZERO_MASK) ||
|
||||
!(cpi->twopass.this_frame_mb_stats[mb_index] &
|
||||
FPMB_ERROR_LEVEL0_MASK)) {
|
||||
FPMB_ERROR_SMALL_MASK)) {
|
||||
skip = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -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_MOTION_ZERO_MASK;
|
||||
if (this_error > FPMB_ERROR_LARGE_TH) {
|
||||
cpi->twopass.frame_mb_stats_buf[mb_index] |=
|
||||
FPMB_ERROR_LEVEL4_MASK;
|
||||
} else if (this_error > FPMB_ERROR_LEVEL3_TH) {
|
||||
FPMB_ERROR_LARGE_MASK;
|
||||
} else if (this_error < FPMB_ERROR_SMALL_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;
|
||||
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
|
||||
|
||||
|
@ -21,17 +21,17 @@ extern "C" {
|
||||
#if CONFIG_FP_MB_STATS
|
||||
|
||||
#define FPMB_DCINTRA_MASK 0x01
|
||||
#define FPMB_NONZERO_MOTION_MASK 0x02
|
||||
#define FPMB_ERROR_LEVEL0_MASK 0x04
|
||||
#define FPMB_ERROR_LEVEL1_MASK 0x10
|
||||
#define FPMB_ERROR_LEVEL2_MASK 0x20
|
||||
#define FPMB_ERROR_LEVEL3_MASK 0x40
|
||||
#define FPMB_ERROR_LEVEL4_MASK 0x80
|
||||
|
||||
#define FPMB_ERROR_LEVEL1_TH 2000
|
||||
#define FPMB_ERROR_LEVEL2_TH 8000
|
||||
#define FPMB_ERROR_LEVEL3_TH 24000
|
||||
#define FPMB_ERROR_LEVEL4_TH 48000
|
||||
#define FPMB_MOTION_ZERO_MASK 0x02
|
||||
#define FPMB_MOTION_LEFT_MASK 0x04
|
||||
#define FPMB_MOTION_RIGHT_MASK 0x08
|
||||
#define FPMB_MOTION_UP_MASK 0x10
|
||||
#define FPMB_MOTION_DOWN_MASK 0x20
|
||||
|
||||
#define FPMB_ERROR_SMALL_MASK 0x40
|
||||
#define FPMB_ERROR_LARGE_MASK 0x80
|
||||
#define FPMB_ERROR_SMALL_TH 2000
|
||||
#define FPMB_ERROR_LARGE_TH 48000
|
||||
|
||||
typedef struct {
|
||||
uint8_t *mb_stats_start;
|
||||
|
Loading…
Reference in New Issue
Block a user