Browse code

vf_transpose: K&R formatting cosmetics

Vittorio Giovara authored on 2014/03/25 16:39:24
Showing 1 changed files
... ...
@@ -27,11 +27,12 @@
27 27
 
28 28
 #include <stdio.h>
29 29
 
30
-#include "libavutil/intreadwrite.h"
31
-#include "libavutil/pixdesc.h"
32 30
 #include "libavutil/imgutils.h"
33 31
 #include "libavutil/internal.h"
32
+#include "libavutil/intreadwrite.h"
34 33
 #include "libavutil/opt.h"
34
+#include "libavutil/pixdesc.h"
35
+
35 36
 #include "avfilter.h"
36 37
 #include "formats.h"
37 38
 #include "internal.h"
... ...
@@ -98,12 +99,14 @@ static int config_props_output(AVFilterLink *outlink)
98 98
     outlink->w = inlink->h;
99 99
     outlink->h = inlink->w;
100 100
 
101
-    if (inlink->sample_aspect_ratio.num){
102
-        outlink->sample_aspect_ratio = av_div_q((AVRational){1,1}, inlink->sample_aspect_ratio);
103
-    } else
101
+    if (inlink->sample_aspect_ratio.num)
102
+        outlink->sample_aspect_ratio = av_div_q((AVRational) { 1, 1 },
103
+                                                inlink->sample_aspect_ratio);
104
+    else
104 105
         outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
105 106
 
106
-    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
107
+    av_log(ctx, AV_LOG_VERBOSE,
108
+           "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
107 109
            inlink->w, inlink->h, trans->dir, outlink->w, outlink->h,
108 110
            trans->dir == 1 || trans->dir == 3 ? "clockwise" : "counterclockwise",
109 111
            trans->dir == 0 || trans->dir == 3);
... ...
@@ -133,28 +136,28 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
133 133
     }
134 134
 
135 135
     for (plane = 0; out->data[plane]; plane++) {
136
-        int hsub = plane == 1 || plane == 2 ? trans->hsub : 0;
137
-        int vsub = plane == 1 || plane == 2 ? trans->vsub : 0;
136
+        int hsub    = plane == 1 || plane == 2 ? trans->hsub : 0;
137
+        int vsub    = plane == 1 || plane == 2 ? trans->vsub : 0;
138 138
         int pixstep = trans->pixsteps[plane];
139
-        int inh  = in->height  >> vsub;
140
-        int outw = out->width  >> hsub;
141
-        int outh = out->height >> vsub;
139
+        int inh     = in->height >> vsub;
140
+        int outw    = out->width >> hsub;
141
+        int outh    = out->height >> vsub;
142 142
         uint8_t *dst, *src;
143 143
         int dstlinesize, srclinesize;
144 144
         int x, y;
145 145
 
146
-        dst = out->data[plane];
146
+        dst         = out->data[plane];
147 147
         dstlinesize = out->linesize[plane];
148
-        src = in->data[plane];
148
+        src         = in->data[plane];
149 149
         srclinesize = in->linesize[plane];
150 150
 
151
-        if (trans->dir&1) {
152
-            src +=  in->linesize[plane] * (inh-1);
151
+        if (trans->dir & 1) {
152
+            src         += in->linesize[plane] * (inh - 1);
153 153
             srclinesize *= -1;
154 154
         }
155 155
 
156
-        if (trans->dir&2) {
157
-            dst += out->linesize[plane] * (outh-1);
156
+        if (trans->dir & 2) {
157
+            dst         += out->linesize[plane] * (outh - 1);
158 158
             dstlinesize *= -1;
159 159
         }
160 160
 
... ...
@@ -162,21 +165,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
162 162
             switch (pixstep) {
163 163
             case 1:
164 164
                 for (x = 0; x < outw; x++)
165
-                    dst[x] = src[x*srclinesize + y];
165
+                    dst[x] = src[x * srclinesize + y];
166 166
                 break;
167 167
             case 2:
168 168
                 for (x = 0; x < outw; x++)
169
-                    *((uint16_t *)(dst + 2*x)) = *((uint16_t *)(src + x*srclinesize + y*2));
169
+                    *((uint16_t *)(dst + 2 * x)) =
170
+                        *((uint16_t *)(src + x * srclinesize + y * 2));
170 171
                 break;
171 172
             case 3:
172 173
                 for (x = 0; x < outw; x++) {
173
-                    int32_t v = AV_RB24(src + x*srclinesize + y*3);
174
-                    AV_WB24(dst + 3*x, v);
174
+                    int32_t v = AV_RB24(src + x * srclinesize + y * 3);
175
+                    AV_WB24(dst + 3 * x, v);
175 176
                 }
176 177
                 break;
177 178
             case 4:
178 179
                 for (x = 0; x < outw; x++)
179
-                    *((uint32_t *)(dst + 4*x)) = *((uint32_t *)(src + x*srclinesize + y*4));
180
+                    *((uint32_t *)(dst + 4 * x)) =
181
+                        *((uint32_t *)(src + x * srclinesize + y * 4));
180 182
                 break;
181 183
             }
182 184
             dst += dstlinesize;
... ...
@@ -208,8 +213,8 @@ static const AVClass transpose_class = {
208 208
 
209 209
 static const AVFilterPad avfilter_vf_transpose_inputs[] = {
210 210
     {
211
-        .name        = "default",
212
-        .type        = AVMEDIA_TYPE_VIDEO,
211
+        .name         = "default",
212
+        .type         = AVMEDIA_TYPE_VIDEO,
213 213
         .filter_frame = filter_frame,
214 214
     },
215 215
     { NULL }
... ...
@@ -225,14 +230,11 @@ static const AVFilterPad avfilter_vf_transpose_outputs[] = {
225 225
 };
226 226
 
227 227
 AVFilter ff_vf_transpose = {
228
-    .name      = "transpose",
229
-    .description = NULL_IF_CONFIG_SMALL("Transpose input video."),
230
-
231
-    .priv_size = sizeof(TransContext),
232
-    .priv_class = &transpose_class,
233
-
228
+    .name          = "transpose",
229
+    .description   = NULL_IF_CONFIG_SMALL("Transpose input video."),
230
+    .priv_size     = sizeof(TransContext),
231
+    .priv_class    = &transpose_class,
234 232
     .query_formats = query_formats,
235
-
236
-    .inputs    = avfilter_vf_transpose_inputs,
237
-    .outputs   = avfilter_vf_transpose_outputs,
233
+    .inputs        = avfilter_vf_transpose_inputs,
234
+    .outputs       = avfilter_vf_transpose_outputs,
238 235
 };