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

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


Author: conrad
Date: Thu Dec  4 22:16:18 2008
New Revision: 3865

Log:
Support differential quantization


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

Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c	(original)
+++ dirac/libavcodec/dirac.c	Thu Dec  4 22:16:18 2008
@@ -387,6 +387,15 @@ struct dirac_arith_context_set ff_dirac_
         .sign = ARITH_CONTEXT_DC_SIGN
     };
 
+struct dirac_arith_context_set ff_dirac_context_set_quant =
+    {
+        .follow = { ARITH_CONTEXT_Q_OFFSET_FOLLOW, ARITH_CONTEXT_Q_OFFSET_FOLLOW,
+                    ARITH_CONTEXT_Q_OFFSET_FOLLOW, ARITH_CONTEXT_Q_OFFSET_FOLLOW,
+                    ARITH_CONTEXT_Q_OFFSET_FOLLOW, ARITH_CONTEXT_Q_OFFSET_FOLLOW },
+        .data = ARITH_CONTEXT_Q_OFFSET_DATA,
+        .sign = ARITH_CONTEXT_Q_OFFSET_SIGN,
+    };
+
 struct dirac_arith_context_set ff_dirac_context_sets_waveletcoeff[] = {
     {
         /* Parent = 0, Zero neighbourhood, sign predict 0 */

Modified: dirac/libavcodec/dirac.h
==============================================================================
--- dirac/libavcodec/dirac.h	(original)
+++ dirac/libavcodec/dirac.h	Thu Dec  4 22:16:18 2008
@@ -130,6 +130,7 @@ struct globalmc_parameters {
 extern struct dirac_arith_context_set ff_dirac_context_set_split;
 extern struct dirac_arith_context_set ff_dirac_context_set_mv;
 extern struct dirac_arith_context_set ff_dirac_context_set_dc;
+extern struct dirac_arith_context_set ff_dirac_context_set_quant;
 extern struct dirac_arith_context_set ff_dirac_context_sets_waveletcoeff[];
 
 #define DIRAC_REF_MASK_REF1   1

Modified: dirac/libavcodec/diracdec.c
==============================================================================
--- dirac/libavcodec/diracdec.c	(original)
+++ dirac/libavcodec/diracdec.c	Thu Dec  4 22:16:18 2008
@@ -139,11 +139,12 @@ static void coeff_unpack(DiracContext *s
  */
 static void codeblock(DiracContext *s, int16_t *data, int level,
                       dirac_subband orientation, int x, int y,
-                      int qoffset, int qfactor)
+                      unsigned int *quant)
 {
     int blockcnt_one = (s->codeblocksh[level] + s->codeblocksv[level]) == 2;
     int left, right, top, bottom;
     int v, h;
+    unsigned int qoffset, qfactor;
 
     left   = (subband_width(s, level)  *  x     ) / s->codeblocksh[level];
     right  = (subband_width(s, level)  * (x + 1)) / s->codeblocksh[level];
@@ -156,6 +157,11 @@ static void codeblock(DiracContext *s, i
             return;
     }
 
+    if (s->codeblock_mode)
+        *quant += dirac_arith_read_int(&s->arith, &ff_dirac_context_set_quant);
+    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,
@@ -192,7 +198,7 @@ static int subband(DiracContext *s, int1
 {
     GetBitContext *gb = &s->gb;
     unsigned int length;
-    unsigned int quant, qoffset, qfactor;
+    unsigned int quant;
     int x, y;
 
     length = svq3_get_ue_golomb(gb);
@@ -200,15 +206,12 @@ static int subband(DiracContext *s, int1
         align_get_bits(gb);
     } else {
         quant = svq3_get_ue_golomb(gb);
-        qfactor = coeff_quant_factor(quant);
-        qoffset = coeff_quant_offset(s->refs == 0, quant) + 2;
 
         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,
-                          qoffset, qfactor);
+                codeblock(s, data, level, orientation, x, y, &quant);
         dirac_arith_flush(&s->arith);
     }
 
@@ -720,9 +723,11 @@ static void dump_frame_params(AVCodecCon
     }
     if (s->zero_res)
         dprintf(avctx, "\tNo residual\n");
-    else
+    else {
         dprintf(avctx, "\tWavelet %s, depth %d\n", wavelet_names[s->wavelet_idx],
                 s->decoding.wavelet_depth);
+        dprintf(avctx, "\tCodeblock mode %d\n", s->codeblock_mode);
+    }
 }
 
 /**



More information about the FFmpeg-soc mailing list