shithub: libvpx

Download patch

ref: 0cef7234e1227dbd008dd9dcc608a8579bc52e24
parent: 1c6df34c06cc87d49dc4ea4e814133834e46339a
parent: c34f6fcb5470123f6eeda058f20ac340fb1b45cf
author: Dmitry Kovalev <dkovalev@google.com>
date: Wed Apr 10 09:29:38 EDT 2013

Merge "Fixing upper case names." into experimental

--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -169,8 +169,8 @@
 typedef struct VP9Common {
   struct vpx_internal_error_info  error;
 
-  DECLARE_ALIGNED(16, int16_t, Y1dequant[QINDEX_RANGE][16]);
-  DECLARE_ALIGNED(16, int16_t, UVdequant[QINDEX_RANGE][16]);
+  DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][16]);
+  DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][16]);
 
   int width;
   int height;
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -102,15 +102,15 @@
   VP9_COMMON *const pc = &pbi->common;
 
   for (q = 0; q < QINDEX_RANGE; q++) {
-    pc->Y1dequant[q][0] = (int16_t)vp9_dc_quant(q, pc->y1dc_delta_q);
-    pc->UVdequant[q][0] = (int16_t)vp9_dc_uv_quant(q, pc->uvdc_delta_q);
+    pc->y_dequant[q][0] = (int16_t)vp9_dc_quant(q, pc->y1dc_delta_q);
+    pc->uv_dequant[q][0] = (int16_t)vp9_dc_uv_quant(q, pc->uvdc_delta_q);
 
     /* all the ac values =; */
     for (i = 1; i < 16; i++) {
       const int rc = vp9_default_zig_zag1d_4x4[i];
 
-      pc->Y1dequant[q][rc] = (int16_t)vp9_ac_yquant(q);
-      pc->UVdequant[q][rc] = (int16_t)vp9_ac_uv_quant(q, pc->uvac_delta_q);
+      pc->y_dequant[q][rc] = (int16_t)vp9_ac_yquant(q);
+      pc->uv_dequant[q][rc] = (int16_t)vp9_ac_uv_quant(q, pc->uvac_delta_q);
     }
   }
 }
@@ -136,10 +136,10 @@
   mb->q_index = qindex;
 
   for (i = 0; i < 16; i++)
-    mb->block[i].dequant = pc->Y1dequant[qindex];
+    mb->block[i].dequant = pc->y_dequant[qindex];
 
   for (i = 16; i < 24; i++)
-    mb->block[i].dequant = pc->UVdequant[qindex];
+    mb->block[i].dequant = pc->uv_dequant[qindex];
 
   if (mb->lossless) {
     assert(qindex == 0);
@@ -241,7 +241,7 @@
                            xd->predictor + 16 * 16, xd->dst.u_buffer, 8,
                            xd->dst.uv_stride, xd->plane[1].eobs[0]);
 
-  vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[16].dequant,
+  vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[20].dequant,
                            xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, 8,
                            xd->dst.uv_stride, xd->plane[2].eobs[0]);
 }
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -626,7 +626,7 @@
     invert_quant(cpi->Y1quant[q] + 0, cpi->Y1quant_shift[q] + 0, quant_val);
     cpi->Y1zbin[q][0] = ROUND_POWER_OF_TWO(qzbin_factor * quant_val, 7);
     cpi->Y1round[q][0] = (qrounding_factor * quant_val) >> 7;
-    cpi->common.Y1dequant[q][0] = quant_val;
+    cpi->common.y_dequant[q][0] = quant_val;
     cpi->zrun_zbin_boost_y1[q][0] = (quant_val * zbin_boost[0]) >> 7;
 
     quant_val = vp9_dc_uv_quant(q, cpi->common.uvdc_delta_q);
@@ -633,7 +633,7 @@
     invert_quant(cpi->UVquant[q] + 0, cpi->UVquant_shift[q] + 0, quant_val);
     cpi->UVzbin[q][0] = ROUND_POWER_OF_TWO(qzbin_factor * quant_val, 7);
     cpi->UVround[q][0] = (qrounding_factor * quant_val) >> 7;
-    cpi->common.UVdequant[q][0] = quant_val;
+    cpi->common.uv_dequant[q][0] = quant_val;
     cpi->zrun_zbin_boost_uv[q][0] = (quant_val * zbin_boost[0]) >> 7;
 
     // all the 4x4 ac values =;
@@ -644,7 +644,7 @@
       invert_quant(cpi->Y1quant[q] + rc, cpi->Y1quant_shift[q] + rc, quant_val);
       cpi->Y1zbin[q][rc] = ROUND_POWER_OF_TWO(qzbin_factor * quant_val, 7);
       cpi->Y1round[q][rc] = (qrounding_factor * quant_val) >> 7;
-      cpi->common.Y1dequant[q][rc] = quant_val;
+      cpi->common.y_dequant[q][rc] = quant_val;
       cpi->zrun_zbin_boost_y1[q][i] =
           ROUND_POWER_OF_TWO(quant_val * zbin_boost[i], 7);
 
@@ -652,7 +652,7 @@
       invert_quant(cpi->UVquant[q] + rc, cpi->UVquant_shift[q] + rc, quant_val);
       cpi->UVzbin[q][rc] = ROUND_POWER_OF_TWO(qzbin_factor * quant_val, 7);
       cpi->UVround[q][rc] = (qrounding_factor * quant_val) >> 7;
-      cpi->common.UVdequant[q][rc] = quant_val;
+      cpi->common.uv_dequant[q][rc] = quant_val;
       cpi->zrun_zbin_boost_uv[q][i] =
           ROUND_POWER_OF_TWO(quant_val * zbin_boost[i], 7);
     }
@@ -661,7 +661,7 @@
 
 void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
   int i;
-  int QIndex;
+  int qindex;
   MACROBLOCKD *xd = &x->e_mbd;
   int zbin_extra;
   int segment_id = xd->mode_info_context->mbmi.segment_id;
@@ -668,33 +668,32 @@
 
   // Select the baseline MB Q index allowing for any segment level change.
   if (vp9_segfeature_active(xd, segment_id, SEG_LVL_ALT_Q)) {
-    // Abs Value
-    if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA)
-      QIndex = vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
+    if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
+      // Abs Value
+      qindex = vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
+    } else {
+      // Delta Value
+      qindex = cpi->common.base_qindex +
+                 vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
 
-    // Delta Value
-    else {
-      QIndex = cpi->common.base_qindex +
-               vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
-
       // Clamp to valid range
-      QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0;
+      qindex = clamp(qindex, 0, MAXQ);
     }
-  } else
-    QIndex = cpi->common.base_qindex;
+  } else {
+    qindex = cpi->common.base_qindex;
+  }
 
   // Y
-  zbin_extra = (cpi->common.Y1dequant[QIndex][1] *
-                (cpi->zbin_mode_boost +
-                 x->act_zbin_adj)) >> 7;
+  zbin_extra = (cpi->common.y_dequant[qindex][1] *
+                 (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
 
   for (i = 0; i < 16; i++) {
-    x->block[i].quant = cpi->Y1quant[QIndex];
-    x->block[i].quant_shift = cpi->Y1quant_shift[QIndex];
-    x->block[i].zbin = cpi->Y1zbin[QIndex];
-    x->block[i].round = cpi->Y1round[QIndex];
-    x->e_mbd.block[i].dequant = cpi->common.Y1dequant[QIndex];
-    x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[QIndex];
+    x->block[i].quant = cpi->Y1quant[qindex];
+    x->block[i].quant_shift = cpi->Y1quant_shift[qindex];
+    x->block[i].zbin = cpi->Y1zbin[qindex];
+    x->block[i].round = cpi->Y1round[qindex];
+    x->e_mbd.block[i].dequant = cpi->common.y_dequant[qindex];
+    x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[qindex];
     x->block[i].zbin_extra = (int16_t)zbin_extra;
 
     // Segment skip feature.
@@ -703,49 +702,40 @@
   }
 
   // UV
-  zbin_extra = (cpi->common.UVdequant[QIndex][1] *
-                (cpi->zbin_mode_boost +
-                 x->act_zbin_adj)) >> 7;
+  zbin_extra = (cpi->common.uv_dequant[qindex][1] *
+                (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
 
   for (i = 16; i < 24; i++) {
-    x->block[i].quant = cpi->UVquant[QIndex];
-    x->block[i].quant_shift = cpi->UVquant_shift[QIndex];
-    x->block[i].zbin = cpi->UVzbin[QIndex];
-    x->block[i].round = cpi->UVround[QIndex];
-    x->e_mbd.block[i].dequant = cpi->common.UVdequant[QIndex];
-    x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_uv[QIndex];
+    x->block[i].quant = cpi->UVquant[qindex];
+    x->block[i].quant_shift = cpi->UVquant_shift[qindex];
+    x->block[i].zbin = cpi->UVzbin[qindex];
+    x->block[i].round = cpi->UVround[qindex];
+    x->e_mbd.block[i].dequant = cpi->common.uv_dequant[qindex];
+    x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_uv[qindex];
     x->block[i].zbin_extra = (int16_t)zbin_extra;
 
     // Segment skip feature.
     x->block[i].skip_block =
-      vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
+        vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
   }
 
   /* save this macroblock QIndex for vp9_update_zbin_extra() */
-  x->e_mbd.q_index = QIndex;
+  x->e_mbd.q_index = qindex;
 }
 
 void vp9_update_zbin_extra(VP9_COMP *cpi, MACROBLOCK *x) {
   int i;
-  int QIndex = x->e_mbd.q_index;
-  int zbin_extra;
+  const int qindex = x->e_mbd.q_index;
+  const int y_zbin_extra = (cpi->common.y_dequant[qindex][1] *
+                (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
+  const int uv_zbin_extra = (cpi->common.uv_dequant[qindex][1] *
+                  (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
 
-  // Y
-  zbin_extra = (cpi->common.Y1dequant[QIndex][1] *
-                (cpi->zbin_mode_boost +
-                 x->act_zbin_adj)) >> 7;
-  for (i = 0; i < 16; i++) {
-    x->block[i].zbin_extra = (int16_t)zbin_extra;
-  }
+  for (i = 0; i < 16; i++)
+    x->block[i].zbin_extra = (int16_t)y_zbin_extra;
 
-  // UV
-  zbin_extra = (cpi->common.UVdequant[QIndex][1] *
-                (cpi->zbin_mode_boost +
-                 x->act_zbin_adj)) >> 7;
-
-  for (i = 16; i < 24; i++) {
-    x->block[i].zbin_extra = (int16_t)zbin_extra;
-  }
+  for (i = 16; i < 24; i++)
+    x->block[i].zbin_extra = (int16_t)uv_zbin_extra;
 }
 
 void vp9_frame_init_quantizer(VP9_COMP *cpi) {