[FFmpeg-soc] [soc]: r518 - in dirac: TODO libavcodec/dirac.c

marco subversion at mplayerhq.hu
Tue Jul 24 01:23:57 CEST 2007


Author: marco
Date: Tue Jul 24 01:23:57 2007
New Revision: 518

Log:
Simplify sign_predict and update the TODO


Modified:
   dirac/TODO
   dirac/libavcodec/dirac.c

Modified: dirac/TODO
==============================================================================
--- dirac/TODO	(original)
+++ dirac/TODO	Tue Jul 24 01:23:57 2007
@@ -1,17 +1,12 @@
-- Compare the CABAC implementation to the Dirac spec
 - Clean things up!!!
 - Make sure the coding style is correct
 - Fill in the missing bits
 
 - Remove dprintfs, replace it with functions to dump the frame state
-- Add doxygen comments for each function
 - context_set_waveletcoeffs can be rewritten as code or split up
 - Properly use bounded block reading
 - Simplify sign predict
 - Align assignments to make them prettier
 - Properly store the amount of codeblocks per subband instead of using
   a fixed maximum of 7 subbands
-- Remove the intra frame only hacks.
-- Figure out how to reserve memory properly for coefficients in ffmpeg.
-- IDWT!! :-)
-- Eventually split up the file.
+- Unpack motion vectors

Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c	(original)
+++ dirac/libavcodec/dirac.c	Tue Jul 24 01:23:57 2007
@@ -34,6 +34,8 @@ typedef enum {
     TRANSFER_FUNC_DCI_GAMMA
 } transfer_func_t;
 
+#define DIRAC_SIGN(x) ((x == 0) ? 0 : FFSIGN(x))
+
 struct source_parameters
 {
     /* Interlacing.  */
@@ -776,29 +778,12 @@ static int sign_predict(AVCodecContext *
     int y = coeff_posy(avctx, level, orientation, v);
     DiracContext *s = avctx->priv_data;
 
-    switch (orientation) {
-    case subband_ll:
-    case subband_hh:
+    if (orientation == subband_hl && v > 0)
+        return DIRAC_SIGN(data[x + (y - 1) * s->padded_width]);
+    else if (orientation == subband_lh && h > 0)
+        return DIRAC_SIGN(data[x + y * s->padded_width - 1]);
+    else
         return 0;
-    case subband_hl:
-        if (v == 0)
-            return 0;
-        else {
-            if (data[x + (y - 1) * s->padded_width] == 0)
-                return 0;
-            return FFSIGN(data[x + (y - 1) * s->padded_width]);
-        }
-    case subband_lh:
-        if (h == 0)
-            return 0;
-        else {
-            if (data[x + y * s->padded_width - 1] == 0)
-                return 0;
-            return FFSIGN(data[x + y * s->padded_width - 1]);
-        }
-    }
-
-    return 0;
 }
 
 /**



More information about the FFmpeg-soc mailing list