summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-06-18 13:53:44 +0200
committerwm4 <wm4@nowhere>2017-06-18 13:55:40 +0200
commitc680cfd18a09f9a023926db0b3a90f69e8651b37 (patch)
tree12968bbb2fd2443cb6cf1df6403a13bfbeb031b4
parent937dcc25adc20872f7b0751ddfecb89acebd05a2 (diff)
downloadmpv-c680cfd18a09f9a023926db0b3a90f69e8651b37.tar.bz2
mpv-c680cfd18a09f9a023926db0b3a90f69e8651b37.tar.xz
vf_dlopen: remove this filter
It was an attempt to move some MPlayer filters (which were removed from mpv) to external, loadable filters. That worked well, but then the MPlayer filters were ported to libavfilter (independently), so they're available again. Also there is a more widely supported and more advanced loadable filter system supported by mpv: vapoursynth. In conclusion, vf_dlopen is not useful anymore, confusing, and requires quite a bit of code (and probably wouldn't survive the rewrite of the mpv video filter chain, which has to come at some point). It has some implicit dependencies on internal conventions, like possibly the format names dropped in the previous commit. We also deprecated it last release. Drop it.
-rw-r--r--Copyright1
-rw-r--r--DOCS/man/vf.rst23
-rw-r--r--TOOLS/vf_dlopen/Makefile50
-rw-r--r--TOOLS/vf_dlopen/filterutils.c40
-rw-r--r--TOOLS/vf_dlopen/filterutils.h27
-rw-r--r--TOOLS/vf_dlopen/framestep.c103
-rw-r--r--TOOLS/vf_dlopen/ildetect.c295
-rwxr-xr-xTOOLS/vf_dlopen/ildetect.sh89
-rw-r--r--TOOLS/vf_dlopen/rectangle.c367
-rw-r--r--TOOLS/vf_dlopen/telecine.c269
-rw-r--r--TOOLS/vf_dlopen/tile.c177
-rw-r--r--video/filter/vf.c4
-rw-r--r--video/filter/vf_dlopen.c350
-rw-r--r--video/filter/vf_dlopen.h93
-rw-r--r--wscript6
-rw-r--r--wscript_build.py12
16 files changed, 0 insertions, 1906 deletions
diff --git a/Copyright b/Copyright
index 13986d8884..78078dbcc4 100644
--- a/Copyright
+++ b/Copyright
@@ -281,7 +281,6 @@ x video/decode/dec_video.* hard
video/filter/vf_buffer.c LGPL
video/filter/vf_crop.c will be deleted
video/filter/vf_d3d11vpp.c LGPL
- video/filter/vf_dlopen.* LGPL
video/filter/vf_dsize.c will be deleted
video/filter/vf_eq.c will be deleted
video/filter/vf_expand.c will be deleted
diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst
index 64e5c0c0cd..c7f4c84d0a 100644
--- a/DOCS/man/vf.rst
+++ b/DOCS/man/vf.rst
@@ -642,29 +642,6 @@ Available mpv-only filters are:
size of the filter in percent of the image diagonal size. This is
used to calculate the final radius size (default: 1).
-
-``dlopen=dll[:a0[:a1[:a2[:a3]]]]``
- Loads an external library to filter the image. The library interface
- is the ``vf_dlopen`` interface specified using ``libmpcodecs/vf_dlopen.h``.
-
- .. warning:: This filter is deprecated.
-
- ``dll=<library>``
- Specify the library to load. This may require a full file system path
- in some cases. This argument is required.
-
- ``a0=<string>``
- Specify the first parameter to pass to the library.
-
- ``a1=<string>``
- Specify the second parameter to pass to the library.
-
- ``a2=<string>``
- Specify the third parameter to pass to the library.
-
- ``a3=<string>``
- Specify the fourth parameter to pass to the library.
-
``vapoursynth=file:buffered-frames:concurrent-frames``
Loads a VapourSynth filter script. This is intended for streamed
processing: mpv actually provides a source filter, instead of using a
diff --git a/TOOLS/vf_dlopen/Makefile b/TOOLS/vf_dlopen/Makefile
deleted file mode 100644
index c6d03cfd2b..0000000000
--- a/TOOLS/vf_dlopen/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
-#
-# This file is part of mpv's vf_dlopen examples.
-#
-# mpv's vf_dlopen examples are free software; you can redistribute them and/or
-# modify them 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.
-#
-# mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 USA
-#
-
-FILTERS = telecine tile rectangle framestep ildetect
-COMMON = filterutils.o
-
-OBJECTS = $(patsubst %,%.o,$(FILTERS)) $(COMMON)
-HEADERS = $(wildcard *.h)
-OUT = $(patsubst %,%.so,$(FILTERS))
-
-CFLAGS ?= -Wall -Wextra -O3 -march=native -mtune=native -ffast-math
-
-CPPFLAGS += -I../../video/filter
-CFLAGS += -fPIC
-LDFLAGS += -shared -fPIC
-
-ifneq ($(LTO),)
-CFLAGS += -flto
-LDFLAGS += $(CFLAGS) -flto
-endif
-
-all: $(OUT)
-
-clean:
- $(RM) $(OBJECTS) $(OUT)
-
-%.so: %.o $(COMMON)
- $(CC) $(LDFLAGS) $(LIBS) -o $@ $(COMMON) $<
-
-# FIXME replace this by real dependency tracking
-%.o: %.c $(HEADERS)
-
diff --git a/TOOLS/vf_dlopen/filterutils.c b/TOOLS/vf_dlopen/filterutils.c
deleted file mode 100644
index 2bafd93dba..0000000000
--- a/TOOLS/vf_dlopen/filterutils.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
- *
- * This file is part of mpv's vf_dlopen examples.
- *
- * mpv's vf_dlopen examples are free software; you can redistribute them and/or
- * modify them 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.
- *
- * mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include <assert.h>
-#include <string.h>
-
-#include "filterutils.h"
-
-void copy_plane(
- unsigned char *dest, unsigned dest_stride,
- const unsigned char *src, unsigned src_stride,
- unsigned length,
- unsigned rows
- )
-{
- unsigned i;
- assert(dest_stride >= length);
- assert(src_stride >= length);
- for (i = 0; i < rows; ++i)
- memcpy(&dest[dest_stride * i], &src[src_stride * i], length);
-}
-
diff --git a/TOOLS/vf_dlopen/filterutils.h b/TOOLS/vf_dlopen/filterutils.h
deleted file mode 100644
index 791adae50d..0000000000
--- a/TOOLS/vf_dlopen/filterutils.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
- *
- * This file is part of mpv's vf_dlopen examples.
- *
- * mpv's vf_dlopen examples are free software; you can redistribute them and/or
- * modify them 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.
- *
- * mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-void copy_plane(
- unsigned char *dest, unsigned dest_stride,
- const unsigned char *src, unsigned src_stride,
- unsigned length,
- unsigned rows
- );
diff --git a/TOOLS/vf_dlopen/framestep.c b/TOOLS/vf_dlopen/framestep.c
deleted file mode 100644
index 11c5afe349..0000000000
--- a/TOOLS/vf_dlopen/framestep.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
- *
- * This file is part of mpv's vf_dlopen examples.
- *
- * mpv's vf_dlopen examples are free software; you can redistribute them and/or
- * modify them 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.
- *
- * mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vf_dlopen.h"
-#include "filterutils.h"
-
-#define MIN(a,b) ((a)<(b)?(a):(b))
-
-/*
- * frame stepping filter
- *
- * usage: --vf=dlopen=/path/to/framestep.so:5
- *
- * outputs every 5th frame
- *
- * usage: --vf=dlopen=/path/to/framestep.so:5:3
- *
- * outputs every 5th frame, starting with frame index 3 (default: 0)
- */
-
-typedef struct {
- int step, pos;
-} framestep_data_t;
-
-static int framestep_put_image(struct vf_dlopen_context *ctx)
-{
- framestep_data_t *framestep = ctx->priv;
-
- // stepping
- if (framestep->pos < 0)
- return 0;
- --framestep->pos;
- if (framestep->pos >= 0)
- return 0;
- framestep->pos += framestep->step;
-
- // copying
- assert(ctx->inpic.planes == ctx->outpic[0].planes);
- int np = ctx->inpic.planes;
- int p;
- for (p = 0; p < np; ++p) {
- assert(ctx->inpic.planewidth[p] == ctx->outpic->planewidth[p]);
- assert(ctx->inpic.planeheight[p] == ctx->outpic->planeheight[p]);
- copy_plane(
- ctx->outpic->plane[p],
- ctx->outpic->planestride[p],
- ctx->inpic.plane[p],
- ctx->inpic.planestride[p],
- MIN(ctx->inpic.planestride[p], ctx->outpic->planestride[p]),
- ctx->inpic.planeheight[p]
- );
- }
- ctx->outpic->pts = ctx->inpic.pts;
-
- return 1;
-}
-
-void framestep_uninit(struct vf_dlopen_context *ctx)
-{
- free(ctx->priv);
-}
-
-int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
-{
- VF_DLOPEN_CHECK_VERSION(ctx);
-
- if (argc != 1 && argc != 2)
- return -1;
-
- framestep_data_t *framestep = calloc(1,sizeof(framestep_data_t));
-
- framestep->step = atoi(argv[0]);
- framestep->pos = (argc >= 2) ? atoi(argv[1]) : 0;
-
- ctx->priv = framestep;
- ctx->put_image = framestep_put_image;
- ctx->uninit = framestep_uninit;
-
- return 1;
-}
diff --git a/TOOLS/vf_dlopen/ildetect.c b/TOOLS/vf_dlopen/ildetect.c
deleted file mode 100644
index d2f3d5bde5..0000000000
--- a/TOOLS/vf_dlopen/ildetect.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
- *
- * This file is part of mpv's vf_dlopen examples.
- *
- * mpv's vf_dlopen examples are free software; you can redistribute them and/or
- * modify them 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.
- *
- * mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "vf_dlopen.h"
-
-#include "filterutils.h"
-
-/*
- * interlacing detector
- *
- * usage: -vf dlopen=./ildetect.so:<method>:<threshold>
- *
- * outputs an interlacing detection report at the end
- *
- * methods:
- * 0 = transcode 32detect (default)
- * 1 = decomb IsCombed
- * 2 = IsCombedTIVTC
- * 3 = simple average
- *
- * threshold:
- * normalized at 1
- */
-
-typedef struct {
- int method;
- double combing_threshold;
- double motion_threshold;
- double motion_amount;
- double yes_threshold;
- double no_threshold;
- double total_yes_threshold;
- double total_no_threshold;
- double tc_threshold;
- double decision_threshold;
- double tc_decision_threshold;
- double lastcombed;
- int numtotalframes;
- int numdecidedframes;
- int totalcombedframes;
- int numjumpingadjacentframes;
- int numdecidedadjacentframes;
- unsigned char *buffer_data;
- size_t buffer_size;
-} ildetect_data_t;
-
-static int il_config(struct vf_dlopen_context *ctx)
-{
- ctx->out_height -= 4;
- ctx->out_d_height = ctx->out_height;
- return 1;
-}
-
-static int il_decision(struct vf_dlopen_context *ctx,
- int p0, int p1, int p2, int p3, int p4)
-{
- ildetect_data_t *il = ctx->priv;
-
- // model for threshold: p0, p2, p4 = 0; p1, p3 = t
- switch (il->method) {
- case 0: { // diff-diff (transcode 32detect)
- int d12 = p1 - p2; // t
- int d13 = p1 - p3; // 0
- if (abs(d12) > 15 * il->combing_threshold &&
- abs(d13) < 10 * il->combing_threshold)
- return 1;
- // true for t > 15
- break;
- }
- case 1: { // multiply (decomb IsCombed)
- int d12 = p1 - p2; // t
- int d32 = p3 - p2; // t
- if (d12 * d32 > pow(il->combing_threshold, 2) * (25*25))
- return 1;
- // true for t > 21
- break;
- }
- case 2: { // blur-blur (IsCombedTIVTC)
- int b024 = p0 + 6 * p2 + p4; // 0
- int b13 = 4 * p1 + 4 * p3; // 8t
- if (abs(b024 - b13) > il->combing_threshold * 8 * 20)
- return 1;
- // true for t > 20
- break;
- }
- case 3: { // average-average
- int d123 = p1 + p3 - 2 * p2; // 2t
- int d024 = p0 + p4 - 2 * p2; // 0
- if ((abs(d123) - abs(d024)) > il->combing_threshold * 30)
- return 1;
- // true for t > 15
- break;
- }
- }
- return 0;
-}
-
-static int il_put_image(struct vf_dlopen_context *ctx)
-{
- ildetect_data_t *il = ctx->priv;
- unsigned int x, y;
- int first_frame = 0;
-
- size_t sz = ctx->inpic.planestride[0] * ctx->inpic.planeheight[0];
- if (sz != il->buffer_size) {
- il->buffer_data = realloc(il->buffer_data, sz);
- il->buffer_size = sz;
- first_frame = 1;
- }
-
- assert(ctx->inpic.planes == 1);
- assert(ctx->outpic[0].planes == 1);
-
- assert(ctx->inpic.planewidth[0] == ctx->outpic[0].planewidth[0]);
- assert(ctx->inpic.planeheight[0] == ctx->outpic[0].planeheight[0] + 4);
-
- if (first_frame) {
- printf("First frame\n");
- il->lastcombed = -1;
- } else {
- // detect interlacing
- // for each row of 5 pixels, compare:
- // p2 vs (p1 + p3) / 2
- // p2 vs (p0 + p4) / 2
- unsigned int totalcombedframes = 0; // add 255 per combed pixel
- unsigned int totalpixels = 0;
- for (y = 0; y < ctx->inpic.planeheight[0] - 4; ++y) {
- unsigned char *in_line =
- &ctx->inpic.plane[0][ctx->inpic.planestride[0] * y];
- unsigned char *buf_line =
- &il->buffer_data[ctx->inpic.planestride[0] * y];
- unsigned char *out_line =
- &ctx->outpic->plane[0][ctx->outpic->planestride[0] * y];
- for (x = 0; x < ctx->inpic.planewidth[0]; ++x) {
- int b2 = buf_line[x + ctx->inpic.planestride[0] * 2];
- int p0 = in_line[x];
- int p1 = in_line[x + ctx->inpic.planestride[0]];
- int p2 = in_line[x + ctx->inpic.planestride[0] * 2];
- int p3 = in_line[x + ctx->inpic.planestride[0] * 3];
- int p4 = in_line[x + ctx->inpic.planestride[0] * 4];
- int is_moving = abs(b2 - p2) > il->motion_threshold;
-
- if (!is_moving) {
- out_line[x] = 128;
- continue;
- }
-
- ++totalpixels;
-
- int combed = il_decision(ctx, p0, p1, p2, p3, p4);
- totalcombedframes += combed;
- out_line[x] = 255 * combed;
- }
- }
-
- double avgpixels = totalpixels / (double)
- ((ctx->inpic.planeheight[0] - 4) * ctx->inpic.planewidth[0]);
-
- if (avgpixels > il->motion_amount) {
- double avgcombed = totalcombedframes / (double) totalpixels;
-
- if (il->lastcombed >= 0) {
- if (il->lastcombed < il->no_threshold ||
- il->lastcombed > il->yes_threshold)
- if (avgcombed < il->no_threshold ||
- avgcombed > il->yes_threshold)
- ++il->numdecidedadjacentframes;
- if (il->lastcombed > il->yes_threshold &&
- avgcombed < il->no_threshold)
- ++il->numjumpingadjacentframes;
- if (il->lastcombed < il->no_threshold &&
- avgcombed > il->yes_threshold)
- ++il->numjumpingadjacentframes;
- }
-
- il->lastcombed = avgcombed;
-
- if (avgcombed > il->yes_threshold) {
- ++il->numdecidedframes;
- ++il->totalcombedframes;
- } else if (avgcombed < il->no_threshold) {
- ++il->numdecidedframes;
- }
- } else
- il->lastcombed = -1;
- }
-
- ++il->numtotalframes;
-
- copy_plane(
- il->buffer_data, ctx->inpic.planestride[0],
- ctx->inpic.plane[0], ctx->inpic.planestride[0],
- ctx->inpic.planewidth[0],
- ctx->inpic.planeheight[0]);
-
- ctx->outpic[0].pts = ctx->inpic.pts;
- return 1;
-}
-
-void il_uninit(struct vf_dlopen_context *ctx)
-{
- ildetect_data_t *il = ctx->priv;
-
- double avgdecided = il->numtotalframes
- ? il->numdecidedframes / (double) il->numtotalframes : -1;
- double avgadjacent = il->numdecidedframes
- ? il->numdecidedadjacentframes / (double) il->numdecidedframes : -1;
- double avgscore = il->numdecidedframes
- ? il->totalcombedframes / (double) il->numdecidedframes : -1;
- double avgjumps = il->numdecidedadjacentframes
- ? il->numjumpingadjacentframes / (double) il->numdecidedadjacentframes : -1;
-
- printf("ildetect: Avg decided: %f\n", avgdecided);
- printf("ildetect: Avg adjacent decided: %f\n", avgadjacent);
- printf("ildetect: Avg interlaced decided: %f\n", avgscore);
- printf("ildetect: Avg interlaced/progressive adjacent decided: %f\n", avgjumps);
-
- if (avgdecided < il->decision_threshold)
- avgadjacent = avgscore = avgjumps = -1;
-
- if (avgadjacent < il->tc_decision_threshold)
- avgadjacent = avgjumps = -1;
-
- if (avgscore < 0)
- printf("ildetect: Content is probably: undecided\n");
- else if (avgscore < il->total_no_threshold)
- printf("ildetect: Content is probably: PROGRESSIVE\n");
- else if (avgscore > il->total_yes_threshold && avgjumps < 0)
- printf("ildetect: Content is probably: INTERLACED (possibly telecined)\n");
- else if (avgjumps > il->tc_threshold)
- printf("ildetect: Content is probably: TELECINED\n");
- else if (avgscore > il->total_yes_threshold)
- printf("ildetect: Content is probably: INTERLACED\n");
- else
- printf("ildetect: Content is probably: unknown\n");
-
- free(ctx->priv);
-}
-
-int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
-{
- VF_DLOPEN_CHECK_VERSION(ctx);
- (void) argc;
- (void) argv;
-
- ildetect_data_t *il = calloc(1,sizeof(ildetect_data_t));
-
-#define A(i,d) ((argc>(i) && *argv[i]) ? atof(argv[i]) : (d))
- il->method = A(0, 0);
- il->combing_threshold = A(1, 1);
- il->motion_threshold = A(2, 6);
- il->motion_amount = A(3, 0.1);
- il->yes_threshold = A(4, 0.1);
- il->no_threshold = A(5, 0.05);
- il->total_yes_threshold = A(6, 0.1);
- il->total_no_threshold = A(7, 0.05);
- il->tc_threshold = A(8, 0.1);
- il->decision_threshold = A(9, 0.2);
- il->tc_decision_threshold = A(10, 0.2);
-
- static struct vf_dlopen_formatpair map[] = {
- { "gray", "gray" },
- { NULL, NULL }
- };
- ctx->format_mapping = map;
- ctx->config = il_config;
- ctx->put_image = il_put_image;
- ctx->uninit = il_uninit;
- ctx->priv = il;
- return 1;
-}
diff --git a/TOOLS/vf_dlopen/ildetect.sh b/TOOLS/vf_dlopen/ildetect.sh
deleted file mode 100755
index cc37ca90a9..0000000000
--- a/TOOLS/vf_dlopen/ildetect.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/sh
-
-case "$0" in
- */*)
- MYDIR=${0%/*}
- ;;
- *)
- MYDIR=.
- ;;
-esac
-
-: ${MPV:=mpv}
-: ${ILDETECT_MPV:=$MPV}
-: ${ILDETECT_MPVFLAGS:=--start=35% --length=35}
-: ${ILDETECT_DRY_RUN:=}
-: ${ILDETECT_QUIET:=}
-: ${ILDETECT_RUN_INTERLACED_ONLY:=}
-: ${ILDETECT_FORCE_RUN:=}
-: ${MAKE:=make}
-
-# exit status:
-# 0 progressive
-# 1 telecine
-# 2 interlaced
-# 8 unknown
-# 15 compile fail
-# 16 detect fail
-# 17+ mpv's status | 16
-
-$MAKE -C "$MYDIR" ildetect.so || exit 15
-
-testfun()
-{
- $ILDETECT_MPV "$@" \
- --vf=dlopen="$MYDIR/ildetect.so" \
- --o= --vo=null --no-audio --untimed \
- $ILDETECT_MPVFLAGS \
- | { if [ -n "$ILDETECT_QUIET" ]; then cat; else tee /dev/stderr; fi } \
- | grep "^ildetect:"
-}
-
-out=`testfun "$@"`
-case "$out" in
- *"probably: PROGRESSIVE"*)
- [ -n "$ILDETECT_DRY_RUN" ] || \
- [ -n "$ILDETECT_RUN_INTERLACED_ONLY" ] || \
- $ILDETECT_MPV "$@"
- r=$?
- [ $r -eq 0 ] || exit $(($r | 16))
- exit 0
- ;;
- *"probably: TELECINED"*)
- out2=`ILDETECT_MPVFLAGS="$ILDETECT_MPVFLAGS --vf-pre=pullup,scale" testfun "$@"`
- case "$out2" in
- *"probably: TELECINED"*|*"probably: INTERLACED"*)
- [ -n "$ILDETECT_DRY_RUN" ] || \
- $ILDETECT_MPV "$@" -vf-pre yadif
- r=$?
- [ $r -eq 0 ] || exit $(($r | 16))
- exit 2
- ;;
- *)
- [ -n "$ILDETECT_DRY_RUN" ] || \
- $ILDETECT_MPV "$@" -vf-pre pullup
- r=$?
- [ $r -eq 0 ] || exit $(($r | 16))
- exit 1
- ;;
- esac
- ;;
- *"probably: INTERLACED"*)
- [ -n "$ILDETECT_DRY_RUN" ] || \
- $ILDETECT_MPV "$@" -vf-pre yadif
- r=$?
- [ $r -eq 0 ] || exit $(($r | 16))
- exit 2
- ;;
- *"probably: "*)
- [ -n "$ILDETECT_FORCE_RUN" ] || exit 8
- [ -n "$ILDETECT_DRY_RUN" ] || \
- $ILDETECT_MPV "$@" -vf-pre yadif
- r=$?
- [ $r -eq 0 ] || exit $(($r | 16))
- exit 0
- ;;
- *)
- exit 16
- ;;
-esac
diff --git a/TOOLS/vf_dlopen/rectangle.c b/TOOLS/vf_dlopen/rectangle.c
deleted file mode 100644
index f0827c974b..0000000000
--- a/TOOLS/vf_dlopen/rectangle.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
- *
- * This file is part of mpv's vf_dlopen examples.
- *
- * mpv's vf_dlopen examples are free software; you can redistribute them and/or
- * modify them 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.
- *
- * mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-
-#include "vf_dlopen.h"
-#include "filterutils.h"
-
-/*
- * rectangle
- *
- * usage: --vf=dlopen=/path/to/rectangle.so
- *
- * provides an editable rectangle
- * NOTE: unix only, and requires xterm to be installed. Don't ask.
- */
-
-typedef struct
-{
- int x, y, w, h;
- int step;
- int inpid;
- int infd;
- int ansimode;
- int rectmode;
-} privdata;
-
-enum {
- RECTMODE_LINES = 0,
- RECTMODE_BOX,
- RECTMODE_COUNT
-};
-
-static int put_image(struct vf_dlopen_context *ctx)
-{
- privdata *priv = ctx->priv;
- unsigned int p;
-
- assert(ctx->inpic.planes == ctx->outpic->planes);
-
- for (p = 0; p < ctx->outpic->planes; ++p) {
- assert(ctx->inpic.planewidth[p] == ctx->outpic->planewidth[p]);
- assert(ctx->inpic.planeheight[p] == ctx->outpic->planeheight[p]);
- }
-
- char data;
- while(read(priv->infd, &data, sizeof(data)) > 0) {
- // printf("\nMODE: %d, CHAR: %d (%c)\n", priv->ansimode, data, data);
- switch(priv->ansimode) {
- case 0: // initial
- switch(data) {
- case 27: priv->ansimode = 1; break;
- default: priv->ansimode = 0; break;
- }
- break;
- case 1: // seen ESC
- switch(data) {
- case '[': priv->ansimode = 2; break;
- default: priv->ansimode = 0; break;
- }
- break;
- case 2: // seen ESC [
- switch(data) {
- case 'D': priv->ansimode = 0; data = 'h'; break; // arrow
- case 'B': priv->ansimode = 0; data = 'j'; break; // arrow
- case 'A': priv->ansimode = 0; data = 'k'; break; // arrow
- case 'C': priv->ansimode = 0; data = 'l'; break; // arrow
- case 'd': priv->ansimode = 0; data = 'H'; break; // rxvt shift-arrow
- case 'b': priv->ansimode = 0; data = 'J'; break; // rxvt shift-arrow
- case 'a': priv->ansimode = 0; data = 'K'; break; // rxvt shift-arrow
- case 'c': priv->ansimode = 0; data = 'L'; break; // rxvt shift-arrow
- case '1': priv->ansimode = 3; break;
- default: priv->ansimode = -1; break;
- }
- break;
- case 3: // seen ESC [ 1
- switch(data) {
- case ';': priv->ansimode = 4; break;
- default: priv->ansimode = -1; break;
- }
- break;
- case 4: // seen ESC [ 1 ;
- switch(data) {
- case '2': priv->ansimode = 5; break;
- default: priv->ansimode = -1; break;
- }
- break;
- case 5: // seen ESC [ 1 ; 2
- switch(data) {
- case 'D': priv->ansimode = 0; data = 'H'; break; // xterm shift-arrow
- case 'B': priv->ansimode = 0; data = 'J'; break; // xterm shift-arrow
- case 'A': priv->ansimode = 0; data = 'K'; break; // xterm shift-arrow
- case 'C': priv->ansimode = 0; data = 'L'; break; // xterm shift-arrow
- default: priv->ansimode = -1; break;
- }
- break;
- case -1: // wait for end of ESC [ sequence
- if((data > '9' || data < '0') && (data != ';')) {
- priv->ansimode = 0;
- data = 0; // do not process
- }
- break;
- }
-
- if(priv->ansimode == 0) {
- switch(data) {
- case 'h': case 'D': priv->x -= priv->step; priv->w += priv->step; break;
- case 'j': case 'B': priv->y += priv->step; priv->h -= priv->step; break;
- case 'k': case 'A': priv->y -= priv->step; priv->h += priv->step; break;
- case 'l': case 'C': priv->x += priv->step; priv->w -= priv->step; break;
- case 'H': case 'd': priv->w -= priv->step; break;
- case 'J': case 'b': priv->h += priv->step; break;
- case 'K': case 'a': priv->h -= priv->step; break;
- case 'L': case 'c': priv->w += priv->step; break;
- case ' ': priv->step ^= 9; break;
- case 9: ++priv->rectmode; priv->rectmode %= RECTMODE_COUNT; break;
- }
- }
- }
-
- // apply limits
- if(priv->x < 0) {
- priv->w += priv->x;
- priv->x = 0;
- }
- if(priv->y < 0) {
- priv->h += priv->y;
- priv->y = 0;
- }
- if(priv->w < 0) {
- priv->w = 0;
- }
- if(priv->h < 0) {
- priv->h = 0;
- }
- if(priv->x >= (int) ctx->inpic.planewidth[0]) {
- priv->x = ctx->inpic.planewidth[0] - 1;
- }
- if(priv->y >= (int) ctx->inpic.planeheight[0]) {
- priv->y = ctx->inpic.planeheight[0] - 1;
- }
- if(priv->x + priv->w > (int) ctx->inpic.planewidth[0]) {
- priv->w = ctx->inpic.planewidth[0] - priv->x;
- }
- if(priv->y + priv->h > (int) ctx->inpic.planeheight[0]) {
- priv->h = ctx->inpic.planeheight[0] - priv->y;
- }
-
- // apply step
- priv->x = ((priv->x + priv->step - 1) / priv->step) * priv->step;
- priv->y = ((priv->y + priv->step - 1) / priv->step) * priv->step;
- priv->w = (priv->w / priv->step) * priv->step;
- priv->h = (priv->h / priv->step) * priv->step;
-
- // print
- printf("\nRECTANGLE: -vf crop=%d:%d:%d:%d\n", priv->w, priv->h, priv->x, priv->y);
-
- // copy picture
- for (p = 0; p < ctx->outpic->planes; ++p) {
- copy_plane(
- ctx->outpic->plane[p], ctx->outpic->planestride[p],
- ctx->inpic.plane[p], ctx->inpic.planestride[p],
- ctx->inpic.planewidth[p], ctx->inpic.planeheight[p]
- );
- }
- ctx->outpic->pts = ctx->inpic.pts;
-
- // draw rectangle
-#define PUT_PIXEL(x,y) \
- do { \
- int x_ = (x); \
- int y_ = (y); \
- if(x_