[FFmpeg-soc] [soc]: r3867 - in dirac/libavcodec: dirac.h diracdec.c

conrad subversion at mplayerhq.hu
Thu Dec 4 22:16:23 CET 2008


Author: conrad
Date: Thu Dec  4 22:16:23 2008
New Revision: 3867

Log:
Use x,y instead of h,v


Modified:
   dirac/libavcodec/dirac.h
   dirac/libavcodec/diracdec.c

Modified: dirac/libavcodec/dirac.h
==============================================================================
--- dirac/libavcodec/dirac.h	(original)
+++ dirac/libavcodec/dirac.h	Thu Dec  4 22:16:23 2008
@@ -339,14 +339,14 @@ int coeff_posy(DiracContext *s, int leve
 }
 
 static inline
-int zero_neighbourhood(DiracContext *s, int16_t *data, int v, int h)
+int zero_neighbourhood(DiracContext *s, int16_t *data, int x, int y)
 {
     /* Check if there is a zero to the left and top left of this
        coefficient. */
-    if (v > 0 && (data[-s->padded_width]
-                  || ( h > 0 && data[-s->padded_width - 1])))
+    if (y > 0 && (data[-s->padded_width]
+                  || ( x > 0 && data[-s->padded_width - 1])))
         return 0;
-    else if (h > 0 && data[- 1])
+    else if (x > 0 && data[- 1])
         return 0;
 
     return 1;
@@ -363,11 +363,11 @@ int zero_neighbourhood(DiracContext *s, 
  */
 static inline
 int sign_predict(DiracContext *s, int16_t *data, dirac_subband orientation,
-                 int v, int h)
+                 int x, int y)
 {
-    if (orientation == subband_hl && v > 0)
+    if (orientation == subband_hl && y > 0)
         return DIRAC_SIGN(data[-s->padded_width]);
-    else if (orientation == subband_lh && h > 0)
+    else if (orientation == subband_lh && x > 0)
         return DIRAC_SIGN(data[-1]);
     else
         return 0;

Modified: dirac/libavcodec/diracdec.c
==============================================================================
--- dirac/libavcodec/diracdec.c	(original)
+++ dirac/libavcodec/diracdec.c	Thu Dec  4 22:16:23 2008
@@ -81,7 +81,7 @@ static inline int coeff_dequant(int coef
  * @param qfact quantizer factor
  */
 static void coeff_unpack(DiracContext *s, int16_t *data, int level,
-                         dirac_subband orientation, int v, int h,
+                         dirac_subband orientation, int x, int y,
                          int qoffset, int qfactor)
 {
     int parent = 0;
@@ -93,24 +93,24 @@ static void coeff_unpack(DiracContext *s
     int16_t *coeffp;
     int vdata, hdata;
 
-    vdata = coeff_posy(s, level, orientation, v);
-    hdata = coeff_posx(s, level, orientation, h);
+    vdata = coeff_posy(s, level, orientation, y);
+    hdata = coeff_posx(s, level, orientation, x);
 
     coeffp = &data[hdata + vdata * s->padded_width];
 
     /* The value of the pixel belonging to the lower level. */
     if (level >= 2) {
-        int x = coeff_posx(s, level - 1, orientation, h >> 1);
-        int y = coeff_posy(s, level - 1, orientation, v >> 1);
-        parent = data[s->padded_width * y + x] != 0;
+        int low_x = coeff_posx(s, level - 1, orientation, x >> 1);
+        int low_y = coeff_posy(s, level - 1, orientation, y >> 1);
+        parent = data[s->padded_width * low_y + low_x] != 0;
     }
 
     /* Determine if the pixel has only zeros in its neighbourhood. */
-    nhood = zero_neighbourhood(s, coeffp, v, h);
+    nhood = zero_neighbourhood(s, coeffp, x, y);
 
     /* Calculate an index into context_sets_waveletcoeff. */
     idx = parent * 6 + (!nhood) * 3;
-    idx += sign_predict(s, coeffp, orientation, v, h);
+    idx += sign_predict(s, coeffp, orientation, x, y);
 
     context = &ff_dirac_context_sets_waveletcoeff[idx];
 
@@ -138,18 +138,18 @@ static void coeff_unpack(DiracContext *s
  * @param quant quantizer factor
  */
 static void codeblock(DiracContext *s, int16_t *data, int level,
-                      dirac_subband orientation, int x, int y,
+                      dirac_subband orientation, int cb_x, int cb_y,
                       unsigned int *quant)
 {
     int blockcnt_one = (s->codeblocksh[level] + s->codeblocksv[level]) == 2;
     int left, right, top, bottom;
-    int v, h;
+    int x, y;
     unsigned int qoffset, qfactor;
 
-    left   = (subband_width(s, level)  *  x     ) / s->codeblocksh[level];
-    right  = (subband_width(s, level)  * (x + 1)) / s->codeblocksh[level];
-    top    = (subband_height(s, level) *  y     ) / s->codeblocksv[level];
-    bottom = (subband_height(s, level) * (y + 1)) / s->codeblocksv[level];
+    left   = (subband_width(s, level)  *  cb_x     ) / s->codeblocksh[level];
+    right  = (subband_width(s, level)  * (cb_x + 1)) / s->codeblocksh[level];
+    top    = (subband_height(s, level) *  cb_y     ) / s->codeblocksv[level];
+    bottom = (subband_height(s, level) * (cb_y + 1)) / s->codeblocksv[level];
 
     if (!blockcnt_one) {
         /* Determine if this codeblock is a zero block. */
@@ -162,9 +162,9 @@ static void codeblock(DiracContext *s, i
     qfactor = coeff_quant_factor(*quant);
     qoffset = coeff_quant_offset(s->refs == 0, *quant) + 2;
 
-    for (v = top; v < bottom; v++)
-        for (h = left; h < right; h++)
-            coeff_unpack(s, data, level, orientation, v, h, qoffset, qfactor);
+    for (y = top; y < bottom; y++)
+        for (x = left; x < right; x++)
+            coeff_unpack(s, data, level, orientation, x, y, qoffset, qfactor);
 }
 
 /**
@@ -198,7 +198,7 @@ static int subband(DiracContext *s, int1
     GetBitContext *gb = &s->gb;
     unsigned int length;
     unsigned int quant;
-    int x, y;
+    int cb_x, cb_y;
 
     length = svq3_get_ue_golomb(gb);
     if (! length) {
@@ -208,9 +208,9 @@ static int subband(DiracContext *s, int1
 
         dirac_arith_init(&s->arith, gb, length);
 
-        for (y = 0; y < s->codeblocksv[level]; y++)
-            for (x = 0; x < s->codeblocksh[level]; x++)
-                codeblock(s, data, level, orientation, x, y, &quant);
+        for (cb_y = 0; cb_y < s->codeblocksv[level]; cb_y++)
+            for (cb_x = 0; cb_x < s->codeblocksh[level]; cb_x++)
+                codeblock(s, data, level, orientation, cb_x, cb_y, &quant);
         dirac_arith_flush(&s->arith);
     }
 



More information about the FFmpeg-soc mailing list