Add copy filter, useful for testing the avfilter_draw_slice() copy
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 28 Dec 2010 01:01:09 +0000 (01:01 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 28 Dec 2010 01:01:09 +0000 (01:01 +0000)
code.

Originally committed as revision 26112 to svn://svn.ffmpeg.org/ffmpeg/trunk

configure
doc/filters.texi
libavfilter/Makefile
libavfilter/allfilters.c
libavfilter/avfilter.h
libavfilter/vf_copy.c [new file with mode: 0644]
tests/lavfi-regression.sh
tests/ref/lavfi/pixfmts_copy_le [new file with mode: 0644]

index 3176a89..60d26b9 100755 (executable)
--- a/configure
+++ b/configure
@@ -1527,6 +1527,7 @@ test_deps _muxer _demuxer                                               \
 mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
 
 set_ne_test_deps pixdesc
+set_ne_test_deps pixfmts_copy
 set_ne_test_deps pixfmts_crop
 set_ne_test_deps pixfmts_hflip
 set_ne_test_deps pixfmts_null
index c4b132d..0039044 100644 (file)
@@ -183,6 +183,11 @@ threshold, and defaults to 98.
 @var{threshold} is the threshold below which a pixel value is
 considered black, and defaults to 32.
 
+@section copy
+
+Copy the input source unchanged to the output. Mainly useful for
+testing purposes.
+
 @section crop
 
 Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}.
index a010fd9..fdb181e 100644 (file)
@@ -20,6 +20,7 @@ OBJS-$(CONFIG_ANULLSRC_FILTER)               += asrc_anullsrc.o
 OBJS-$(CONFIG_ANULLSINK_FILTER)              += asink_anullsink.o
 
 OBJS-$(CONFIG_BLACKFRAME_FILTER)             += vf_blackframe.o
+OBJS-$(CONFIG_COPY_FILTER)                   += vf_copy.o
 OBJS-$(CONFIG_CROP_FILTER)                   += vf_crop.o
 OBJS-$(CONFIG_CROPDETECT_FILTER)             += vf_cropdetect.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)                += vf_drawbox.o
index 886a50a..1dffb80 100644 (file)
@@ -41,6 +41,7 @@ void avfilter_register_all(void)
     REGISTER_FILTER (ANULLSINK,   anullsink,   asink);
 
     REGISTER_FILTER (BLACKFRAME,  blackframe,  vf);
+    REGISTER_FILTER (COPY,        copy,        vf);
     REGISTER_FILTER (CROP,        crop,        vf);
     REGISTER_FILTER (CROPDETECT,  cropdetect,  vf);
     REGISTER_FILTER (DRAWBOX,     drawbox,     vf);
index c52aeab..02b513f 100644 (file)
@@ -27,7 +27,7 @@
 #include "libavcore/samplefmt.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  1
-#define LIBAVFILTER_VERSION_MINOR 71
+#define LIBAVFILTER_VERSION_MINOR 72
 #define LIBAVFILTER_VERSION_MICRO  0
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_copy.c b/libavfilter/vf_copy.c
new file mode 100644 (file)
index 0000000..480ebcc
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * copy video filter
+ */
+
+#include "avfilter.h"
+
+AVFilter avfilter_vf_copy = {
+    .name      = "copy",
+    .description = NULL_IF_CONFIG_SMALL("Copy the input video unchanged to the output."),
+
+    .inputs    = (AVFilterPad[]) {{ .name             = "default",
+                                    .type             = AVMEDIA_TYPE_VIDEO,
+                                    .get_video_buffer = avfilter_null_get_video_buffer,
+                                    .start_frame      = avfilter_null_start_frame,
+                                    .end_frame        = avfilter_null_end_frame,
+                                    .rej_perms        = ~0 },
+                                  { .name = NULL}},
+    .outputs   = (AVFilterPad[]) {{ .name             = "default",
+                                    .type             = AVMEDIA_TYPE_VIDEO, },
+                                  { .name = NULL}},
+};
index a3e75dd..f9f9f7c 100755 (executable)
@@ -58,6 +58,7 @@ do_lavfi_pixfmts(){
 }
 
 # all these filters have exactly one input and exactly one output
+do_lavfi_pixfmts "copy"    ""
 do_lavfi_pixfmts "crop"    "100:100:100:100"
 do_lavfi_pixfmts "hflip"   ""
 do_lavfi_pixfmts "null"    ""
diff --git a/tests/ref/lavfi/pixfmts_copy_le b/tests/ref/lavfi/pixfmts_copy_le
new file mode 100644 (file)
index 0000000..4a3a738
--- /dev/null
@@ -0,0 +1,84 @@
+037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/pixfmts_copy_le-abgr.nut
+20276703 ./tests/data/lavfi/pixfmts_copy_le-abgr.nut
+c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/pixfmts_copy_le-argb.nut
+20276703 ./tests/data/lavfi/pixfmts_copy_le-argb.nut
+0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/pixfmts_copy_le-bgr24.nut
+15207903 ./tests/data/lavfi/pixfmts_copy_le-bgr24.nut
+50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/pixfmts_copy_le-bgr4_byte.nut
+5070254 ./tests/data/lavfi/pixfmts_copy_le-bgr4_byte.nut
+378d6ac4223651a1adcbf94a3d0d807b *./tests/data/lavfi/pixfmts_copy_le-bgr555le.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-bgr555le.nut
+1dfdd03995c287e3c754b164bf26a355 *./tests/data/lavfi/pixfmts_copy_le-bgr565le.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-bgr565le.nut
+24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/pixfmts_copy_le-bgr8.nut
+5070254 ./tests/data/lavfi/pixfmts_copy_le-bgr8.nut
+76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/pixfmts_copy_le-bgra.nut
+20276703 ./tests/data/lavfi/pixfmts_copy_le-bgra.nut
+db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/pixfmts_copy_le-gray.nut
+5070254 ./tests/data/lavfi/pixfmts_copy_le-gray.nut
+7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/pixfmts_copy_le-gray16be.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-gray16be.nut
+10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/pixfmts_copy_le-gray16le.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-gray16le.nut
+668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/pixfmts_copy_le-monob.nut
+634329 ./tests/data/lavfi/pixfmts_copy_le-monob.nut
+9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/pixfmts_copy_le-monow.nut
+634329 ./tests/data/lavfi/pixfmts_copy_le-monow.nut
+e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/pixfmts_copy_le-nv12.nut
+7604654 ./tests/data/lavfi/pixfmts_copy_le-nv12.nut
+9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/pixfmts_copy_le-nv21.nut
+7604654 ./tests/data/lavfi/pixfmts_copy_le-nv21.nut
+b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/pixfmts_copy_le-rgb24.nut
+15207903 ./tests/data/lavfi/pixfmts_copy_le-rgb24.nut
+460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/pixfmts_copy_le-rgb48be.nut
+30414303 ./tests/data/lavfi/pixfmts_copy_le-rgb48be.nut
+cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/pixfmts_copy_le-rgb48le.nut
+30414303 ./tests/data/lavfi/pixfmts_copy_le-rgb48le.nut
+c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/pixfmts_copy_le-rgb4_byte.nut
+5070254 ./tests/data/lavfi/pixfmts_copy_le-rgb4_byte.nut
+a937a0fc764fb57dc1b3af87cba0273c *./tests/data/lavfi/pixfmts_copy_le-rgb555le.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-rgb555le.nut
+d39aa298bb525e9be8860351c6f62dab *./tests/data/lavfi/pixfmts_copy_le-rgb565le.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-rgb565le.nut
+4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/pixfmts_copy_le-rgb8.nut
+5070254 ./tests/data/lavfi/pixfmts_copy_le-rgb8.nut
+93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/pixfmts_copy_le-rgba.nut
+20276703 ./tests/data/lavfi/pixfmts_copy_le-rgba.nut
+adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/pixfmts_copy_le-uyvy422.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-uyvy422.nut
+2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/pixfmts_copy_le-yuv410p.nut
+5703854 ./tests/data/lavfi/pixfmts_copy_le-yuv410p.nut
+8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/pixfmts_copy_le-yuv411p.nut
+7604654 ./tests/data/lavfi/pixfmts_copy_le-yuv411p.nut
+eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/pixfmts_copy_le-yuv420p.nut
+7604654 ./tests/data/lavfi/pixfmts_copy_le-yuv420p.nut
+16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/pixfmts_copy_le-yuv420p16be.nut
+15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv420p16be.nut
+2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/pixfmts_copy_le-yuv420p16le.nut
+15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv420p16le.nut
+c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/pixfmts_copy_le-yuv422p.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-yuv422p.nut
+5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/pixfmts_copy_le-yuv422p16be.nut
+20276703 ./tests/data/lavfi/pixfmts_copy_le-yuv422p16be.nut
+e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/pixfmts_copy_le-yuv422p16le.nut
+20276703 ./tests/data/lavfi/pixfmts_copy_le-yuv422p16le.nut
+5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/pixfmts_copy_le-yuv440p.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-yuv440p.nut
+0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/pixfmts_copy_le-yuv444p.nut
+15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv444p.nut
+ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/pixfmts_copy_le-yuv444p16be.nut
+30414303 ./tests/data/lavfi/pixfmts_copy_le-yuv444p16be.nut
+1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/pixfmts_copy_le-yuv444p16le.nut
+30414303 ./tests/data/lavfi/pixfmts_copy_le-yuv444p16le.nut
+a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/pixfmts_copy_le-yuva420p.nut
+12673454 ./tests/data/lavfi/pixfmts_copy_le-yuva420p.nut
+32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/pixfmts_copy_le-yuvj420p.nut
+7604654 ./tests/data/lavfi/pixfmts_copy_le-yuvj420p.nut
+0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/pixfmts_copy_le-yuvj422p.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-yuvj422p.nut
+9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/pixfmts_copy_le-yuvj440p.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-yuvj440p.nut
+ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/pixfmts_copy_le-yuvj444p.nut
+15207903 ./tests/data/lavfi/pixfmts_copy_le-yuvj444p.nut
+f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/pixfmts_copy_le-yuyv422.nut
+10139054 ./tests/data/lavfi/pixfmts_copy_le-yuyv422.nut