History

vf_mp: remove blackframe filter wrapper

blackframe is integrated as a native filter.

Stefano Sabatini committed 15 years ago

Commit cc0dc501 parent 00a9ac45 files · +1 −153Browse files

Showing the changes to libavfilter (4 of 5 files). Show all

Unified · Split

4 files
  1. libavfilter/Makefile +0 −1
  2. libavfilter/avfilter.h +1 −1
  3. libavfilter/libmpcodecs/vf_blackframe.c +0 −148
  4. libavfilter/vf_mp.c +0 −2
libavfilter/Makefile+0−1
@@ -79,7 +79,6 @@ OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o · 78 unmodified lines
79OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/mp_image.o79OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/mp_image.o
80OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/img_format.o80OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/img_format.o
81OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_2xsai.o81OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_2xsai.o
82OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_blackframe.o
83OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_decimate.o82OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_decimate.o
84OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_delogo.o83OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_delogo.o
85OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_denoise3d.o84OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_denoise3d.o
libavfilter/avfilter.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
30 30
31#define LIBAVFILTER_VERSION_MAJOR 231#define LIBAVFILTER_VERSION_MAJOR 2
32#define LIBAVFILTER_VERSION_MINOR 2732#define LIBAVFILTER_VERSION_MINOR 27
33#define LIBAVFILTER_VERSION_MICRO 233#define LIBAVFILTER_VERSION_MICRO 3
34 34
35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
36 LIBAVFILTER_VERSION_MINOR, \36 LIBAVFILTER_VERSION_MINOR, \
libavfilter/libmpcodecs/vf_blackframe.c+0−148
@@ -1,148 +0,0 @@
1/*
2 * detect frames that are (almost) black
3 * search for black frames to detect scene transitions
4 * (c) 2006 Julian Hall
5 *
6 * based on code designed for skipping commercials
7 * (c) 2002-2003 Brian J. Murrell
8 *
9 * cleanup, simplify, speedup (c) 2006 by Ivo van Poorten
10 *
11 * This file is part of MPlayer.
12 *
13 * MPlayer is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * MPlayer is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27
28#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>
31
32#include "config.h"
33#include "mp_msg.h"
34
35#include "img_format.h"
36#include "mp_image.h"
37#include "vf.h"
38
39struct vf_priv_s {
40 unsigned int bamount, bthresh, frame, lastkeyframe;
41};
42
43static int config(struct vf_instance *vf, int width, int height, int d_width,
44 int d_height, unsigned int flags, unsigned int outfmt) {
45 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
46}
47
48static int query_format(struct vf_instance *vf, unsigned fmt) {
49 switch(fmt) {
50 case IMGFMT_YVU9:
51 case IMGFMT_IF09:
52 case IMGFMT_YV12:
53 case IMGFMT_I420:
54 case IMGFMT_IYUV:
55 case IMGFMT_CLPL:
56 case IMGFMT_Y800:
57 case IMGFMT_Y8:
58 case IMGFMT_NV12:
59 case IMGFMT_NV21:
60 case IMGFMT_444P:
61 case IMGFMT_422P:
62 case IMGFMT_411P:
63 case IMGFMT_HM12:
64 return vf_next_query_format(vf, fmt);
65 }
66 return 0;
67}
68
69static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
70 mp_image_t *dmpi;
71 int x, y;
72 int nblack=0, pblack=0;
73 unsigned char *yplane = mpi->planes[0];
74 unsigned int ystride = mpi->stride[0];
75 int pict_type = mpi->pict_type;
76 int w = mpi->w, h = mpi->h;
77 int bthresh = vf->priv->bthresh;
78 int bamount = vf->priv->bamount;
79 static const char *const picttypes[4] = { "unknown", "I", "P", "B" };
80
81 for (y=1; y<=h; y++) {
82 for (x=0; x<w; x++)
83 nblack += yplane[x] < bthresh;
84 pblack = nblack*100/(w*y);
85 if (pblack < bamount) break;
86 yplane += ystride;
87 }
88
89 if (pict_type > 3 || pict_type < 0) pict_type = 0;
90 if (pict_type == 1) vf->priv->lastkeyframe = vf->priv->frame;
91
92 if (pblack >= bamount)
93 mp_msg(MSGT_VFILTER, MSGL_INFO,"vf_blackframe: %u, %i%%, %s (I:%u)\n",
94 vf->priv->frame, pblack, picttypes[pict_type],
95 vf->priv->lastkeyframe);
96
97 vf->priv->frame++;
98
99 dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0,
100 mpi->width, mpi->height);
101 dmpi->planes[0] = mpi->planes[0];
102 dmpi->stride[0] = mpi->stride[0];
103 dmpi->planes[1] = mpi->planes[1];
104 dmpi->stride[1] = mpi->stride[1];
105 dmpi->planes[2] = mpi->planes[2];
106 dmpi->stride[2] = mpi->stride[2];
107
108 vf_clone_mpi_attributes(dmpi, mpi);
109
110 return vf_next_put_image(vf, dmpi, pts);
111}
112
113static int control(struct vf_instance *vf, int request, void* data){
114 return vf_next_control(vf,request,data);
115}
116
117static void uninit(struct vf_instance *vf) {
118 free(vf->priv);
119}
120
121static int vf_open(vf_instance_t *vf, char *args){
122 vf->priv = malloc(sizeof(struct vf_priv_s));
123 if (!vf->priv) return 0;
124
125 vf->config = config;
126 vf->put_image = put_image;
127 vf->control = control;
128 vf->uninit = uninit;
129 vf->query_format = query_format;
130
131 vf->priv->bamount = 98;
132 vf->priv->bthresh = 0x20;
133 vf->priv->frame = 0;
134 vf->priv->lastkeyframe = 0;
135
136 if (args)
137 sscanf(args, "%u:%u", &vf->priv->bamount, &vf->priv->bthresh);
138 return 1;
139}
140
141const vf_info_t vf_info_blackframe = {
142 "detects black frames",
143 "blackframe",
144 "Brian J. Murrell, Julian Hall, Ivo van Poorten",
145 "Useful for detecting scene transitions",
146 vf_open,
147 NULL
148};
libavfilter/vf_mp.c+0−2
@@ -189,7 +189,6 @@ extern const vf_info_t vf_info_screenshot; · 188 unmodified lines
189extern const vf_info_t vf_info_ass;189extern const vf_info_t vf_info_ass;
190extern const vf_info_t vf_info_mcdeint;190extern const vf_info_t vf_info_mcdeint;
191extern const vf_info_t vf_info_yadif;191extern const vf_info_t vf_info_yadif;
192extern const vf_info_t vf_info_blackframe;
193extern const vf_info_t vf_info_geq;192extern const vf_info_t vf_info_geq;
194extern const vf_info_t vf_info_ow;193extern const vf_info_t vf_info_ow;
195extern const vf_info_t vf_info_fixpts;194extern const vf_info_t vf_info_fixpts;
@@ -198,7 +197,6 @@ extern const vf_info_t vf_info_stereo3d; · 2 unmodified lines
198 197
199static const vf_info_t* const filters[]={198static const vf_info_t* const filters[]={
200 &vf_info_2xsai,199 &vf_info_2xsai,
201 &vf_info_blackframe,
202 &vf_info_decimate,200 &vf_info_decimate,
203 &vf_info_delogo,201 &vf_info_delogo,
204 &vf_info_denoise3d,202 &vf_info_denoise3d,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t