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

conrad subversion at mplayerhq.hu
Tue Nov 11 09:38:12 CET 2008


Author: conrad
Date: Tue Nov 11 09:38:12 2008
New Revision: 3814

Log:
Move chroma shift to DiracContext and get rid of chroma_width/height


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	Tue Nov 11 09:38:12 2008
@@ -199,12 +199,6 @@ static int parse_source_parameters(AVCod
     }
     avctx->pix_fmt = dirac_pix_fmt[s->source.chroma_format];
 
-    /* Calculate the chroma dimensions. */
-    s->chroma_hshift = s->source.chroma_format > 0;
-    s->chroma_vshift = s->source.chroma_format > 1;
-    s->source.chroma_width  = s->source.luma_width  >> s->chroma_hshift;
-    s->source.chroma_height = s->source.luma_height >> s->chroma_vshift;
-
     if (get_bits1(gb))
         s->source.interlaced = svq3_get_ue_golomb(gb);
     if (s->source.interlaced > 1)
@@ -1104,8 +1098,8 @@ int dirac_motion_compensation(DiracConte
         s->xbsep  = s->decoding.luma_xbsep;
         s->ybsep  = s->decoding.luma_ybsep;
     } else {
-        s->width  = s->source.chroma_width;
-        s->height = s->source.chroma_height;
+        s->width  = s->source.luma_width  >> s->chroma_hshift;
+        s->height = s->source.luma_height >> s->chroma_vshift;
         s->xblen  = s->decoding.chroma_xblen;
         s->yblen  = s->decoding.chroma_yblen;
         s->xbsep  = s->decoding.chroma_xbsep;

Modified: dirac/libavcodec/dirac.h
==============================================================================
--- dirac/libavcodec/dirac.h	(original)
+++ dirac/libavcodec/dirac.h	Tue Nov 11 09:38:12 2008
@@ -89,10 +89,6 @@ typedef struct {
     unsigned int signal_range_index;   ///< index into dirac_signal_range[]
     unsigned int color_spec_index;     ///< index into ff_dirac_color_spec_presets[]
 
-    /* calculated fields */
-    unsigned int chroma_width;         ///< the chroma component width
-    unsigned int chroma_height;        ///< the chroma component height
-
     /* luma and chroma offsets */
     uint16_t luma_offset;
     uint16_t luma_excursion;

Modified: dirac/libavcodec/diracdec.c
==============================================================================
--- dirac/libavcodec/diracdec.c	(original)
+++ dirac/libavcodec/diracdec.c	Tue Nov 11 09:38:12 2008
@@ -673,8 +673,8 @@ static int dirac_decode_frame_internal(D
             s->padded_width  = s->padded_luma_width;
             s->padded_height = s->padded_luma_height;
         } else {
-            width            = s->source.chroma_width;
-            height           = s->source.chroma_height;
+            width            = s->source.luma_width  >> s->chroma_hshift;
+            height           = s->source.luma_height >> s->chroma_vshift;
             s->padded_width  = s->padded_chroma_width;
             s->padded_height = s->padded_chroma_height;
         }
@@ -812,9 +812,9 @@ static int parse_frame(DiracContext *s)
                                            s->decoding.wavelet_depth);
     s->padded_luma_height   = CALC_PADDING(s->source.luma_height,
                                            s->decoding.wavelet_depth);
-    s->padded_chroma_width  = CALC_PADDING(s->source.chroma_width,
+    s->padded_chroma_width  = CALC_PADDING((s->source.luma_width >> s->chroma_hshift),
                                            s->decoding.wavelet_depth);
-    s->padded_chroma_height = CALC_PADDING(s->source.chroma_height,
+    s->padded_chroma_height = CALC_PADDING((s->source.luma_height >> s->chroma_vshift),
                                            s->decoding.wavelet_depth);
 
     return 0;
@@ -859,6 +859,8 @@ int dirac_decode_frame(AVCodecContext *a
             if (ff_dirac_parse_sequence_header(avctx, s))
                 return -1;
 
+            avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_hshift,
+                                          &s->chroma_vshift);
             /* Dump the header. */
 #if 0
             dirac_dump_source_parameters(avctx);



More information about the FFmpeg-soc mailing list