Merge remote branch 'origin/master' into experimental
Change-Id: Iaca87acc9726b5173d638528684d154538ec01e6
This commit is contained in:
Коммит
728886fae9
|
@ -15,6 +15,7 @@
|
|||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include "vp8/common/findnearmv.h"
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
static int mv_ref_ct [31] [4] [2];
|
||||
|
@ -342,12 +343,26 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
int bestmse = INT_MAX;
|
||||
int_mv startmv;
|
||||
int_mv this_mv;
|
||||
unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
|
||||
unsigned char *z = (*(b->base_src) + b->src);
|
||||
int left, right, up, down, diag;
|
||||
unsigned int sse;
|
||||
int whichdir ;
|
||||
int thismse;
|
||||
int y_stride;
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
MACROBLOCKD *xd = &x->e_mbd;
|
||||
unsigned char *y0 = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
|
||||
unsigned char *y;
|
||||
|
||||
y_stride = 32;
|
||||
/* Copy 18 rows x 32 cols area to intermediate buffer before searching. */
|
||||
vfp->copymem(y0 - 1 - d->pre_stride, d->pre_stride, xd->y_buf, y_stride, 18);
|
||||
y = xd->y_buf + y_stride + 1;
|
||||
#else
|
||||
unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
|
||||
y_stride = d->pre_stride;
|
||||
#endif
|
||||
|
||||
// central mv
|
||||
bestmv->as_mv.row <<= 3;
|
||||
|
@ -355,14 +370,14 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
startmv = *bestmv;
|
||||
|
||||
// calculate central point error
|
||||
bestmse = vfp->vf(y, d->pre_stride, z, b->src_stride, sse1);
|
||||
bestmse = vfp->vf(y, y_stride, z, b->src_stride, sse1);
|
||||
*distortion = bestmse;
|
||||
bestmse += mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
// go left then right and check error
|
||||
this_mv.as_mv.row = startmv.as_mv.row;
|
||||
this_mv.as_mv.col = ((startmv.as_mv.col - 8) | 4);
|
||||
thismse = vfp->svf_halfpix_h(y - 1, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_h(y - 1, y_stride, z, b->src_stride, &sse);
|
||||
left = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (left < bestmse)
|
||||
|
@ -374,7 +389,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
}
|
||||
|
||||
this_mv.as_mv.col += 8;
|
||||
thismse = vfp->svf_halfpix_h(y, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_h(y, y_stride, z, b->src_stride, &sse);
|
||||
right = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (right < bestmse)
|
||||
|
@ -388,7 +403,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
// go up then down and check error
|
||||
this_mv.as_mv.col = startmv.as_mv.col;
|
||||
this_mv.as_mv.row = ((startmv.as_mv.row - 8) | 4);
|
||||
thismse = vfp->svf_halfpix_v(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_v(y - y_stride, y_stride, z, b->src_stride, &sse);
|
||||
up = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (up < bestmse)
|
||||
|
@ -400,7 +415,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
}
|
||||
|
||||
this_mv.as_mv.row += 8;
|
||||
thismse = vfp->svf_halfpix_v(y, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_v(y, y_stride, z, b->src_stride, &sse);
|
||||
down = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (down < bestmse)
|
||||
|
@ -423,23 +438,23 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
case 0:
|
||||
this_mv.as_mv.col = (this_mv.as_mv.col - 8) | 4;
|
||||
this_mv.as_mv.row = (this_mv.as_mv.row - 8) | 4;
|
||||
thismse = vfp->svf_halfpix_hv(y - 1 - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_hv(y - 1 - y_stride, y_stride, z, b->src_stride, &sse);
|
||||
break;
|
||||
case 1:
|
||||
this_mv.as_mv.col += 4;
|
||||
this_mv.as_mv.row = (this_mv.as_mv.row - 8) | 4;
|
||||
thismse = vfp->svf_halfpix_hv(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_hv(y - y_stride, y_stride, z, b->src_stride, &sse);
|
||||
break;
|
||||
case 2:
|
||||
this_mv.as_mv.col = (this_mv.as_mv.col - 8) | 4;
|
||||
this_mv.as_mv.row += 4;
|
||||
thismse = vfp->svf_halfpix_hv(y - 1, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_hv(y - 1, y_stride, z, b->src_stride, &sse);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
this_mv.as_mv.col += 4;
|
||||
this_mv.as_mv.row += 4;
|
||||
thismse = vfp->svf_halfpix_hv(y, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_hv(y, y_stride, z, b->src_stride, &sse);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -458,7 +473,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
|
||||
// time to check quarter pels.
|
||||
if (bestmv->as_mv.row < startmv.as_mv.row)
|
||||
y -= d->pre_stride;
|
||||
y -= y_stride;
|
||||
|
||||
if (bestmv->as_mv.col < startmv.as_mv.col)
|
||||
y--;
|
||||
|
@ -473,12 +488,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
if (startmv.as_mv.col & 7)
|
||||
{
|
||||
this_mv.as_mv.col = startmv.as_mv.col - 2;
|
||||
thismse = vfp->svf(y, d->pre_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
}
|
||||
else
|
||||
{
|
||||
this_mv.as_mv.col = (startmv.as_mv.col - 8) | 6;
|
||||
thismse = vfp->svf(y - 1, d->pre_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y - 1, y_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
}
|
||||
|
||||
left = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
@ -492,7 +507,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
}
|
||||
|
||||
this_mv.as_mv.col += 4;
|
||||
thismse = vfp->svf(y, d->pre_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
right = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (right < bestmse)
|
||||
|
@ -509,12 +524,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
if (startmv.as_mv.row & 7)
|
||||
{
|
||||
this_mv.as_mv.row = startmv.as_mv.row - 2;
|
||||
thismse = vfp->svf(y, d->pre_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
}
|
||||
else
|
||||
{
|
||||
this_mv.as_mv.row = (startmv.as_mv.row - 8) | 6;
|
||||
thismse = vfp->svf(y - d->pre_stride, d->pre_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y - y_stride, y_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
|
||||
}
|
||||
|
||||
up = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
@ -528,7 +543,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
}
|
||||
|
||||
this_mv.as_mv.row += 4;
|
||||
thismse = vfp->svf(y, d->pre_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
down = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (down < bestmse)
|
||||
|
@ -558,12 +573,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
if (startmv.as_mv.col & 7)
|
||||
{
|
||||
this_mv.as_mv.col -= 2;
|
||||
thismse = vfp->svf(y, d->pre_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
}
|
||||
else
|
||||
{
|
||||
this_mv.as_mv.col = (startmv.as_mv.col - 8) | 6;
|
||||
thismse = vfp->svf(y - 1, d->pre_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);;
|
||||
thismse = vfp->svf(y - 1, y_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -573,12 +588,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
if (startmv.as_mv.col & 7)
|
||||
{
|
||||
this_mv.as_mv.col -= 2;
|
||||
thismse = vfp->svf(y - d->pre_stride, d->pre_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y - y_stride, y_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
|
||||
}
|
||||
else
|
||||
{
|
||||
this_mv.as_mv.col = (startmv.as_mv.col - 8) | 6;
|
||||
thismse = vfp->svf(y - d->pre_stride - 1, d->pre_stride, 6, 6, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y - y_stride - 1, y_stride, 6, 6, z, b->src_stride, &sse);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,12 +604,12 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
if (startmv.as_mv.row & 7)
|
||||
{
|
||||
this_mv.as_mv.row -= 2;
|
||||
thismse = vfp->svf(y, d->pre_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
}
|
||||
else
|
||||
{
|
||||
this_mv.as_mv.row = (startmv.as_mv.row - 8) | 6;
|
||||
thismse = vfp->svf(y - d->pre_stride, d->pre_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y - y_stride, y_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -604,19 +619,19 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
if (startmv.as_mv.col & 7)
|
||||
{
|
||||
this_mv.as_mv.col -= 2;
|
||||
thismse = vfp->svf(y, d->pre_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
}
|
||||
else
|
||||
{
|
||||
this_mv.as_mv.col = (startmv.as_mv.col - 8) | 6;
|
||||
thismse = vfp->svf(y - 1, d->pre_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y - 1, y_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
this_mv.as_mv.col += 2;
|
||||
this_mv.as_mv.row += 2;
|
||||
thismse = vfp->svf(y, d->pre_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -633,7 +648,7 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
|||
return bestmse;
|
||||
}
|
||||
|
||||
int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
||||
int vp8_find_best_half_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
||||
int_mv *bestmv, int_mv *ref_mv,
|
||||
int error_per_bit,
|
||||
const vp8_variance_fn_ptr_t *vfp,
|
||||
|
@ -643,11 +658,25 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
int bestmse = INT_MAX;
|
||||
int_mv startmv;
|
||||
int_mv this_mv;
|
||||
unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
|
||||
unsigned char *z = (*(b->base_src) + b->src);
|
||||
int left, right, up, down, diag;
|
||||
unsigned int sse;
|
||||
int thismse;
|
||||
int y_stride;
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
MACROBLOCKD *xd = &x->e_mbd;
|
||||
unsigned char *y0 = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
|
||||
unsigned char *y;
|
||||
|
||||
y_stride = 32;
|
||||
/* Copy 18 rows x 32 cols area to intermediate buffer before searching. */
|
||||
vfp->copymem(y0 - 1 - d->pre_stride, d->pre_stride, xd->y_buf, y_stride, 18);
|
||||
y = xd->y_buf + y_stride + 1;
|
||||
#else
|
||||
unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col;
|
||||
y_stride = d->pre_stride;
|
||||
#endif
|
||||
|
||||
// central mv
|
||||
bestmv->as_mv.row <<= 3;
|
||||
|
@ -655,14 +684,14 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
startmv = *bestmv;
|
||||
|
||||
// calculate central point error
|
||||
bestmse = vfp->vf(y, d->pre_stride, z, b->src_stride, sse1);
|
||||
bestmse = vfp->vf(y, y_stride, z, b->src_stride, sse1);
|
||||
*distortion = bestmse;
|
||||
bestmse += mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
// go left then right and check error
|
||||
this_mv.as_mv.row = startmv.as_mv.row;
|
||||
this_mv.as_mv.col = ((startmv.as_mv.col - 8) | 4);
|
||||
thismse = vfp->svf_halfpix_h(y - 1, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_h(y - 1, y_stride, z, b->src_stride, &sse);
|
||||
left = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (left < bestmse)
|
||||
|
@ -674,7 +703,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
}
|
||||
|
||||
this_mv.as_mv.col += 8;
|
||||
thismse = vfp->svf_halfpix_h(y, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_h(y, y_stride, z, b->src_stride, &sse);
|
||||
right = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (right < bestmse)
|
||||
|
@ -688,7 +717,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
// go up then down and check error
|
||||
this_mv.as_mv.col = startmv.as_mv.col;
|
||||
this_mv.as_mv.row = ((startmv.as_mv.row - 8) | 4);
|
||||
thismse = vfp->svf_halfpix_v(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_v(y - y_stride, y_stride, z, b->src_stride, &sse);
|
||||
up = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (up < bestmse)
|
||||
|
@ -700,7 +729,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
}
|
||||
|
||||
this_mv.as_mv.row += 8;
|
||||
thismse = vfp->svf_halfpix_v(y, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_v(y, y_stride, z, b->src_stride, &sse);
|
||||
down = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (down < bestmse)
|
||||
|
@ -722,22 +751,22 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
case 0:
|
||||
this_mv.col = (this_mv.col - 8) | 4;
|
||||
this_mv.row = (this_mv.row - 8) | 4;
|
||||
diag = vfp->svf(y - 1 - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);
|
||||
diag = vfp->svf(y - 1 - y_stride, y_stride, 4, 4, z, b->src_stride, &sse);
|
||||
break;
|
||||
case 1:
|
||||
this_mv.col += 4;
|
||||
this_mv.row = (this_mv.row - 8) | 4;
|
||||
diag = vfp->svf(y - d->pre_stride, d->pre_stride, 4, 4, z, b->src_stride, &sse);
|
||||
diag = vfp->svf(y - y_stride, y_stride, 4, 4, z, b->src_stride, &sse);
|
||||
break;
|
||||
case 2:
|
||||
this_mv.col = (this_mv.col - 8) | 4;
|
||||
this_mv.row += 4;
|
||||
diag = vfp->svf(y - 1, d->pre_stride, 4, 4, z, b->src_stride, &sse);
|
||||
diag = vfp->svf(y - 1, y_stride, 4, 4, z, b->src_stride, &sse);
|
||||
break;
|
||||
case 3:
|
||||
this_mv.col += 4;
|
||||
this_mv.row += 4;
|
||||
diag = vfp->svf(y, d->pre_stride, 4, 4, z, b->src_stride, &sse);
|
||||
diag = vfp->svf(y, y_stride, 4, 4, z, b->src_stride, &sse);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -752,7 +781,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
#else
|
||||
this_mv.as_mv.col = (this_mv.as_mv.col - 8) | 4;
|
||||
this_mv.as_mv.row = (this_mv.as_mv.row - 8) | 4;
|
||||
thismse = vfp->svf_halfpix_hv(y - 1 - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_hv(y - 1 - y_stride, y_stride, z, b->src_stride, &sse);
|
||||
diag = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (diag < bestmse)
|
||||
|
@ -764,7 +793,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
}
|
||||
|
||||
this_mv.as_mv.col += 8;
|
||||
thismse = vfp->svf_halfpix_hv(y - d->pre_stride, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_hv(y - y_stride, y_stride, z, b->src_stride, &sse);
|
||||
diag = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (diag < bestmse)
|
||||
|
@ -777,7 +806,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
|
||||
this_mv.as_mv.col = (this_mv.as_mv.col - 8) | 4;
|
||||
this_mv.as_mv.row = startmv.as_mv.row + 4;
|
||||
thismse = vfp->svf_halfpix_hv(y - 1, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_hv(y - 1, y_stride, z, b->src_stride, &sse);
|
||||
diag = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (diag < bestmse)
|
||||
|
@ -789,7 +818,7 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
|
|||
}
|
||||
|
||||
this_mv.as_mv.col += 8;
|
||||
thismse = vfp->svf_halfpix_hv(y, d->pre_stride, z, b->src_stride, &sse);
|
||||
thismse = vfp->svf_halfpix_hv(y, y_stride, z, b->src_stride, &sse);
|
||||
diag = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
|
||||
|
||||
if (diag < bestmse)
|
||||
|
@ -866,7 +895,7 @@ int vp8_hex_search
|
|||
unsigned char *what = (*(b->base_src) + b->src);
|
||||
int what_stride = b->src_stride;
|
||||
int in_what_stride = d->pre_stride;
|
||||
int br = ref_mv->as_mv.row, bc = ref_mv->as_mv.col;
|
||||
int br, bc;
|
||||
int_mv this_mv;
|
||||
unsigned int bestsad = 0x7fffffff;
|
||||
unsigned int thissad;
|
||||
|
@ -880,6 +909,11 @@ int vp8_hex_search
|
|||
fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
|
||||
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
|
||||
|
||||
// adjust ref_mv to make sure it is within MV range
|
||||
vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
|
||||
br = ref_mv->as_mv.row;
|
||||
bc = ref_mv->as_mv.col;
|
||||
|
||||
// Work out the start point for the search
|
||||
base_offset = (unsigned char *)(*(d->base_pre) + d->pre);
|
||||
this_offset = base_offset + (br * (d->pre_stride)) + bc;
|
||||
|
@ -1043,8 +1077,8 @@ int vp8_diamond_search_sad
|
|||
int best_site = 0;
|
||||
int last_site = 0;
|
||||
|
||||
int ref_row = ref_mv->as_mv.row;
|
||||
int ref_col = ref_mv->as_mv.col;
|
||||
int ref_row;
|
||||
int ref_col;
|
||||
int this_row_offset;
|
||||
int this_col_offset;
|
||||
search_site *ss;
|
||||
|
@ -1057,8 +1091,10 @@ int vp8_diamond_search_sad
|
|||
fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
|
||||
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
|
||||
|
||||
vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
|
||||
ref_row = ref_mv->as_mv.row;
|
||||
ref_col = ref_mv->as_mv.col;
|
||||
*num00 = 0;
|
||||
|
||||
best_mv->as_mv.row = ref_row;
|
||||
best_mv->as_mv.col = ref_col;
|
||||
|
||||
|
@ -1162,8 +1198,8 @@ int vp8_diamond_search_sadx4
|
|||
int best_site = 0;
|
||||
int last_site = 0;
|
||||
|
||||
int ref_row = ref_mv->as_mv.row;
|
||||
int ref_col = ref_mv->as_mv.col;
|
||||
int ref_row;
|
||||
int ref_col;
|
||||
int this_row_offset;
|
||||
int this_col_offset;
|
||||
search_site *ss;
|
||||
|
@ -1176,6 +1212,9 @@ int vp8_diamond_search_sadx4
|
|||
fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
|
||||
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
|
||||
|
||||
vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
|
||||
ref_row = ref_mv->as_mv.row;
|
||||
ref_col = ref_mv->as_mv.col;
|
||||
*num00 = 0;
|
||||
best_mv->as_mv.row = ref_row;
|
||||
best_mv->as_mv.col = ref_col;
|
||||
|
|
|
@ -669,8 +669,6 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
|
|||
mvp_full.as_mv.col = mvp.as_mv.col>>3;
|
||||
mvp_full.as_mv.row = mvp.as_mv.row>>3;
|
||||
|
||||
/* adjust mvp to make sure it is within MV range */
|
||||
vp8_clamp_mv(&mvp_full, col_min, col_max, row_min, row_max);
|
||||
}else
|
||||
{
|
||||
mvp.as_int = best_ref_mv.as_int;
|
||||
|
|
|
@ -1249,6 +1249,9 @@ static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x,
|
|||
// Should we do a full search (best quality only)
|
||||
if ((cpi->compressor_speed == 0) && (bestsme >> sseshift) > 4000)
|
||||
{
|
||||
/* Check if mvp_full is within the range. */
|
||||
vp8_clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
|
||||
|
||||
thissme = cpi->full_search_sad(x, c, e, &mvp_full,
|
||||
sadpb, 16, v_fn_ptr,
|
||||
x->mvcost, bsi->ref_mv);
|
||||
|
@ -2084,9 +2087,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
|
|||
mvp_full.as_mv.col = mvp.as_mv.col>>3;
|
||||
mvp_full.as_mv.row = mvp.as_mv.row>>3;
|
||||
|
||||
/* adjust mvp to make sure it is within MV range */
|
||||
vp8_clamp_mv(&mvp_full, col_min, col_max, row_min, row_max);
|
||||
|
||||
// Get intersection of UMV window and valid MV window to reduce # of checks in diamond search.
|
||||
if (x->mv_col_min < col_min )
|
||||
x->mv_col_min = col_min;
|
||||
|
|
11
vpxenc.c
11
vpxenc.c
|
@ -538,7 +538,7 @@ void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, int buffer_size, un
|
|||
}
|
||||
#undef WRITE_BUFFER
|
||||
|
||||
/* Need a fixed size serializer for the track ID. libmkv provdes a 64 bit
|
||||
/* Need a fixed size serializer for the track ID. libmkv provides a 64 bit
|
||||
* one, but not a 32 bit one.
|
||||
*/
|
||||
static void Ebml_SerializeUnsigned32(EbmlGlobal *glob, unsigned long class_id, uint64_t ui)
|
||||
|
@ -555,7 +555,7 @@ Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc,
|
|||
unsigned long class_id)
|
||||
{
|
||||
//todo this is always taking 8 bytes, this may need later optimization
|
||||
//this is a key that says lenght unknown
|
||||
//this is a key that says length unknown
|
||||
uint64_t unknownLen = LITERALU64(0x01FFFFFFFFFFFFFF);
|
||||
|
||||
Ebml_WriteID(glob, class_id);
|
||||
|
@ -971,7 +971,7 @@ static const struct arg_enum_list stereo_mode_enum[] = {
|
|||
static const arg_def_t stereo_mode = ARG_DEF_ENUM(NULL, "stereo-mode", 1,
|
||||
"Stereo 3D video format", stereo_mode_enum);
|
||||
static const arg_def_t timebase = ARG_DEF(NULL, "timebase", 1,
|
||||
"Stream timebase (frame duration)");
|
||||
"Stream timebase (see below)");
|
||||
static const arg_def_t error_resilient = ARG_DEF(NULL, "error-resilient", 1,
|
||||
"Enable error resiliency features");
|
||||
static const arg_def_t lag_in_frames = ARG_DEF(NULL, "lag-in-frames", 1,
|
||||
|
@ -1127,6 +1127,9 @@ static void usage_exit()
|
|||
fprintf(stderr, "\nVP8 Specific Options:\n");
|
||||
arg_show_usage(stdout, vp8_args);
|
||||
#endif
|
||||
fprintf(stderr, "\nStream timebase (--timebase):\n"
|
||||
" This is the unit of time used to represent frame timestamps,\n"
|
||||
" in fractional seconds. Default is 1/1000.\n");
|
||||
fprintf(stderr, "\n"
|
||||
"Included encoders:\n"
|
||||
"\n");
|
||||
|
@ -1165,7 +1168,7 @@ static int merge_hist_buckets(struct hist_bucket *bucket,
|
|||
big_bucket = i;
|
||||
}
|
||||
|
||||
/* If we have too many buckets, merge the smallest with an ajacent
|
||||
/* If we have too many buckets, merge the smallest with an adjacent
|
||||
* bucket.
|
||||
*/
|
||||
while(buckets > max_buckets)
|
||||
|
|
Загрузка…
Ссылка в новой задаче