DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (5b81998bb7ab)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
# 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;