annotate libmpcodecs/vf_boxblur.c @ 34120:5feea1437279

Support ASP by QNAP Systems.
author cehoyos
date Sun, 16 Oct 2011 11:48:05 +0000
parents 7af3e6f901fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
1 /*
26727
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
2 * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
3 *
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
4 * This file is part of MPlayer.
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
5 *
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
7 * it under the terms of the GNU General Public License as published by
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
9 * (at your option) any later version.
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
10 *
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
14 * GNU General Public License for more details.
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
15 *
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
16 * You should have received a copy of the GNU General Public License along
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
82601a38e2a7 Use standard license headers.
diego
parents: 24969
diff changeset
19 */
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
20
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
21 #include <stdio.h>
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
22 #include <stdlib.h>
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
23 #include <string.h>
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
24 #include <inttypes.h>
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
25 #include <assert.h>
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
26
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16155
diff changeset
27 #include "mp_msg.h"
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
28 #include "img_format.h"
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
29 #include "mp_image.h"
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
30 #include "vf.h"
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
31
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
32
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
33 //===========================================================================//
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
34
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
35 typedef struct FilterParam{
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
36 int radius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
37 int power;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
38 }FilterParam;
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
39
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
40 struct vf_priv_s {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
41 FilterParam lumaParam;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
42 FilterParam chromaParam;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
43 };
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
44
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
45
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
46 /***************************************************************************/
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
47
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
48
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
49 static int config(struct vf_instance *vf,
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
50 int width, int height, int d_width, int d_height,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
51 unsigned int flags, unsigned int outfmt){
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
52
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
53 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
54 }
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
55
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
56 static inline void blur(uint8_t *dst, uint8_t *src, int w, int radius, int dstStep, int srcStep){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
57 int x;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
58 const int length= radius*2 + 1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
59 const int inv= ((1<<16) + length/2)/length;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
60
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
61 int sum= 0;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
62
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
63 for(x=0; x<radius; x++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
64 sum+= src[x*srcStep]<<1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
65 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
66 sum+= src[radius*srcStep];
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
67
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
68 for(x=0; x<=radius; x++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
69 sum+= src[(radius+x)*srcStep] - src[(radius-x)*srcStep];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
70 dst[x*dstStep]= (sum*inv + (1<<15))>>16;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
71 }
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
72
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
73 for(; x<w-radius; x++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
74 sum+= src[(radius+x)*srcStep] - src[(x-radius-1)*srcStep];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
75 dst[x*dstStep]= (sum*inv + (1<<15))>>16;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
76 }
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
77
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
78 for(; x<w; x++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
79 sum+= src[(2*w-radius-x-1)*srcStep] - src[(x-radius-1)*srcStep];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
80 dst[x*dstStep]= (sum*inv + (1<<15))>>16;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
81 }
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
82 }
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
83
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
84 static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int power, int dstStep, int srcStep){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
85 uint8_t temp[2][4096];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
86 uint8_t *a= temp[0], *b=temp[1];
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
87
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
88 if(radius){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
89 blur(a, src, w, radius, 1, srcStep);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
90 for(; power>2; power--){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
91 uint8_t *c;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
92 blur(b, a, w, radius, 1, 1);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
93 c=a; a=b; b=c;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
94 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
95 if(power>1)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
96 blur(dst, a, w, radius, dstStep, 1);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
97 else{
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
98 int i;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
99 for(i=0; i<w; i++)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
100 dst[i*dstStep]= a[i];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
101 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
102 }else{
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
103 int i;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
104 for(i=0; i<w; i++)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
105 dst[i*dstStep]= src[i*srcStep];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
106 }
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
107 }
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
108
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
109 static void hBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
110 int y;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
111
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
112 if(radius==0 && dst==src) return;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
113
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
114 for(y=0; y<h; y++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
115 blur2(dst + y*dstStride, src + y*srcStride, w, radius, power, 1, 1);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
116 }
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
117 }
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
118
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
119 //FIXME optimize (x before y !!!)
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
120 static void vBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
121 int x;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
122
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
123 if(radius==0 && dst==src) return;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
124
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
125 for(x=0; x<w; x++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
126 blur2(dst + x, src + x, h, radius, power, dstStride, srcStride);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
127 }
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
128 }
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
129
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
130 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
131 int cw= mpi->w >> mpi->chroma_x_shift;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
132 int ch= mpi->h >> mpi->chroma_y_shift;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
133
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
134 mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
135 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_READABLE,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
136 mpi->w,mpi->h);
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
137
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
138 assert(mpi->flags&MP_IMGFLAG_PLANAR);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
139
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
140 hBlur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
141 dmpi->stride[0], mpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
142 hBlur(dmpi->planes[1], mpi->planes[1], cw,ch,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
143 dmpi->stride[1], mpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
144 hBlur(dmpi->planes[2], mpi->planes[2], cw,ch,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
145 dmpi->stride[2], mpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
146
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
147 vBlur(dmpi->planes[0], dmpi->planes[0], mpi->w,mpi->h,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
148 dmpi->stride[0], dmpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
149 vBlur(dmpi->planes[1], dmpi->planes[1], cw,ch,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
150 dmpi->stride[1], dmpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
151 vBlur(dmpi->planes[2], dmpi->planes[2], cw,ch,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
152 dmpi->stride[2], dmpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
153
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
154 return vf_next_put_image(vf,dmpi, pts);
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
155 }
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
156
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
157 //===========================================================================//
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
158
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
159 static int query_format(struct vf_instance *vf, unsigned int fmt){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
160 switch(fmt)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
161 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
162 case IMGFMT_YV12:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
163 case IMGFMT_I420:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
164 case IMGFMT_IYUV:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
165 case IMGFMT_YVU9:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
166 case IMGFMT_444P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
167 case IMGFMT_422P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
168 case IMGFMT_411P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
169 return vf_next_query_format(vf, fmt);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
170 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
171 return 0;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
172 }
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
173
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 29263
diff changeset
174 static int vf_open(vf_instance_t *vf, char *args){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
175 int e;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
176
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
177 vf->config=config;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
178 vf->put_image=put_image;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
179 // vf->get_image=get_image;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
180 vf->query_format=query_format;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
181 vf->priv=malloc(sizeof(struct vf_priv_s));
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
182 memset(vf->priv, 0, sizeof(struct vf_priv_s));
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
183
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
184 if(args==NULL) return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
185
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
186 e=sscanf(args, "%d:%d:%d:%d",
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
187 &vf->priv->lumaParam.radius,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
188 &vf->priv->lumaParam.power,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
189 &vf->priv->chromaParam.radius,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
190 &vf->priv->chromaParam.power
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
191 );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
192
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
193 if(e==2){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
194 vf->priv->chromaParam.radius= vf->priv->lumaParam.radius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
195 vf->priv->chromaParam.power = vf->priv->lumaParam.power;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
196 }else if(e!=4)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
197 return 0;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
198
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
199 if(vf->priv->lumaParam.radius < 0) return 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
200 if(vf->priv->chromaParam.radius < 0) return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
201
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
202 return 1;
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
203 }
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
204
24969
c2b7ba444ade begin moving const filter data to .text/.rodata sections
rfelker
parents: 23373
diff changeset
205 const vf_info_t vf_info_boxblur = {
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
206 "box blur",
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
207 "boxblur",
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
208 "Michael Niedermayer",
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
209 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 29263
diff changeset
210 vf_open,
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 8123
diff changeset
211 NULL
8010
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
212 };
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
213
329e9a5a154f boxblur, another useless filter
michael
parents:
diff changeset
214 //===========================================================================//