... | ... |
@@ -2631,6 +2631,9 @@ For example: |
2631 | 2631 |
will create two separate outputs from the same input, one cropped and |
2632 | 2632 |
one padded. |
2633 | 2633 |
|
2634 |
+@section swapuv |
|
2635 |
+Swap U & V plane. |
|
2636 |
+ |
|
2634 | 2637 |
@section thumbnail |
2635 | 2638 |
Select the most representative frame in a given sequence of consecutive frames. |
2636 | 2639 |
|
... | ... |
@@ -87,6 +87,7 @@ OBJS-$(CONFIG_SETTB_FILTER) += vf_settb.o |
87 | 87 |
OBJS-$(CONFIG_SHOWINFO_FILTER) += vf_showinfo.o |
88 | 88 |
OBJS-$(CONFIG_SLICIFY_FILTER) += vf_slicify.o |
89 | 89 |
OBJS-$(CONFIG_SPLIT_FILTER) += vf_split.o |
90 |
+OBJS-$(CONFIG_SWAPUV_FILTER) += vf_swapuv.o |
|
90 | 91 |
OBJS-$(CONFIG_THUMBNAIL_FILTER) += vf_thumbnail.o |
91 | 92 |
OBJS-$(CONFIG_TINTERLACE_FILTER) += vf_tinterlace.o |
92 | 93 |
OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o |
... | ... |
@@ -95,6 +95,7 @@ void avfilter_register_all(void) |
95 | 95 |
REGISTER_FILTER (SHOWINFO, showinfo, vf); |
96 | 96 |
REGISTER_FILTER (SLICIFY, slicify, vf); |
97 | 97 |
REGISTER_FILTER (SPLIT, split, vf); |
98 |
+ REGISTER_FILTER (SWAPUV, swapuv, vf); |
|
98 | 99 |
REGISTER_FILTER (THUMBNAIL, thumbnail, vf); |
99 | 100 |
REGISTER_FILTER (TINTERLACE, tinterlace, vf); |
100 | 101 |
REGISTER_FILTER (TRANSPOSE, transpose, vf); |
... | ... |
@@ -29,7 +29,7 @@ |
29 | 29 |
#include "libavutil/avutil.h" |
30 | 30 |
|
31 | 31 |
#define LIBAVFILTER_VERSION_MAJOR 2 |
32 |
-#define LIBAVFILTER_VERSION_MINOR 63 |
|
32 |
+#define LIBAVFILTER_VERSION_MINOR 64 |
|
33 | 33 |
#define LIBAVFILTER_VERSION_MICRO 100 |
34 | 34 |
|
35 | 35 |
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
36 | 36 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,93 @@ |
0 |
+/* |
|
1 |
+ * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at> |
|
2 |
+ * |
|
3 |
+ * This file is part of FFmpeg. |
|
4 |
+ * |
|
5 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * @file |
|
22 |
+ * swap UV filter |
|
23 |
+ */ |
|
24 |
+ |
|
25 |
+#include "avfilter.h" |
|
26 |
+ |
|
27 |
+static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, |
|
28 |
+ int w, int h) |
|
29 |
+{ |
|
30 |
+ AVFilterBufferRef *picref = |
|
31 |
+ avfilter_default_get_video_buffer(link, perms, w, h); |
|
32 |
+ uint8_t *tmp; |
|
33 |
+ int tmp2; |
|
34 |
+ |
|
35 |
+ tmp = picref->data[2]; |
|
36 |
+ picref->data[2] = picref->data[1]; |
|
37 |
+ picref->data[1] = tmp; |
|
38 |
+ |
|
39 |
+ tmp2 = picref->linesize[2]; |
|
40 |
+ picref->linesize[2] = picref->linesize[1]; |
|
41 |
+ picref->linesize[1] = tmp2; |
|
42 |
+ |
|
43 |
+ return picref; |
|
44 |
+} |
|
45 |
+ |
|
46 |
+static void start_frame(AVFilterLink *link, AVFilterBufferRef *inpicref) |
|
47 |
+{ |
|
48 |
+ AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0); |
|
49 |
+ |
|
50 |
+ outpicref->data[1] = inpicref->data[2]; |
|
51 |
+ outpicref->data[2] = inpicref->data[1]; |
|
52 |
+ |
|
53 |
+ outpicref->linesize[1] = inpicref->linesize[2]; |
|
54 |
+ outpicref->linesize[2] = inpicref->linesize[1]; |
|
55 |
+ |
|
56 |
+ avfilter_start_frame(link->dst->outputs[0], outpicref); |
|
57 |
+} |
|
58 |
+ |
|
59 |
+static int query_formats(AVFilterContext *ctx) |
|
60 |
+{ |
|
61 |
+ static const enum PixelFormat pix_fmts[] = { |
|
62 |
+ PIX_FMT_YUV420P, PIX_FMT_YUVJ420P, PIX_FMT_YUVA420P, |
|
63 |
+ PIX_FMT_YUV444P, PIX_FMT_YUVJ444P, PIX_FMT_YUVA444P, |
|
64 |
+ PIX_FMT_YUV440P, PIX_FMT_YUVJ440P, |
|
65 |
+ PIX_FMT_YUV422P, PIX_FMT_YUVJ422P, |
|
66 |
+ PIX_FMT_YUV411P, |
|
67 |
+ PIX_FMT_NONE, |
|
68 |
+ }; |
|
69 |
+ |
|
70 |
+ avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts)); |
|
71 |
+ return 0; |
|
72 |
+} |
|
73 |
+ |
|
74 |
+AVFilter avfilter_vf_swapuv = { |
|
75 |
+ .name = "swapuv", |
|
76 |
+ .description = NULL_IF_CONFIG_SMALL("Swap U and V components."), |
|
77 |
+ .priv_size = 0, |
|
78 |
+ .query_formats = query_formats, |
|
79 |
+ |
|
80 |
+ .inputs = (const AVFilterPad[]) { |
|
81 |
+ { .name = "default", |
|
82 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
83 |
+ .get_video_buffer = get_video_buffer, |
|
84 |
+ .start_frame = start_frame, }, |
|
85 |
+ { .name = NULL } |
|
86 |
+ }, |
|
87 |
+ .outputs = (const AVFilterPad[]) { |
|
88 |
+ { .name = "default", |
|
89 |
+ .type = AVMEDIA_TYPE_VIDEO, }, |
|
90 |
+ { .name = NULL } |
|
91 |
+ }, |
|
92 |
+}; |