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

conrad subversion at mplayerhq.hu
Thu Jan 1 21:31:19 CET 2009


Author: conrad
Date: Thu Jan  1 21:31:19 2009
New Revision: 3906

Log:
Remove struct decoding_params

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

Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c	Thu Jan  1 21:31:16 2009	(r3905)
+++ dirac/libavcodec/dirac.c	Thu Jan  1 21:31:19 2009	(r3906)
@@ -554,7 +554,7 @@ static void motion_comp_block2refs(Dirac
         vect2[1] >>= s->chroma_vshift;
     }
 
-    switch(s->decoding.mv_precision) {
+    switch(s->mv_precision) {
     case 0:
         refxstart1 = (xs + vect1[0]) << 1;
         refystart1 = (ys + vect1[1]) << 1;
@@ -621,11 +621,11 @@ static void motion_comp_block2refs(Dirac
             int val2;
             int val;
 
-            if (s->decoding.mv_precision == 0) {
+            if (s->mv_precision == 0) {
                 /* No interpolation. */
                 val1 = refline1[(x + vect1[0]) << 1];
                 val2 = refline2[(x + vect2[0]) << 1];
-            } else if (s->decoding.mv_precision == 1) {
+            } else if (s->mv_precision == 1) {
                 /* Halfpel interpolation. */
                 val1 = refline1[(x << 1) + vect1[0]];
                 val2 = refline2[(x << 1) + vect2[0]];
@@ -633,7 +633,7 @@ static void motion_comp_block2refs(Dirac
                 /* Position in halfpel interpolated frame. */
                 int hx1, hx2;
 
-                if (s->decoding.mv_precision == 2) {
+                if (s->mv_precision == 2) {
                     /* Do qpel interpolation. */
                     hx1 = ((x << 2) + vect1[0]) >> 1;
                     hx2 = ((x << 2) + vect2[0]) >> 1;
@@ -657,17 +657,17 @@ static void motion_comp_block2refs(Dirac
                 val1 += w1[1] * refline1[hx1               + 1];
                 val1 += w1[2] * refline1[hx1 + s->refwidth    ];
                 val1 += w1[3] * refline1[hx1 + s->refwidth + 1];
-                val1 >>= s->decoding.mv_precision;
+                val1 >>= s->mv_precision;
 
                 val2 += w2[0] * refline2[hx2                  ];
                 val2 += w2[1] * refline2[hx2               + 1];
                 val2 += w2[2] * refline2[hx2 + s->refwidth    ];
                 val2 += w2[3] * refline2[hx2 + s->refwidth + 1];
-                val2 >>= s->decoding.mv_precision;
+                val2 >>= s->mv_precision;
             }
 
-            val1 *= s->decoding.picture_weight_ref1;
-            val2 *= s->decoding.picture_weight_ref2;
+            val1 *= s->picture_weight_ref1;
+            val2 *= s->picture_weight_ref2;
             val = val1 + val2;
             if (border) {
                 val *= spatialwt[bx];
@@ -736,7 +736,7 @@ static void motion_comp_block1ref(DiracC
         vect[1] >>= s->chroma_vshift;
     }
 
-    switch(s->decoding.mv_precision) {
+    switch(s->mv_precision) {
     case 0:
         refxstart = (xs + vect[0]) << 1;
         refystart = (ys + vect[1]) << 1;
@@ -781,17 +781,17 @@ static void motion_comp_block1ref(DiracC
         for (x = xs; x < xstop; x++) {
             int val;
 
-            if (s->decoding.mv_precision == 0) {
+            if (s->mv_precision == 0) {
                 /* No interpolation. */
                 val = refline[(x + vect[0]) << 1];
-            } else if (s->decoding.mv_precision == 1) {
+            } else if (s->mv_precision == 1) {
                 /* Halfpel interpolation. */
                 val = refline[(x << 1) + vect[0]];
             } else {
                 /* Position in halfpel interpolated frame. */
                 int hx;
 
-                if (s->decoding.mv_precision == 2) {
+                if (s->mv_precision == 2) {
                     /* Do qpel interpolation. */
                     hx = ((x << 2) + vect[0]) >> 1;
                     val = 2;
@@ -810,11 +810,11 @@ static void motion_comp_block1ref(DiracC
                 val += w[1] * refline[hx               + 1];
                 val += w[2] * refline[hx + s->refwidth    ];
                 val += w[3] * refline[hx + s->refwidth + 1];
-                val >>= s->decoding.mv_precision;
+                val >>= s->mv_precision;
             }
 
-            val *= s->decoding.picture_weight_ref1
-                 + s->decoding.picture_weight_ref2;
+            val *= s->picture_weight_ref1
+                 + s->picture_weight_ref2;
 
             if (border) {
                 val *= spatialwt[bx];
@@ -862,7 +862,7 @@ void motion_comp_dc_block(DiracContext *
     ys = FFMAX(ystart, 0);
     xs = FFMAX(xstart, 0);
 
-    dcval <<= s->decoding.picture_weight_precision;
+    dcval <<= s->picture_weight_precision;
 
     spatialwt = &s->spatialwt[p->xblen * (ys - ystart)];
     line = &coeffs[p->width * ys];

Modified: dirac/libavcodec/dirac.h
==============================================================================
--- dirac/libavcodec/dirac.h	Thu Jan  1 21:31:16 2009	(r3905)
+++ dirac/libavcodec/dirac.h	Thu Jan  1 21:31:19 2009	(r3906)
@@ -105,16 +105,6 @@ typedef struct {
     color_specification color_spec;
 } dirac_source_params;
 
-struct decoding_parameters {
-    uint8_t wavelet_depth;          ///< depth of the IDWT
-
-    uint8_t mv_precision;
-
-    int16_t picture_weight_ref1;
-    int16_t picture_weight_ref2;
-    unsigned int picture_weight_precision;
-};
-
 struct globalmc_parameters {
     unsigned int pan_tilt[2];                   ///< pan/tilt vector
     unsigned int zrs[2][2];                     ///< zoom/rotate/shear matrix
@@ -187,7 +177,14 @@ typedef struct DiracContext {
     int16_t *mcpic;
 
     dirac_source_params source;
-    struct decoding_parameters decoding;
+
+    uint8_t wavelet_depth;          ///< depth of the IDWT
+
+    uint8_t mv_precision;
+
+    int16_t picture_weight_ref1;
+    int16_t picture_weight_ref2;
+    unsigned int picture_weight_precision;
 
     unsigned int codeblock_mode;
     unsigned int codeblocksh[MAX_DECOMPOSITIONS+1];

Modified: dirac/libavcodec/diracdec.c
==============================================================================
--- dirac/libavcodec/diracdec.c	Thu Jan  1 21:31:16 2009	(r3905)
+++ dirac/libavcodec/diracdec.c	Thu Jan  1 21:31:19 2009	(r3906)
@@ -319,7 +319,7 @@ static void decode_component(DiracContex
     dirac_subband orientation;
 
     /* Unpack all subbands at all levels. */
-    for (level = 0; level < s->decoding.wavelet_depth; level++) {
+    for (level = 0; level < s->wavelet_depth; level++) {
         for (orientation = (level ? 1 : 0); orientation < 4; orientation++) {
             SubBand *b = &s->plane[comp].band[level][orientation];
             align_get_bits(gb);
@@ -345,20 +345,20 @@ static void init_planes(DiracContext *s)
 
         p->width  = s->source.width  >> (i ? s->chroma_hshift : 0);
         p->height = s->source.height >> (i ? s->chroma_vshift : 0);
-        p->padded_width  = w = PAD(p->width , s->decoding.wavelet_depth);
-        p->padded_height = h = PAD(p->height, s->decoding.wavelet_depth);
+        p->padded_width  = w = PAD(p->width , s->wavelet_depth);
+        p->padded_height = h = PAD(p->height, s->wavelet_depth);
 
         if (i == 0)
             s->spatial_idwt_buffer =
                 av_malloc(p->padded_width*p->padded_height * sizeof(IDWTELEM));
 
-        for (level = s->decoding.wavelet_depth-1; level >= 0; level--) {
+        for (level = s->wavelet_depth-1; level >= 0; level--) {
             for (orientation = level ? 1 : 0; orientation < 4; orientation++) {
                 SubBand *b = &p->band[level][orientation];
 
                 b->ibuf   = s->spatial_idwt_buffer;
                 b->level  = level;
-                b->stride = p->padded_width << (s->decoding.wavelet_depth - level);
+                b->stride = p->padded_width << (s->wavelet_depth - level);
                 b->width  = (w + !(orientation&1))>>1;
                 b->height = (h + !(orientation>1))>>1;
                 b->orientation = orientation;
@@ -385,7 +385,7 @@ static void init_planes(DiracContext *s)
         p->xoffset = (p->xblen - p->xbsep) / 2;
         p->yoffset = (p->yblen - p->ybsep) / 2;
 
-        p->total_wt_bits = s->decoding.picture_weight_precision +
+        p->total_wt_bits = s->picture_weight_precision +
             av_log2(p->xoffset) + av_log2(p->yoffset) + 4;
 
         if (s->refs) {
@@ -422,7 +422,7 @@ static int dirac_unpack_prediction_param
     }
 
     /* Read motion vector precision. */
-    s->decoding.mv_precision = svq3_get_ue_golomb(gb);
+    s->mv_precision = svq3_get_ue_golomb(gb);
 
     /* Read the global motion compensation parameters. */
     s->globalmc_flag = get_bits1(gb);
@@ -466,16 +466,16 @@ static int dirac_unpack_prediction_param
     }
 
     /* Default weights */
-    s->decoding.picture_weight_precision = 1;
-    s->decoding.picture_weight_ref1      = 1;
-    s->decoding.picture_weight_ref2      = 1;
+    s->picture_weight_precision = 1;
+    s->picture_weight_ref1      = 1;
+    s->picture_weight_ref2      = 1;
 
     /* Override reference picture weights. */
     if (get_bits1(gb)) {
-        s->decoding.picture_weight_precision = svq3_get_ue_golomb(gb);
-        s->decoding.picture_weight_ref1 = dirac_get_se_golomb(gb);
+        s->picture_weight_precision = svq3_get_ue_golomb(gb);
+        s->picture_weight_ref1 = dirac_get_se_golomb(gb);
         if (s->refs == 2)
-            s->decoding.picture_weight_ref2 = dirac_get_se_golomb(gb);
+            s->picture_weight_ref2 = dirac_get_se_golomb(gb);
     }
 
     return 0;
@@ -727,7 +727,7 @@ static int dirac_decode_frame_internal(D
             decode_component(s, comp);
 
         ff_spatial_idwt2(s->spatial_idwt_buffer, s->plane[comp].padded_width, s->plane[comp].padded_height,
-                  s->plane[comp].padded_width, s->wavelet_idx+2, s->decoding.wavelet_depth);
+                  s->plane[comp].padded_width, s->wavelet_idx+2, s->wavelet_depth);
 
         if (s->refs) {
             if (dirac_motion_compensation(s, s->spatial_idwt_buffer, comp)) {
@@ -842,19 +842,19 @@ static int parse_frame(DiracContext *s)
     if (s->wavelet_idx > 6)
         return -1;
 
-    s->decoding.wavelet_depth = svq3_get_ue_golomb(gb);
+    s->wavelet_depth = svq3_get_ue_golomb(gb);
 
     if (!s->low_delay) {
         /* Codeblock paramaters (core syntax only) */
         if (get_bits1(gb)) {
-            for (i = 0; i <= s->decoding.wavelet_depth; i++) {
+            for (i = 0; i <= s->wavelet_depth; i++) {
                 s->codeblocksh[i] = svq3_get_ue_golomb(gb);
                 s->codeblocksv[i] = svq3_get_ue_golomb(gb);
             }
 
             s->codeblock_mode = svq3_get_ue_golomb(gb);
         } else
-            for (i = 0; i <= s->decoding.wavelet_depth; i++)
+            for (i = 0; i <= s->wavelet_depth; i++)
                 s->codeblocksh[i] = s->codeblocksv[i] = 1;
     } else {
         s->x_slices        = svq3_get_ue_golomb(gb);
@@ -865,14 +865,14 @@ static int parse_frame(DiracContext *s)
         if (get_bits1(gb)) {
             // custom quantization matrix
             s->quant_matrix[0][0] = svq3_get_ue_golomb(gb);
-            for (level = 0; level < s->decoding.wavelet_depth; level++) {
+            for (level = 0; level < s->wavelet_depth; level++) {
                 s->quant_matrix[level][1] = svq3_get_ue_golomb(gb);
                 s->quant_matrix[level][2] = svq3_get_ue_golomb(gb);
                 s->quant_matrix[level][3] = svq3_get_ue_golomb(gb);
             }
         } else {
             // default quantization matrix
-            for (level = 0; level < s->decoding.wavelet_depth; level++)
+            for (level = 0; level < s->wavelet_depth; level++)
                 for (i = 0; i < 4; i++) {
                     s->quant_matrix[level][i] =
                         ff_dirac_default_qmat[s->wavelet_idx][level][i];
@@ -880,7 +880,7 @@ static int parse_frame(DiracContext *s)
                     // haar with no shift differs for different depths
                     if (s->wavelet_idx == 3)
                         s->quant_matrix[level][i] +=
-                            4*(s->decoding.wavelet_depth-1 - level);
+                            4*(s->wavelet_depth-1 - level);
                 }
         }
     }



More information about the FFmpeg-soc mailing list