VP8: Fix out of range index for mvcost.
Clamp index between 0 and MVvals. Bit exact for speed -8, -6 and -4 on RTC set. BUG=b/72510002 Change-Id: I61bdb02a0924e157b3c1980f74fbbfe5ce51bc44
This commit is contained in:
parent
2640f25072
commit
ca28740570
@ -34,19 +34,22 @@ int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight) {
|
|||||||
* NEAREST for subsequent blocks. The "Weight" parameter allows, to a
|
* NEAREST for subsequent blocks. The "Weight" parameter allows, to a
|
||||||
* limited extent, for some account to be taken of these factors.
|
* limited extent, for some account to be taken of these factors.
|
||||||
*/
|
*/
|
||||||
return ((mvcost[0][(mv->as_mv.row - ref->as_mv.row) >> 1] +
|
const int mv_idx_row =
|
||||||
mvcost[1][(mv->as_mv.col - ref->as_mv.col) >> 1]) *
|
clamp((mv->as_mv.row - ref->as_mv.row) >> 1, 0, MVvals);
|
||||||
Weight) >>
|
const int mv_idx_col =
|
||||||
7;
|
clamp((mv->as_mv.col - ref->as_mv.col) >> 1, 0, MVvals);
|
||||||
|
return ((mvcost[0][mv_idx_row] + mvcost[1][mv_idx_col]) * Weight) >> 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mv_err_cost(int_mv *mv, int_mv *ref, int *mvcost[2],
|
static int mv_err_cost(int_mv *mv, int_mv *ref, int *mvcost[2],
|
||||||
int error_per_bit) {
|
int error_per_bit) {
|
||||||
/* Ignore mv costing if mvcost is NULL */
|
/* Ignore mv costing if mvcost is NULL */
|
||||||
if (mvcost) {
|
if (mvcost) {
|
||||||
return ((mvcost[0][(mv->as_mv.row - ref->as_mv.row) >> 1] +
|
const int mv_idx_row =
|
||||||
mvcost[1][(mv->as_mv.col - ref->as_mv.col) >> 1]) *
|
clamp((mv->as_mv.row - ref->as_mv.row) >> 1, 0, MVvals);
|
||||||
error_per_bit +
|
const int mv_idx_col =
|
||||||
|
clamp((mv->as_mv.col - ref->as_mv.col) >> 1, 0, MVvals);
|
||||||
|
return ((mvcost[0][mv_idx_row] + mvcost[1][mv_idx_col]) * error_per_bit +
|
||||||
128) >>
|
128) >>
|
||||||
8;
|
8;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user