[FFmpeg-soc] [soc]: r3883 - in dirac/libavcodec: dirac.c dirac.h dirac_arith.c dirac_arith.h

conrad subversion at mplayerhq.hu
Wed Dec 10 01:42:19 CET 2008


Author: conrad
Date: Wed Dec 10 01:42:19 2008
New Revision: 3883

Log:
Move arithmetic coder context tables to dirac_arith.c/h


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

Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c	(original)
+++ dirac/libavcodec/dirac.c	Wed Dec 10 01:42:19 2008
@@ -310,136 +310,6 @@ int ff_dirac_parse_sequence_header(GetBi
     return 0;
 }
 
-struct dirac_arith_context_set ff_dirac_context_set_split =
-    {
-        .follow = { ARITH_CONTEXT_SB_F1, ARITH_CONTEXT_SB_F2,
-                    ARITH_CONTEXT_SB_F2, ARITH_CONTEXT_SB_F2,
-                    ARITH_CONTEXT_SB_F2, ARITH_CONTEXT_SB_F2 },
-        .data = ARITH_CONTEXT_SB_DATA
-    };
-
-struct dirac_arith_context_set ff_dirac_context_set_mv =
-    {
-        .follow = { ARITH_CONTEXT_VECTOR_F1, ARITH_CONTEXT_VECTOR_F2,
-                    ARITH_CONTEXT_VECTOR_F3, ARITH_CONTEXT_VECTOR_F4,
-                    ARITH_CONTEXT_VECTOR_F5, ARITH_CONTEXT_VECTOR_F5 },
-        .data = ARITH_CONTEXT_VECTOR_DATA,
-        .sign = ARITH_CONTEXT_VECTOR_SIGN
-    };
-
-struct dirac_arith_context_set ff_dirac_context_set_dc =
-    {
-        .follow = { ARITH_CONTEXT_DC_F1, ARITH_CONTEXT_DC_F2,
-                    ARITH_CONTEXT_DC_F2, ARITH_CONTEXT_DC_F2,
-                    ARITH_CONTEXT_DC_F2, ARITH_CONTEXT_DC_F2 },
-        .data = ARITH_CONTEXT_DC_DATA,
-        .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 */
-        .follow = { ARITH_CONTEXT_ZPZN_F1, ARITH_CONTEXT_ZP_F2,
-                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
-                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_ZERO,
-    }, {
-        /* Parent = 0, Zero neighbourhood, sign predict < 0 */
-        .follow = { ARITH_CONTEXT_ZPZN_F1, ARITH_CONTEXT_ZP_F2,
-                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
-                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_NEG
-    }, {
-        /* Parent = 0, Zero neighbourhood, sign predict > 0 */
-        .follow = { ARITH_CONTEXT_ZPZN_F1, ARITH_CONTEXT_ZP_F2,
-                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
-                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_POS
-    },
-
-    {
-        /* Parent = 0, No Zero neighbourhood, sign predict  0 */
-        .follow = { ARITH_CONTEXT_ZPNN_F1, ARITH_CONTEXT_ZP_F2,
-                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
-                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_ZERO
-    }, {
-        /* Parent = 0, No Zero neighbourhood, sign predict < 0 */
-        .follow = { ARITH_CONTEXT_ZPNN_F1, ARITH_CONTEXT_ZP_F2,
-                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
-                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_NEG
-    }, {
-        /* Parent = 0, No Zero neighbourhood, sign predict > 0 */
-        .follow = { ARITH_CONTEXT_ZPNN_F1, ARITH_CONTEXT_ZP_F2,
-                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
-                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_POS
-    },
-
-    {
-        /* Parent != 0, Zero neighbourhood, sign predict 0 */
-        .follow = { ARITH_CONTEXT_NPZN_F1, ARITH_CONTEXT_NP_F2,
-                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
-                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_ZERO
-    }, {
-        /* Parent != 0, Zero neighbourhood, sign predict < 0 */
-        .follow = { ARITH_CONTEXT_NPZN_F1, ARITH_CONTEXT_NP_F2,
-                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
-                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_NEG
-    }, {
-        /* Parent != 0, Zero neighbourhood, sign predict > 0 */
-        .follow = { ARITH_CONTEXT_NPZN_F1, ARITH_CONTEXT_NP_F2,
-                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
-                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_POS
-    },
-
-
-    {
-        /* Parent != 0, No Zero neighbourhood, sign predict 0 */
-        .follow = { ARITH_CONTEXT_NPNN_F1, ARITH_CONTEXT_NP_F2,
-                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
-                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_ZERO
-    }, {
-        /* Parent != 0, No Zero neighbourhood, sign predict < 0 */
-        .follow = { ARITH_CONTEXT_NPNN_F1, ARITH_CONTEXT_NP_F2,
-                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
-                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_NEG
-    }, {
-        /* Parent != 0, No Zero neighbourhood, sign predict > 0 */
-        .follow = { ARITH_CONTEXT_NPNN_F1, ARITH_CONTEXT_NP_F2,
-                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
-                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
-        .data = ARITH_CONTEXT_COEFF_DATA,
-        .sign = ARITH_CONTEXT_SIGN_POS
-    }
-};
-
 const struct dirac_block_params ff_dirac_block_param_defaults[] = {
     {  8,  8,  4,  4 },
     { 12, 12,  8,  8 },

Modified: dirac/libavcodec/dirac.h
==============================================================================
--- dirac/libavcodec/dirac.h	(original)
+++ dirac/libavcodec/dirac.h	Wed Dec 10 01:42:19 2008
@@ -128,12 +128,6 @@ struct globalmc_parameters {
     unsigned int perspective_exp;
 };
 
-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
 #define DIRAC_REF_MASK_REF2   2
 #define DIRAC_REF_MASK_GLOBAL 4

Modified: dirac/libavcodec/dirac_arith.c
==============================================================================
--- dirac/libavcodec/dirac_arith.c	(original)
+++ dirac/libavcodec/dirac_arith.c	Wed Dec 10 01:42:19 2008
@@ -62,6 +62,137 @@ static uint16_t arith_lookup[256] = {
     805, 750,   690,  625,  553,  471,  376,  255
 };
 
+struct dirac_arith_context_set ff_dirac_context_set_split =
+    {
+        .follow = { ARITH_CONTEXT_SB_F1, ARITH_CONTEXT_SB_F2,
+                    ARITH_CONTEXT_SB_F2, ARITH_CONTEXT_SB_F2,
+                    ARITH_CONTEXT_SB_F2, ARITH_CONTEXT_SB_F2 },
+        .data = ARITH_CONTEXT_SB_DATA
+    };
+
+struct dirac_arith_context_set ff_dirac_context_set_mv =
+    {
+        .follow = { ARITH_CONTEXT_VECTOR_F1, ARITH_CONTEXT_VECTOR_F2,
+                    ARITH_CONTEXT_VECTOR_F3, ARITH_CONTEXT_VECTOR_F4,
+                    ARITH_CONTEXT_VECTOR_F5, ARITH_CONTEXT_VECTOR_F5 },
+        .data = ARITH_CONTEXT_VECTOR_DATA,
+        .sign = ARITH_CONTEXT_VECTOR_SIGN
+    };
+
+struct dirac_arith_context_set ff_dirac_context_set_dc =
+    {
+        .follow = { ARITH_CONTEXT_DC_F1, ARITH_CONTEXT_DC_F2,
+                    ARITH_CONTEXT_DC_F2, ARITH_CONTEXT_DC_F2,
+                    ARITH_CONTEXT_DC_F2, ARITH_CONTEXT_DC_F2 },
+        .data = ARITH_CONTEXT_DC_DATA,
+        .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 */
+        .follow = { ARITH_CONTEXT_ZPZN_F1, ARITH_CONTEXT_ZP_F2,
+                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
+                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_ZERO,
+    }, {
+        /* Parent = 0, Zero neighbourhood, sign predict < 0 */
+        .follow = { ARITH_CONTEXT_ZPZN_F1, ARITH_CONTEXT_ZP_F2,
+                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
+                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_NEG
+    }, {
+        /* Parent = 0, Zero neighbourhood, sign predict > 0 */
+        .follow = { ARITH_CONTEXT_ZPZN_F1, ARITH_CONTEXT_ZP_F2,
+                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
+                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_POS
+    },
+
+    {
+        /* Parent = 0, No Zero neighbourhood, sign predict  0 */
+        .follow = { ARITH_CONTEXT_ZPNN_F1, ARITH_CONTEXT_ZP_F2,
+                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
+                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_ZERO
+    }, {
+        /* Parent = 0, No Zero neighbourhood, sign predict < 0 */
+        .follow = { ARITH_CONTEXT_ZPNN_F1, ARITH_CONTEXT_ZP_F2,
+                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
+                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_NEG
+    }, {
+        /* Parent = 0, No Zero neighbourhood, sign predict > 0 */
+        .follow = { ARITH_CONTEXT_ZPNN_F1, ARITH_CONTEXT_ZP_F2,
+                    ARITH_CONTEXT_ZP_F3, ARITH_CONTEXT_ZP_F4,
+                    ARITH_CONTEXT_ZP_F5, ARITH_CONTEXT_ZP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_POS
+    },
+
+    {
+        /* Parent != 0, Zero neighbourhood, sign predict 0 */
+        .follow = { ARITH_CONTEXT_NPZN_F1, ARITH_CONTEXT_NP_F2,
+                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
+                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_ZERO
+    }, {
+        /* Parent != 0, Zero neighbourhood, sign predict < 0 */
+        .follow = { ARITH_CONTEXT_NPZN_F1, ARITH_CONTEXT_NP_F2,
+                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
+                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_NEG
+    }, {
+        /* Parent != 0, Zero neighbourhood, sign predict > 0 */
+        .follow = { ARITH_CONTEXT_NPZN_F1, ARITH_CONTEXT_NP_F2,
+                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
+                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_POS
+    },
+
+
+    {
+        /* Parent != 0, No Zero neighbourhood, sign predict 0 */
+        .follow = { ARITH_CONTEXT_NPNN_F1, ARITH_CONTEXT_NP_F2,
+                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
+                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_ZERO
+    }, {
+        /* Parent != 0, No Zero neighbourhood, sign predict < 0 */
+        .follow = { ARITH_CONTEXT_NPNN_F1, ARITH_CONTEXT_NP_F2,
+                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
+                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_NEG
+    }, {
+        /* Parent != 0, No Zero neighbourhood, sign predict > 0 */
+        .follow = { ARITH_CONTEXT_NPNN_F1, ARITH_CONTEXT_NP_F2,
+                    ARITH_CONTEXT_NP_F3, ARITH_CONTEXT_NP_F4,
+                    ARITH_CONTEXT_NP_F5, ARITH_CONTEXT_NP_F6 },
+        .data = ARITH_CONTEXT_COEFF_DATA,
+        .sign = ARITH_CONTEXT_SIGN_POS
+    }
+};
+
+
 static void dirac_arith_init_common(dirac_arith_state arith)
 {
     int i;

Modified: dirac/libavcodec/dirac_arith.h
==============================================================================
--- dirac/libavcodec/dirac_arith.h	(original)
+++ dirac/libavcodec/dirac_arith.h	Wed Dec 10 01:42:19 2008
@@ -95,6 +95,12 @@ struct dirac_arith_context_set {
     unsigned int sign;          ///< context to read the sign
 };
 
+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[];
+
 void dirac_arith_init(dirac_arith_state arith,
                       GetBitContext *gb, int length);
 



More information about the FFmpeg-soc mailing list