avfilter: various cosmetics
[ffmpeg.git] / libavfilter / vf_transpose.c
index 82f68e5..8daeeaf 100644 (file)
@@ -174,38 +174,46 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
             dstlinesize *= -1;
         }
 
-        for (y = start; y < end; y++) {
-            switch (pixstep) {
-            case 1:
+        switch (pixstep) {
+        case 1:
+            for (y = start; y < end; y++, dst += dstlinesize)
                 for (x = 0; x < outw; x++)
                     dst[x] = src[x*srclinesize + y];
-                break;
-            case 2:
+            break;
+        case 2:
+            for (y = start; y < end; y++, dst += dstlinesize) {
                 for (x = 0; x < outw; x++)
                     *((uint16_t *)(dst + 2*x)) = *((uint16_t *)(src + x*srclinesize + y*2));
-                break;
-            case 3:
+            }
+            break;
+        case 3:
+            for (y = start; y < end; y++, dst += dstlinesize) {
                 for (x = 0; x < outw; x++) {
                     int32_t v = AV_RB24(src + x*srclinesize + y*3);
                     AV_WB24(dst + 3*x, v);
                 }
-                break;
-            case 4:
+            }
+            break;
+        case 4:
+            for (y = start; y < end; y++, dst += dstlinesize) {
                 for (x = 0; x < outw; x++)
                     *((uint32_t *)(dst + 4*x)) = *((uint32_t *)(src + x*srclinesize + y*4));
-                break;
-            case 6:
+            }
+            break;
+        case 6:
+            for (y = start; y < end; y++, dst += dstlinesize) {
                 for (x = 0; x < outw; x++) {
                     int64_t v = AV_RB48(src + x*srclinesize + y*6);
                     AV_WB48(dst + 6*x, v);
                 }
-                break;
-            case 8:
+            }
+            break;
+        case 8:
+            for (y = start; y < end; y++, dst += dstlinesize) {
                 for (x = 0; x < outw; x++)
                     *((uint64_t *)(dst + 8*x)) = *((uint64_t *)(src + x*srclinesize + y*8));
-                break;
             }
-            dst += dstlinesize;
+            break;
         }
     }
 
@@ -228,8 +236,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         av_frame_free(&in);
         return AVERROR(ENOMEM);
     }
-
-    out->pts = in->pts;
+    av_frame_copy_props(out, in);
 
     if (in->sample_aspect_ratio.num == 0) {
         out->sample_aspect_ratio = in->sample_aspect_ratio;
@@ -260,17 +267,17 @@ static const AVOption transpose_options[] = {
         { "portrait",  "preserve portrait geometry",   0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_PORTRAIT},  INT_MIN, INT_MAX, FLAGS, "passthrough" },
         { "landscape", "preserve landscape geometry",  0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_LANDSCAPE}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
 
-    { NULL },
+    { NULL }
 };
 
 AVFILTER_DEFINE_CLASS(transpose);
 
 static const AVFilterPad avfilter_vf_transpose_inputs[] = {
     {
-        .name        = "default",
-        .type        = AVMEDIA_TYPE_VIDEO,
-        .get_video_buffer= get_video_buffer,
-        .filter_frame = filter_frame,
+        .name             = "default",
+        .type             = AVMEDIA_TYPE_VIDEO,
+        .get_video_buffer = get_video_buffer,
+        .filter_frame     = filter_frame,
     },
     { NULL }
 };
@@ -285,15 +292,12 @@ static const AVFilterPad avfilter_vf_transpose_outputs[] = {
 };
 
 AVFilter avfilter_vf_transpose = {
-    .name      = "transpose",
-    .description = NULL_IF_CONFIG_SMALL("Transpose input video."),
-
-    .priv_size = sizeof(TransContext),
-    .priv_class = &transpose_class,
-
+    .name          = "transpose",
+    .description   = NULL_IF_CONFIG_SMALL("Transpose input video."),
+    .priv_size     = sizeof(TransContext),
+    .priv_class    = &transpose_class,
     .query_formats = query_formats,
-
-    .inputs    = avfilter_vf_transpose_inputs,
-    .outputs   = avfilter_vf_transpose_outputs,
-    .flags     = AVFILTER_FLAG_SLICE_THREADS,
+    .inputs        = avfilter_vf_transpose_inputs,
+    .outputs       = avfilter_vf_transpose_outputs,
+    .flags         = AVFILTER_FLAG_SLICE_THREADS,
 };