gecko/media/libvpx/variance-invoke.patch
2012-07-17 09:21:47 +02:00

145 lines
6.2 KiB
Diff

# HG changeset patch
# Parent 4c655dd10f74c0782893d34f660e50b36494c88b
# User Timothy B. Terriberry <tterribe@vt.edu>
Bug 730907 - Use VARIANCE_INVOKE in multiframe_quality_enhance_block()
diff -r 4c655dd10f74 media/libvpx/vp8/common/postproc.c
--- a/media/libvpx/vp8/common/postproc.c Mon Jul 09 05:46:16 2012 -0700
+++ b/media/libvpx/vp8/common/postproc.c Mon Jul 09 06:23:11 2012 -0700
@@ -706,17 +706,18 @@ static void multiframe_quality_enhance_b
unsigned char *u,
unsigned char *v,
int y_stride,
int uv_stride,
unsigned char *yd,
unsigned char *ud,
unsigned char *vd,
int yd_stride,
- int uvd_stride
+ int uvd_stride,
+ vp8_variance_rtcd_vtable_t *rtcd
)
{
static const unsigned char VP8_ZEROS[16]=
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
int blksizeby2 = blksize >> 1;
int qdiff = qcurr - qprev;
@@ -727,28 +728,28 @@ static void multiframe_quality_enhance_b
unsigned char *up;
unsigned char *udp;
unsigned char *vp;
unsigned char *vdp;
unsigned int act, sse, sad, thr;
if (blksize == 16)
{
- act = (vp8_variance_var16x16(yd, yd_stride, VP8_ZEROS, 0, &sse)+128)>>8;
- sad = (vp8_variance_sad16x16(y, y_stride, yd, yd_stride, 0)+128)>>8;
+ act = (VARIANCE_INVOKE(rtcd, var16x16)(yd, yd_stride, VP8_ZEROS, 0, &sse)+128)>>8;
+ sad = (VARIANCE_INVOKE(rtcd, sad16x16)(y, y_stride, yd, yd_stride, 0)+128)>>8;
}
else if (blksize == 8)
{
- act = (vp8_variance_var8x8(yd, yd_stride, VP8_ZEROS, 0, &sse)+32)>>6;
- sad = (vp8_variance_sad8x8(y, y_stride, yd, yd_stride, 0)+32)>>6;
+ act = (VARIANCE_INVOKE(rtcd, var8x8)(yd, yd_stride, VP8_ZEROS, 0, &sse)+32)>>6;
+ sad = (VARIANCE_INVOKE(rtcd, sad8x8)(y, y_stride, yd, yd_stride, 0)+32)>>6;
}
else
{
- act = (vp8_variance_var4x4(yd, yd_stride, VP8_ZEROS, 0, &sse)+8)>>4;
- sad = (vp8_variance_sad4x4(y, y_stride, yd, yd_stride, 0)+8)>>4;
+ act = (VARIANCE_INVOKE(rtcd, var4x4)(yd, yd_stride, VP8_ZEROS, 0, &sse)+8)>>4;
+ sad = (VARIANCE_INVOKE(rtcd, sad4x4)(y, y_stride, yd, yd_stride, 0)+8)>>4;
}
/* thr = qdiff/8 + log2(act) + log4(qprev) */
thr = (qdiff>>3);
while (act>>=1) thr++;
while (qprev>>=2) thr++;
if (sad < thr)
{
static const int roundoff = (1 << (MFQE_PRECISION - 1));
@@ -800,18 +801,20 @@ static void multiframe_quality_enhance_b
for (vp = v, vdp = vd, i = 0; i < blksizeby2; ++i, vp += uv_stride, vdp += uvd_stride)
vpx_memcpy(vdp, vp, blksizeby2);
}
}
}
#if CONFIG_RUNTIME_CPU_DETECT
#define RTCD_VTABLE(oci) (&(oci)->rtcd.postproc)
+#define RTCD_VARIANCE(oci) (&(oci)->rtcd.variance)
#else
#define RTCD_VTABLE(oci) NULL
+#define RTCD_VARIANCE(oci) NULL
#endif
void vp8_multiframe_quality_enhance
(
VP8_COMMON *cm
)
{
YV12_BUFFER_CONFIG *show = cm->frame_to_show;
@@ -859,33 +862,35 @@ void vp8_multiframe_quality_enhance
u_ptr + 4*(i*show->uv_stride+j),
v_ptr + 4*(i*show->uv_stride+j),
show->y_stride,
show->uv_stride,
yd_ptr + 8*(i*dest->y_stride+j),
ud_ptr + 4*(i*dest->uv_stride+j),
vd_ptr + 4*(i*dest->uv_stride+j),
dest->y_stride,
- dest->uv_stride);
+ dest->uv_stride,
+ RTCD_VARIANCE(cm));
}
else
{
multiframe_quality_enhance_block(16,
qcurr,
qprev,
y_ptr,
u_ptr,
v_ptr,
show->y_stride,
show->uv_stride,
yd_ptr,
ud_ptr,
vd_ptr,
dest->y_stride,
- dest->uv_stride);
+ dest->uv_stride,
+ RTCD_VARIANCE(cm));
}
}
else
{
vp8_recon_copy16x16(y_ptr, show->y_stride, yd_ptr, dest->y_stride);
vp8_recon_copy8x8(u_ptr, show->uv_stride, ud_ptr, dest->uv_stride);
vp8_recon_copy8x8(v_ptr, show->uv_stride, vd_ptr, dest->uv_stride);
diff -r 4c655dd10f74 media/libvpx/vp8/encoder/pickinter.c
--- a/media/libvpx/vp8/encoder/pickinter.c Mon Jul 09 05:46:16 2012 -0700
+++ b/media/libvpx/vp8/encoder/pickinter.c Mon Jul 09 06:23:11 2012 -0700
@@ -127,17 +127,17 @@ static int pick_intra4x4block(
for (mode = B_DC_PRED; mode <= B_HE_PRED /*B_HU_PRED*/; mode++)
{
int this_rd;
rate = mode_costs[mode];
RECON_INVOKE(&rtcd->common->recon, intra4x4_predict)
(*(b->base_dst) + b->dst, b->dst_stride,
mode, b->predictor, 16);
- distortion = get_prediction_error(be, b, &rtcd->common->variance);
+ distortion = get_prediction_error(be, b, IF_RTCD(&rtcd->common->variance));
this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
if (this_rd < best_rd)
{
*bestrate = rate;
*bestdistortion = distortion;
best_rd = this_rd;
*best_mode = mode;