annotate libmpcodecs/vf_sab.c @ 36195:d2c43a00a9c9

Make comment clearer.
author reimar
date Mon, 27 May 2013 20:36:58 +0000
parents d206960484fe
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
1 /*
26727
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
2 * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
3 *
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
4 * This file is part of MPlayer.
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
5 *
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
7 * it under the terms of the GNU General Public License as published by
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
9 * (at your option) any later version.
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
10 *
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
14 * GNU General Public License for more details.
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
15 *
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
16 * You should have received a copy of the GNU General Public License along
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
82601a38e2a7 Use standard license headers.
diego
parents: 26069
diff changeset
19 */
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
20
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
21 #include <stdio.h>
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
22 #include <stdlib.h>
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
23 #include <string.h>
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
24 #include <inttypes.h>
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
25 #include <assert.h>
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
26
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 13373
diff changeset
27 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 13373
diff changeset
28 #include "mp_msg.h"
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
29
28594
df67d03dde3b Convert HAVE_MALLOC_H into a 0/1 definition, fixes the warning:
diego
parents: 27754
diff changeset
30 #if HAVE_MALLOC_H
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
31 #include <malloc.h>
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
32 #endif
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
33
26069
1318e956c092 FFmpeg now uses different (unified) #include paths.
diego
parents: 26006
diff changeset
34 #include "libavutil/avutil.h"
35712
d206960484fe Add a number of missing libavutil header #includes.
diego
parents: 33415
diff changeset
35 #include "libavutil/mem.h"
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
36 #include "img_format.h"
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
37 #include "mp_image.h"
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
38 #include "vf.h"
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents: 17906
diff changeset
39 #include "libswscale/swscale.h"
10233
35f52ad860a0 vf_scale.h & related cleanup & some small warning fix by dominik
michael
parents: 9975
diff changeset
40 #include "vf_scale.h"
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
41
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
42
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
43 //===========================================================================//
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
44
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
45 typedef struct FilterParam{
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
46 float radius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
47 float preFilterRadius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
48 float strength;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
49 float quality;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
50 struct SwsContext *preFilterContext;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
51 uint8_t *preFilterBuf;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
52 int preFilterStride;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
53 int distWidth;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
54 int distStride;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
55 int *distCoeff;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
56 int colorDiffCoeff[512];
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
57 }FilterParam;
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
58
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
59 struct vf_priv_s {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
60 FilterParam luma;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
61 FilterParam chroma;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
62 };
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
63
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
64
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
65 /***************************************************************************/
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
66
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
67 //FIXME stupid code duplication
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
68 static void getSubSampleFactors(int *h, int *v, int format){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
69 switch(format){
33331
93923796615c Avoid "'sh' may be used uninitialized in this function" warning.
reimar
parents: 32747
diff changeset
70 default:
93923796615c Avoid "'sh' may be used uninitialized in this function" warning.
reimar
parents: 32747
diff changeset
71 assert(0);
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
72 case IMGFMT_YV12:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
73 case IMGFMT_I420:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
74 *h=1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
75 *v=1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
76 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
77 case IMGFMT_YVU9:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
78 *h=2;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
79 *v=2;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
80 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
81 case IMGFMT_444P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
82 *h=0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
83 *v=0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
84 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
85 case IMGFMT_422P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
86 *h=1;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
87 *v=0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
88 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
89 case IMGFMT_411P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
90 *h=2;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
91 *v=0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
92 break;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
93 }
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
94 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
95
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
96 static int allocStuff(FilterParam *f, int width, int height){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
97 int stride= (width+7)&~7;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
98 SwsVector *vec;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
99 SwsFilter swsF;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
100 int i,x,y;
32747
170106dd2ef2 Replace memalign() by av_malloc() in libmpcodecs. as it is not available in all platforms
michael
parents: 32702
diff changeset
101 f->preFilterBuf= av_malloc(stride*height);
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
102 f->preFilterStride= stride;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
103
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
104 vec = sws_getGaussianVec(f->preFilterRadius, f->quality);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
105 swsF.lumH= swsF.lumV= vec;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
106 swsF.chrH= swsF.chrV= NULL;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
107 f->preFilterContext= sws_getContext(
33415
53073a44a899 Fix build after removal of SWS_CPU_CAPS_* from libswscale in FFmpeg.
iive
parents: 33331
diff changeset
108 width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_POINT, &swsF, NULL, NULL);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
109
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
110 sws_freeVec(vec);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
111 vec = sws_getGaussianVec(f->strength, 5.0);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
112 for(i=0; i<512; i++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
113 double d;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
114 int index= i-256 + vec->length/2;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
115
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
116 if(index<0 || index>=vec->length) d= 0.0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
117 else d= vec->coeff[index];
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
118
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
119 f->colorDiffCoeff[i]= (int)(d/vec->coeff[vec->length/2]*(1<<12) + 0.5);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
120 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
121 sws_freeVec(vec);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
122 vec = sws_getGaussianVec(f->radius, f->quality);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
123 f->distWidth= vec->length;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
124 f->distStride= (vec->length+7)&~7;
32747
170106dd2ef2 Replace memalign() by av_malloc() in libmpcodecs. as it is not available in all platforms
michael
parents: 32702
diff changeset
125 f->distCoeff= av_malloc(f->distWidth*f->distStride*sizeof(int32_t));
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
126
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
127 for(y=0; y<vec->length; y++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
128 for(x=0; x<vec->length; x++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
129 double d= vec->coeff[x] * vec->coeff[y];
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
130
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
131 f->distCoeff[x + y*f->distStride]= (int)(d*(1<<10) + 0.5);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
132 // if(y==vec->length/2)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
133 // printf("%6d ", f->distCoeff[x + y*f->distStride]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
134 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
135 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
136 sws_freeVec(vec);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
137
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
138 return 0;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
139 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
140
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
141 static int config(struct vf_instance *vf,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
142 int width, int height, int d_width, int d_height,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
143 unsigned int flags, unsigned int outfmt){
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
144
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
145 int sw, sh;
27754
08d18fe9da52 Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents: 26727
diff changeset
146 //__asm__ volatile("emms\n\t");
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
147 allocStuff(&vf->priv->luma, width, height);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
148
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
149 getSubSampleFactors(&sw, &sh, outfmt);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
150 allocStuff(&vf->priv->chroma, width>>sw, height>>sh);
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
151
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
152 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
153 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
154
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
155 static void freeBuffers(FilterParam *f){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
156 if(f->preFilterContext) sws_freeContext(f->preFilterContext);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
157 f->preFilterContext=NULL;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
158
32747
170106dd2ef2 Replace memalign() by av_malloc() in libmpcodecs. as it is not available in all platforms
michael
parents: 32702
diff changeset
159 av_free(f->preFilterBuf);
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
160 f->preFilterBuf=NULL;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
161
32747
170106dd2ef2 Replace memalign() by av_malloc() in libmpcodecs. as it is not available in all platforms
michael
parents: 32702
diff changeset
162 av_free(f->distCoeff);
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
163 f->distCoeff=NULL;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
164 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
165
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
166 static void uninit(struct vf_instance *vf){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
167 if(!vf->priv) return;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
168
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
169 freeBuffers(&vf->priv->luma);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
170 freeBuffers(&vf->priv->chroma);
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
171
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
172 free(vf->priv);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
173 vf->priv=NULL;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
174 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
175
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
176 static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, FilterParam *fp){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
177 int x, y;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
178 FilterParam f= *fp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
179 const int radius= f.distWidth/2;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
180 const uint8_t* const srcArray[MP_MAX_PLANES] = {src};
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
181 uint8_t *dstArray[MP_MAX_PLANES]= {f.preFilterBuf};
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
182 int srcStrideArray[MP_MAX_PLANES]= {srcStride};
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
183 int dstStrideArray[MP_MAX_PLANES]= {f.preFilterStride};
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
184
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
185 // f.preFilterContext->swScale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
186 sws_scale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
187
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
188 for(y=0; y<h; y++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
189 for(x=0; x<w; x++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
190 int sum=0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
191 int div=0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
192 int dy;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
193 const int preVal= f.preFilterBuf[x + y*f.preFilterStride];
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
194 #if 0
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
195 const int srcVal= src[x + y*srcStride];
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
196 if((x/32)&1){
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
197 dst[x + y*dstStride]= srcVal;
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
198 if(y%32==0) dst[x + y*dstStride]= 0;
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
199 continue;
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
200 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
201 #endif
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
202 if(x >= radius && x < w - radius){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
203 for(dy=0; dy<radius*2+1; dy++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
204 int dx;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
205 int iy= y+dy - radius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
206 if (iy<0) iy= -iy;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
207 else if(iy>=h) iy= h+h-iy-1;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
208
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
209 for(dx=0; dx<radius*2+1; dx++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
210 const int ix= x+dx - radius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
211 int factor;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
212
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
213 factor= f.colorDiffCoeff[256+preVal - f.preFilterBuf[ix + iy*f.preFilterStride] ]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
214 *f.distCoeff[dx + dy*f.distStride];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
215 sum+= src[ix + iy*srcStride] *factor;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
216 div+= factor;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
217 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
218 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
219 }else{
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
220 for(dy=0; dy<radius*2+1; dy++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
221 int dx;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
222 int iy= y+dy - radius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
223 if (iy<0) iy= -iy;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
224 else if(iy>=h) iy= h+h-iy-1;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
225
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
226 for(dx=0; dx<radius*2+1; dx++){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
227 int ix= x+dx - radius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
228 int factor;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
229 if (ix<0) ix= -ix;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
230 else if(ix>=w) ix= w+w-ix-1;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
231
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
232 factor= f.colorDiffCoeff[256+preVal - f.preFilterBuf[ix + iy*f.preFilterStride] ]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
233 *f.distCoeff[dx + dy*f.distStride];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
234 sum+= src[ix + iy*srcStride] *factor;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
235 div+= factor;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
236 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
237 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
238 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
239 dst[x + y*dstStride]= (sum + div/2)/div;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
240 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
241 }
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
242 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
243
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
244 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: 32537
diff changeset
245 int cw= mpi->w >> mpi->chroma_x_shift;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
246 int ch= mpi->h >> mpi->chroma_y_shift;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
247
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
248 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: 32537
diff changeset
249 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
250 mpi->w,mpi->h);
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
251
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
252 assert(mpi->flags&MP_IMGFLAG_PLANAR);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
253
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
254 blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
255 blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
256 blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
257
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
258 return vf_next_put_image(vf,dmpi, pts);
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
259 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
260
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
261 //===========================================================================//
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
262
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
263 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: 32537
diff changeset
264 switch(fmt)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
265 {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
266 case IMGFMT_YV12:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
267 case IMGFMT_I420:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
268 case IMGFMT_IYUV:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
269 case IMGFMT_YVU9:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
270 case IMGFMT_444P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
271 case IMGFMT_422P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
272 case IMGFMT_411P:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
273 return vf_next_query_format(vf, fmt);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
274 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
275 return 0;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
276 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
277
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 29263
diff changeset
278 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: 32537
diff changeset
279 int e;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
280
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
281 vf->config=config;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
282 vf->put_image=put_image;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
283 // vf->get_image=get_image;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
284 vf->query_format=query_format;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
285 vf->uninit=uninit;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
286 vf->priv=malloc(sizeof(struct vf_priv_s));
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
287 memset(vf->priv, 0, sizeof(struct vf_priv_s));
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
288
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
289 if(args==NULL) return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
290
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
291 e=sscanf(args, "%f:%f:%f:%f:%f:%f",
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
292 &vf->priv->luma.radius,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
293 &vf->priv->luma.preFilterRadius,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
294 &vf->priv->luma.strength,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
295 &vf->priv->chroma.radius,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
296 &vf->priv->chroma.preFilterRadius,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
297 &vf->priv->chroma.strength
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
298 );
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
299
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
300 vf->priv->luma.quality = vf->priv->chroma.quality= 3.0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
301
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
302 if(e==3){
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
303 vf->priv->chroma.radius= vf->priv->luma.radius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
304 vf->priv->chroma.preFilterRadius = vf->priv->luma.preFilterRadius;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
305 vf->priv->chroma.strength= vf->priv->luma.strength;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
306 }else if(e!=6)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
307 return 0;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
308
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
309 // if(vf->priv->luma.radius < 0) return 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
310 // if(vf->priv->chroma.radius < 0) return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29164
diff changeset
311
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 32537
diff changeset
312 return 1;
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
313 }
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
314
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 23373
diff changeset
315 const vf_info_t vf_info_sab = {
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
316 "shape adaptive blur",
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
317 "sab",
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
318 "Michael Niedermayer",
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
319 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 29263
diff changeset
320 vf_open,
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 9494
diff changeset
321 NULL
8100
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
322 };
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
323
fd0da9a7d2e3 shape adaptive blur (slightly slow though)
michael
parents:
diff changeset
324 //===========================================================================//