Browse code

Dirac: More formating

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Jordi Ortiz authored on 2011/10/28 03:24:17
Showing 6 changed files
... ...
@@ -20,13 +20,14 @@
20 20
  */
21 21
 
22 22
 /**
23
- * @file libavcodec/dirac_arith.c
23
+ * @file
24 24
  * Arithmetic decoder for Dirac
25 25
  * @author Marco Gerards <marco@gnu.org>
26 26
  */
27 27
 
28 28
 #include "dirac_arith.h"
29 29
 
30
+
30 31
 const uint16_t ff_dirac_prob[256] = {
31 32
     0,    2,    5,    8,    11,   15,   20,   24,
32 33
     29,   35,   41,   47,   53,   60,   67,   74,
... ...
@@ -20,7 +20,7 @@
20 20
  */
21 21
 
22 22
 /**
23
- * @file libavcodec/dirac_arith.h
23
+ * @file
24 24
  * Arithmetic decoder for Dirac
25 25
  * @author Marco Gerards <marco@gnu.org>
26 26
  */
... ...
@@ -37,8 +37,6 @@
37 37
 #include "dirac.h"
38 38
 #include "diracdsp.h"
39 39
 
40
-#undef printf
41
-
42 40
 /**
43 41
  * The spec limits the number of wavelet decompositions to 4 for both
44 42
  * level 1 (VC-2) and 128 (long-gop default).
... ...
@@ -74,17 +72,16 @@
74 74
 
75 75
 #define ff_emulated_edge_mc ff_emulated_edge_mc_8 /* Fix: change the calls to this function regarding bit depth */
76 76
 
77
-#define CALC_PADDING(size, depth) \
78
-         (((size + (1 << depth) - 1) >> depth) << depth)
77
+#define CALC_PADDING(size, depth)                       \
78
+    (((size + (1 << depth) - 1) >> depth) << depth)
79 79
 
80 80
 #define DIVRNDUP(a, b) (((a) + (b) - 1) / (b))
81 81
 
82 82
 typedef struct {
83
-  AVFrame avframe;
84
-
83
+    AVFrame avframe;
85 84
     int interpolated[3];    /* 1 if hpel[] is valid */
86
-  uint8_t *hpel[3][4];
87
-  uint8_t *hpel_base[3][4];
85
+    uint8_t *hpel[3][4];
86
+    uint8_t *hpel_base[3][4];
88 87
 } DiracFrame;
89 88
 
90 89
 typedef struct {
... ...
@@ -248,35 +245,35 @@ static const uint8_t default_qmat[][4][4] = {
248 248
 };
249 249
 
250 250
 static const int qscale_tab[MAX_QUANT+1] = {
251
-        4,     5,     6,     7,     8,    10,    11,    13,
252
-       16,    19,    23,    27,    32,    38,    45,    54,
253
-       64,    76,    91,   108,   128,   152,   181,   215,
254
-      256,   304,   362,   431,   512,   609,   724,   861,
255
-     1024,  1218,  1448,  1722,  2048,  2435,  2896,  3444,
256
-     4096,  4871,  5793,  6889,  8192,  9742, 11585, 13777,
251
+    4,     5,     6,     7,     8,    10,    11,    13,
252
+    16,    19,    23,    27,    32,    38,    45,    54,
253
+    64,    76,    91,   108,   128,   152,   181,   215,
254
+    256,   304,   362,   431,   512,   609,   724,   861,
255
+    1024,  1218,  1448,  1722,  2048,  2435,  2896,  3444,
256
+    4096,  4871,  5793,  6889,  8192,  9742, 11585, 13777,
257 257
     16384, 19484, 23170, 27554, 32768, 38968, 46341, 55109,
258 258
     65536, 77936
259 259
 };
260 260
 
261 261
 static const int qoffset_intra_tab[MAX_QUANT+1] = {
262
-        1,     2,     3,     4,     4,     5,     6,     7,
263
-        8,    10,    12,    14,    16,    19,    23,    27,
264
-       32,    38,    46,    54,    64,    76,    91,   108,
265
-      128,   152,   181,   216,   256,   305,   362,   431,
266
-      512,   609,   724,   861,  1024,  1218,  1448,  1722,
267
-     2048,  2436,  2897,  3445,  4096,  4871,  5793,  6889,
268
-     8192,  9742, 11585, 13777, 16384, 19484, 23171, 27555,
262
+    1,     2,     3,     4,     4,     5,     6,     7,
263
+    8,    10,    12,    14,    16,    19,    23,    27,
264
+    32,    38,    46,    54,    64,    76,    91,   108,
265
+    128,   152,   181,   216,   256,   305,   362,   431,
266
+    512,   609,   724,   861,  1024,  1218,  1448,  1722,
267
+    2048,  2436,  2897,  3445,  4096,  4871,  5793,  6889,
268
+    8192,  9742, 11585, 13777, 16384, 19484, 23171, 27555,
269 269
     32768, 38968
270 270
 };
271 271
 
272 272
 static const int qoffset_inter_tab[MAX_QUANT+1] = {
273
-        1,     2,     2,     3,     3,     4,     4,     5,
274
-        6,     7,     9,    10,    12,    14,    17,    20,
275
-       24,    29,    34,    41,    48,    57,    68,    81,
276
-       96,   114,   136,   162,   192,   228,   272,   323,
277
-      384,   457,   543,   646,   768,   913,  1086,  1292,
278
-     1536,  1827,  2172,  2583,  3072,  3653,  4344,  5166,
279
-     6144,  7307,  8689, 10333, 12288, 14613, 17378, 20666,
273
+    1,     2,     2,     3,     3,     4,     4,     5,
274
+    6,     7,     9,    10,    12,    14,    17,    20,
275
+    24,    29,    34,    41,    48,    57,    68,    81,
276
+    96,   114,   136,   162,   192,   228,   272,   323,
277
+    384,   457,   543,   646,   768,   913,  1086,  1292,
278
+    1536,  1827,  2172,  2583,  3072,  3653,  4344,  5166,
279
+    6144,  7307,  8689, 10333, 12288, 14613, 17378, 20666,
280 280
     24576, 29226
281 281
 };
282 282
 
... ...
@@ -20,13 +20,13 @@
20 20
 
21 21
 #include "dsputil.h"
22 22
 #include "diracdsp.h"
23
-//MMX_DISABLE #include "libavcodec/x86/diracdsp_mmx.h"
23
+/* MMX_DISABLE #include "libavcodec/x86/diracdsp_mmx.h" */
24 24
 
25
-#define FILTER(src, stride) \
26
-  ((21*((src)[ 0*stride] + (src)[1*stride]) \
27
-    -7*((src)[-1*stride] + (src)[2*stride]) \
28
-    +3*((src)[-2*stride] + (src)[3*stride]) \
29
-    -1*((src)[-3*stride] + (src)[4*stride]) + 16) >> 5)
25
+#define FILTER(src, stride)                                     \
26
+    ((21*((src)[ 0*stride] + (src)[1*stride])                   \
27
+      -7*((src)[-1*stride] + (src)[2*stride])                   \
28
+      +3*((src)[-2*stride] + (src)[3*stride])                   \
29
+      -1*((src)[-3*stride] + (src)[4*stride]) + 16) >> 5)
30 30
 
31 31
 static void dirac_hpel_filter(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8_t *src,
32 32
                               int stride, int width, int height)
... ...
@@ -50,28 +50,28 @@ static void dirac_hpel_filter(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8
50 50
     }
51 51
 }
52 52
 
53
-#define PIXOP_BILINEAR(PFX, OP, WIDTH) \
54
-static void ff_ ## PFX ## _dirac_pixels ## WIDTH ## _bilinear_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
55
-{\
56
-    int x;\
57
-    const uint8_t *s0 = src[0];\
58
-    const uint8_t *s1 = src[1];\
59
-    const uint8_t *s2 = src[2];\
60
-    const uint8_t *s3 = src[3];\
61
-    const uint8_t *w  = src[4];\
62
-\
63
-    while (h--) {\
64
-        for (x = 0; x < WIDTH; x++) {\
65
-            OP(dst[x], (s0[x]*w[0] + s1[x]*w[1] + s2[x]*w[2] + s3[x]*w[3] + 8) >> 4);\
66
-        }\
67
-\
68
-        dst += stride;\
69
-        s0 += stride;\
70
-        s1 += stride;\
71
-        s2 += stride;\
72
-        s3 += stride;\
73
-    }\
74
-}
53
+#define PIXOP_BILINEAR(PFX, OP, WIDTH)                                  \
54
+    static void ff_ ## PFX ## _dirac_pixels ## WIDTH ## _bilinear_c(uint8_t *dst, const uint8_t *src[5], int stride, int h) \
55
+    {                                                                   \
56
+        int x;                                                          \
57
+        const uint8_t *s0 = src[0];                                     \
58
+        const uint8_t *s1 = src[1];                                     \
59
+        const uint8_t *s2 = src[2];                                     \
60
+        const uint8_t *s3 = src[3];                                     \
61
+        const uint8_t *w  = src[4];                                     \
62
+                                                                        \
63
+        while (h--) {                                                   \
64
+            for (x = 0; x < WIDTH; x++) {                               \
65
+                OP(dst[x], (s0[x]*w[0] + s1[x]*w[1] + s2[x]*w[2] + s3[x]*w[3] + 8) >> 4); \
66
+            }                                                           \
67
+                                                                        \
68
+            dst += stride;                                              \
69
+            s0 += stride;                                               \
70
+            s1 += stride;                                               \
71
+            s2 += stride;                                               \
72
+            s3 += stride;                                               \
73
+        }                                                               \
74
+    }
75 75
 
76 76
 #define OP_PUT(dst, val) (dst) = (val)
77 77
 #define OP_AVG(dst, val) (dst) = (((dst) + (val) + 1)>>1)
... ...
@@ -86,50 +86,50 @@ PIXOP_BILINEAR(avg, OP_AVG, 32)
86 86
 #define op_scale1(x)  block[x] = av_clip_uint8( (block[x]*weight + (1<<(log2_denom-1))) >> log2_denom)
87 87
 #define op_scale2(x)  dst[x] = av_clip_uint8( (src[x]*weights + dst[x]*weightd + (1<<(log2_denom-1))) >> log2_denom)
88 88
 
89
-#define DIRAC_WEIGHT(W) \
90
-static void weight_dirac_pixels ## W ## _c(uint8_t *block, int stride, int log2_denom, \
91
-                                           int weight, int h) { \
92
-    int x; \
93
-    while (h--) { \
94
-        for (x = 0; x < W; x++) { \
95
-            op_scale1(x); \
96
-            op_scale1(x+1); \
97
-        } \
98
-        block += stride; \
99
-    } \
100
-} \
101
-static void biweight_dirac_pixels ## W ## _c(uint8_t *dst, uint8_t *src, int stride, int log2_denom, \
102
-                                             int weightd, int weights, int h) { \
103
-    int x; \
104
-    while (h--) { \
105
-        for (x = 0; x < W; x++) { \
106
-            op_scale2(x); \
107
-            op_scale2(x+1); \
108
-        } \
109
-        dst += stride; \
110
-        src += stride; \
111
-    } \
112
-}
89
+#define DIRAC_WEIGHT(W)                                                 \
90
+    static void weight_dirac_pixels ## W ## _c(uint8_t *block, int stride, int log2_denom, \
91
+                                               int weight, int h) {     \
92
+        int x;                                                          \
93
+        while (h--) {                                                   \
94
+            for (x = 0; x < W; x++) {                                   \
95
+                op_scale1(x);                                           \
96
+                op_scale1(x+1);                                         \
97
+            }                                                           \
98
+            block += stride;                                            \
99
+        }                                                               \
100
+    }                                                                   \
101
+    static void biweight_dirac_pixels ## W ## _c(uint8_t *dst, uint8_t *src, int stride, int log2_denom, \
102
+                                                 int weightd, int weights, int h) { \
103
+        int x;                                                          \
104
+        while (h--) {                                                   \
105
+            for (x = 0; x < W; x++) {                                   \
106
+                op_scale2(x);                                           \
107
+                op_scale2(x+1);                                         \
108
+            }                                                           \
109
+            dst += stride;                                              \
110
+            src += stride;                                              \
111
+        }                                                               \
112
+    }
113 113
 
114 114
 DIRAC_WEIGHT(8)
115 115
 DIRAC_WEIGHT(16)
116 116
 DIRAC_WEIGHT(32)
117 117
 
118
-#define ADD_OBMC(xblen) \
119
-static void add_obmc ## xblen ## _c(uint16_t *dst, const uint8_t *src, int stride, \
120
-                                    const uint8_t *obmc_weight, int yblen) \
121
-{ \
122
-    int x; \
123
-    while (yblen--) { \
124
-        for (x = 0; x < xblen; x += 2) { \
125
-            dst[x  ] += src[x  ] * obmc_weight[x  ]; \
126
-            dst[x+1] += src[x+1] * obmc_weight[x+1]; \
127
-        } \
128
-        dst += stride; \
129
-        src += stride; \
130
-        obmc_weight += 32; \
131
-    } \
132
-}
118
+#define ADD_OBMC(xblen)                                                 \
119
+    static void add_obmc ## xblen ## _c(uint16_t *dst, const uint8_t *src, int stride, \
120
+                                        const uint8_t *obmc_weight, int yblen) \
121
+    {                                                                   \
122
+        int x;                                                          \
123
+        while (yblen--) {                                               \
124
+            for (x = 0; x < xblen; x += 2) {                            \
125
+                dst[x  ] += src[x  ] * obmc_weight[x  ];                \
126
+                dst[x+1] += src[x+1] * obmc_weight[x+1];                \
127
+            }                                                           \
128
+            dst += stride;                                              \
129
+            src += stride;                                              \
130
+            obmc_weight += 32;                                          \
131
+        }                                                               \
132
+    }
133 133
 
134 134
 ADD_OBMC(8)
135 135
 ADD_OBMC(16)
... ...
@@ -167,7 +167,7 @@ static void add_rect_clamped_c(uint8_t *dst, const uint16_t *src, int stride,
167 167
     }
168 168
 }
169 169
 
170
-#define PIXFUNC(PFX, WIDTH) \
170
+#define PIXFUNC(PFX, WIDTH)                                             \
171 171
     c->PFX ## _dirac_pixels_tab[WIDTH>>4][0] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _c; \
172 172
     c->PFX ## _dirac_pixels_tab[WIDTH>>4][1] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l2_c; \
173 173
     c->PFX ## _dirac_pixels_tab[WIDTH>>4][2] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l4_c; \
... ...
@@ -197,5 +197,5 @@ void ff_diracdsp_init(DiracDSPContext *c)
197 197
     PIXFUNC(avg, 16);
198 198
     PIXFUNC(avg, 32);
199 199
 
200
-    //MMX_DISABLE    if (HAVE_MMX) ff_diracdsp_init_mmx(c);
200
+    /* MMX_DISABLE    if (HAVE_MMX) ff_diracdsp_init_mmx(c); */
201 201
 }
... ...
@@ -48,7 +48,7 @@ typedef struct {
48 48
     dirac_biweight_func biweight_dirac_pixels_tab[3];
49 49
 } DiracDSPContext;
50 50
 
51
-#define DECL_DIRAC_PIXOP(PFX, EXT) \
51
+#define DECL_DIRAC_PIXOP(PFX, EXT)                                      \
52 52
     void ff_ ## PFX ## _dirac_pixels8_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h); \
53 53
     void ff_ ## PFX ## _dirac_pixels16_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h); \
54 54
     void ff_ ## PFX ## _dirac_pixels32_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h)
... ...
@@ -26,39 +26,39 @@ void ff_put_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src,
26 26
 void ff_put_signed_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
27 27
 void ff_put_signed_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
28 28
 
29
-#define HPEL_FILTER(MMSIZE, EXT) \
30
-void ff_dirac_hpel_filter_v_ ## EXT(uint8_t *, uint8_t *, int, int);\
31
-void ff_dirac_hpel_filter_h_ ## EXT(uint8_t *, uint8_t *, int);\
32
-\
33
-static void dirac_hpel_filter_ ## EXT(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc,\
34
-                                      uint8_t *src, int stride, int width, int height)\
35
-{\
36
-    while( height-- )\
37
-    {\
38
-        ff_dirac_hpel_filter_v_ ## EXT(dstv-MMSIZE, src-MMSIZE, stride, width+MMSIZE+5);\
39
-        ff_dirac_hpel_filter_h_ ## EXT(dsth, src, width);\
40
-        ff_dirac_hpel_filter_h_ ## EXT(dstc, dstv, width);\
41
-\
42
-        dsth += stride;\
43
-        dstv += stride;\
44
-        dstc += stride;\
45
-        src  += stride;\
46
-    }\
47
-}
29
+#define HPEL_FILTER(MMSIZE, EXT)                                                             \
30
+    void ff_dirac_hpel_filter_v_ ## EXT(uint8_t *, uint8_t *, int, int);                     \
31
+    void ff_dirac_hpel_filter_h_ ## EXT(uint8_t *, uint8_t *, int);                          \
32
+                                                                                             \
33
+    static void dirac_hpel_filter_ ## EXT(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc,       \
34
+                                          uint8_t *src, int stride, int width, int height)   \
35
+    {                                                                                        \
36
+        while( height-- )                                                                    \
37
+        {                                                                                    \
38
+            ff_dirac_hpel_filter_v_ ## EXT(dstv-MMSIZE, src-MMSIZE, stride, width+MMSIZE+5); \
39
+            ff_dirac_hpel_filter_h_ ## EXT(dsth, src, width);                                \
40
+            ff_dirac_hpel_filter_h_ ## EXT(dstc, dstv, width);                               \
41
+                                                                                             \
42
+            dsth += stride;                                                                  \
43
+            dstv += stride;                                                                  \
44
+            dstc += stride;                                                                  \
45
+            src  += stride;                                                                  \
46
+        }                                                                                    \
47
+    }
48 48
 
49 49
 #if !ARCH_X86_64
50 50
 HPEL_FILTER(8, mmx)
51 51
 #endif
52 52
 HPEL_FILTER(16, sse2)
53 53
 
54
-#define PIXFUNC(PFX, IDX, EXT) \
55
-    c->PFX ## _dirac_pixels_tab[0][IDX] = ff_ ## PFX ## _dirac_pixels8_ ## EXT; \
54
+#define PIXFUNC(PFX, IDX, EXT)                                                   \
55
+    c->PFX ## _dirac_pixels_tab[0][IDX] = ff_ ## PFX ## _dirac_pixels8_ ## EXT;  \
56 56
     c->PFX ## _dirac_pixels_tab[1][IDX] = ff_ ## PFX ## _dirac_pixels16_ ## EXT; \
57 57
     c->PFX ## _dirac_pixels_tab[2][IDX] = ff_ ## PFX ## _dirac_pixels32_ ## EXT
58 58
 
59 59
 void ff_diracdsp_init_mmx(DiracDSPContext* c)
60 60
 {
61
-  int mm_flags = av_get_cpu_flags();;
61
+    int mm_flags = av_get_cpu_flags();;
62 62
 
63 63
 #if HAVE_YASM
64 64
     c->add_dirac_obmc[0] = ff_add_dirac_obmc8_mmx;