Mercurial > mplayer.hg
annotate libmpcodecs/vf_noise.c @ 31565:9a590e7aac57
Support for unencrypted Blu-ray playback through libbluray.
Use it through: mplayer br:////path/to/disc
author | ben |
---|---|
date | Mon, 05 Jul 2010 17:04:46 +0000 |
parents | 00825525514e |
children | 8fa2f43cb760 |
rev | line source |
---|---|
6424 | 1 /* |
26727 | 2 * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> |
3 * | |
4 * This file is part of MPlayer. | |
5 * | |
6 * MPlayer is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * MPlayer is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 */ | |
6424 | 20 |
21 #include <stdio.h> | |
22 #include <stdlib.h> | |
23 #include <string.h> | |
24 #include <inttypes.h> | |
25 #include <math.h> | |
26 | |
17012 | 27 #include "config.h" |
28 #include "mp_msg.h" | |
29 #include "cpudetect.h" | |
6424 | 30 |
28594
df67d03dde3b
Convert HAVE_MALLOC_H into a 0/1 definition, fixes the warning:
diego
parents:
28290
diff
changeset
|
31 #if HAVE_MALLOC_H |
6424 | 32 #include <malloc.h> |
33 #endif | |
34 | |
35 #include "img_format.h" | |
36 #include "mp_image.h" | |
37 #include "vf.h" | |
17012 | 38 #include "libvo/fastmemcpy.h" |
31003
00825525514e
Replace memalign(x) (x > 8) by av_malloc() to prevent crashes on systems
zuxy
parents:
30708
diff
changeset
|
39 #include "libavutil/mem.h" |
6424 | 40 |
41 #define MAX_NOISE 4096 | |
42 #define MAX_SHIFT 1024 | |
43 #define MAX_RES (MAX_NOISE-MAX_SHIFT) | |
44 | |
45 //===========================================================================// | |
46 | |
47 static inline void lineNoise_C(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift); | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
48 static inline void lineNoiseAvg_C(uint8_t *dst, uint8_t *src, int len, int8_t **shift); |
6424 | 49 |
50 static void (*lineNoise)(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift)= lineNoise_C; | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
51 static void (*lineNoiseAvg)(uint8_t *dst, uint8_t *src, int len, int8_t **shift)= lineNoiseAvg_C; |
6424 | 52 |
53 typedef struct FilterParam{ | |
54 int strength; | |
55 int uniform; | |
56 int temporal; | |
6448 | 57 int quality; |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
58 int averaged; |
6990
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
59 int pattern; |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
60 int shiftptr; |
6424 | 61 int8_t *noise; |
6964 | 62 int8_t *prev_shift[MAX_RES][3]; |
6424 | 63 }FilterParam; |
64 | |
65 struct vf_priv_s { | |
66 FilterParam lumaParam; | |
67 FilterParam chromaParam; | |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
68 unsigned int outfmt; |
6424 | 69 }; |
70 | |
18030
ec68026bc1d0
move 12k from data to bss (reduce binary size by 12k)
rfelker
parents:
17906
diff
changeset
|
71 static int nonTempRandShift_init; |
ec68026bc1d0
move 12k from data to bss (reduce binary size by 12k)
rfelker
parents:
17906
diff
changeset
|
72 static int nonTempRandShift[MAX_RES]; |
6424 | 73 |
6990
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
74 static int patt[4] = { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
75 -1,0,1,0 |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
76 }; |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
77 |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
78 #define RAND_N(range) ((int) ((double)range*rand()/(RAND_MAX+1.0))) |
6424 | 79 static int8_t *initNoise(FilterParam *fp){ |
80 int strength= fp->strength; | |
81 int uniform= fp->uniform; | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
82 int averaged= fp->averaged; |
6990
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
83 int pattern= fp->pattern; |
31003
00825525514e
Replace memalign(x) (x > 8) by av_malloc() to prevent crashes on systems
zuxy
parents:
30708
diff
changeset
|
84 int8_t *noise= av_malloc(MAX_NOISE*sizeof(int8_t)); |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
85 int i, j; |
6424 | 86 |
87 srand(123457); | |
88 | |
6990
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
89 for(i=0,j=0; i<MAX_NOISE; i++,j++) |
6424 | 90 { |
6990
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
91 if(uniform) { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
92 if (averaged) { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
93 if (pattern) { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
94 noise[i]= (RAND_N(strength) - strength/2)/6 |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
95 +patt[j%4]*strength*0.25/3; |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
96 } else { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
97 noise[i]= (RAND_N(strength) - strength/2)/3; |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
98 } |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
99 } else { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
100 if (pattern) { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
101 noise[i]= (RAND_N(strength) - strength/2)/2 |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
102 + patt[j%4]*strength*0.25; |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
103 } else { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
104 noise[i]= RAND_N(strength) - strength/2; |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
105 } |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
106 } |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
107 } else { |
6424 | 108 double x1, x2, w, y1; |
109 do { | |
110 x1 = 2.0 * rand()/(float)RAND_MAX - 1.0; | |
111 x2 = 2.0 * rand()/(float)RAND_MAX - 1.0; | |
112 w = x1 * x1 + x2 * x2; | |
113 } while ( w >= 1.0 ); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29040
diff
changeset
|
114 |
6424 | 115 w = sqrt( (-2.0 * log( w ) ) / w ); |
116 y1= x1 * w; | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
117 y1*= strength / sqrt(3.0); |
6990
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
118 if (pattern) { |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
119 y1 /= 2; |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
120 y1 += patt[j%4]*strength*0.35; |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
121 } |
6424 | 122 if (y1<-128) y1=-128; |
123 else if(y1> 127) y1= 127; | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
124 if (averaged) y1 /= 3.0; |
6424 | 125 noise[i]= (int)y1; |
126 } | |
6990
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
127 if (RAND_N(6) == 0) j--; |
6424 | 128 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29040
diff
changeset
|
129 |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
130 |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
131 for (i = 0; i < MAX_RES; i++) |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
132 for (j = 0; j < 3; j++) |
6964 | 133 fp->prev_shift[i][j] = noise + (rand()&(MAX_SHIFT-1)); |
6424 | 134 |
18030
ec68026bc1d0
move 12k from data to bss (reduce binary size by 12k)
rfelker
parents:
17906
diff
changeset
|
135 if(!nonTempRandShift_init){ |
6424 | 136 for(i=0; i<MAX_RES; i++){ |
137 nonTempRandShift[i]= rand()&(MAX_SHIFT-1); | |
138 } | |
18030
ec68026bc1d0
move 12k from data to bss (reduce binary size by 12k)
rfelker
parents:
17906
diff
changeset
|
139 nonTempRandShift_init = 1; |
6424 | 140 } |
141 | |
142 fp->noise= noise; | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
143 fp->shiftptr= 0; |
6424 | 144 return noise; |
145 } | |
146 | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
147 /***************************************************************************/ |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
148 |
28290 | 149 #if HAVE_MMX |
6424 | 150 static inline void lineNoise_MMX(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){ |
29040
963f578121c6
Use x86_reg instead of long in several video filters to fix compilation on MinGW64.
reimar
parents:
28594
diff
changeset
|
151 x86_reg mmx_len= len&(~7); |
6424 | 152 noise+=shift; |
153 | |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
154 __asm__ volatile( |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
155 "mov %3, %%"REG_a" \n\t" |
6424 | 156 "pcmpeqb %%mm7, %%mm7 \n\t" |
157 "psllw $15, %%mm7 \n\t" | |
158 "packsswb %%mm7, %%mm7 \n\t" | |
19372
6334c14b38eb
Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents:
18684
diff
changeset
|
159 ASMALIGN(4) |
6424 | 160 "1: \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
161 "movq (%0, %%"REG_a"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
162 "movq (%1, %%"REG_a"), %%mm1 \n\t" |
6424 | 163 "pxor %%mm7, %%mm0 \n\t" |
164 "paddsb %%mm1, %%mm0 \n\t" | |
165 "pxor %%mm7, %%mm0 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
166 "movq %%mm0, (%2, %%"REG_a") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
167 "add $8, %%"REG_a" \n\t" |
6424 | 168 " js 1b \n\t" |
169 :: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len) | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
170 : "%"REG_a |
6424 | 171 ); |
172 if(mmx_len!=len) | |
173 lineNoise_C(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0); | |
174 } | |
175 #endif | |
176 | |
177 //duplicate of previous except movntq | |
28290 | 178 #if HAVE_MMX2 |
6424 | 179 static inline void lineNoise_MMX2(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){ |
29040
963f578121c6
Use x86_reg instead of long in several video filters to fix compilation on MinGW64.
reimar
parents:
28594
diff
changeset
|
180 x86_reg mmx_len= len&(~7); |
6424 | 181 noise+=shift; |
182 | |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
183 __asm__ volatile( |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
184 "mov %3, %%"REG_a" \n\t" |
6424 | 185 "pcmpeqb %%mm7, %%mm7 \n\t" |
186 "psllw $15, %%mm7 \n\t" | |
187 "packsswb %%mm7, %%mm7 \n\t" | |
19372
6334c14b38eb
Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents:
18684
diff
changeset
|
188 ASMALIGN(4) |
6424 | 189 "1: \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
190 "movq (%0, %%"REG_a"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
191 "movq (%1, %%"REG_a"), %%mm1 \n\t" |
6424 | 192 "pxor %%mm7, %%mm0 \n\t" |
193 "paddsb %%mm1, %%mm0 \n\t" | |
194 "pxor %%mm7, %%mm0 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
195 "movntq %%mm0, (%2, %%"REG_a") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
196 "add $8, %%"REG_a" \n\t" |
6424 | 197 " js 1b \n\t" |
198 :: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len) | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
199 : "%"REG_a |
6424 | 200 ); |
201 if(mmx_len!=len) | |
202 lineNoise_C(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0); | |
203 } | |
204 #endif | |
205 | |
206 static inline void lineNoise_C(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){ | |
207 int i; | |
208 noise+= shift; | |
209 for(i=0; i<len; i++) | |
210 { | |
211 int v= src[i]+ noise[i]; | |
212 if(v>255) dst[i]=255; //FIXME optimize | |
213 else if(v<0) dst[i]=0; | |
214 else dst[i]=v; | |
215 } | |
216 } | |
217 | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
218 /***************************************************************************/ |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
219 |
28290 | 220 #if HAVE_MMX |
6966 | 221 static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t **shift){ |
29040
963f578121c6
Use x86_reg instead of long in several video filters to fix compilation on MinGW64.
reimar
parents:
28594
diff
changeset
|
222 x86_reg mmx_len= len&(~7); |
6966 | 223 |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
224 __asm__ volatile( |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
225 "mov %5, %%"REG_a" \n\t" |
19372
6334c14b38eb
Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents:
18684
diff
changeset
|
226 ASMALIGN(4) |
6966 | 227 "1: \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
228 "movq (%1, %%"REG_a"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
229 "movq (%0, %%"REG_a"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
230 "paddb (%2, %%"REG_a"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
231 "paddb (%3, %%"REG_a"), %%mm1 \n\t" |
6966 | 232 "movq %%mm0, %%mm2 \n\t" |
233 "movq %%mm1, %%mm3 \n\t" | |
234 "punpcklbw %%mm0, %%mm0 \n\t" | |
235 "punpckhbw %%mm2, %%mm2 \n\t" | |
236 "punpcklbw %%mm1, %%mm1 \n\t" | |
237 "punpckhbw %%mm3, %%mm3 \n\t" | |
238 "pmulhw %%mm0, %%mm1 \n\t" | |
239 "pmulhw %%mm2, %%mm3 \n\t" | |
240 "paddw %%mm1, %%mm1 \n\t" | |
241 "paddw %%mm3, %%mm3 \n\t" | |
242 "paddw %%mm0, %%mm1 \n\t" | |
243 "paddw %%mm2, %%mm3 \n\t" | |
244 "psrlw $8, %%mm1 \n\t" | |
245 "psrlw $8, %%mm3 \n\t" | |
246 "packuswb %%mm3, %%mm1 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
247 "movq %%mm1, (%4, %%"REG_a") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
248 "add $8, %%"REG_a" \n\t" |
6966 | 249 " js 1b \n\t" |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29040
diff
changeset
|
250 :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len), |
6966 | 251 "r" (dst+mmx_len), "g" (-mmx_len) |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10141
diff
changeset
|
252 : "%"REG_a |
6966 | 253 ); |
254 | |
255 if(mmx_len!=len){ | |
256 int8_t *shift2[3]={shift[0]+mmx_len, shift[1]+mmx_len, shift[2]+mmx_len}; | |
257 lineNoiseAvg_C(dst+mmx_len, src+mmx_len, len-mmx_len, shift2); | |
258 } | |
259 } | |
260 #endif | |
261 | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
262 static inline void lineNoiseAvg_C(uint8_t *dst, uint8_t *src, int len, int8_t **shift){ |
6965 | 263 int i; |
264 int8_t *src2= (int8_t*)src; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29040
diff
changeset
|
265 |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
266 for(i=0; i<len; i++) |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
267 { |
6965 | 268 const int n= shift[0][i] + shift[1][i] + shift[2][i]; |
269 dst[i]= src2[i]+((n*src2[i])>>7); | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
270 } |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
271 } |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
272 |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
273 /***************************************************************************/ |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
274 |
6424 | 275 static void noise(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height, FilterParam *fp){ |
276 int8_t *noise= fp->noise; | |
277 int y; | |
278 int shift=0; | |
279 | |
280 if(!noise) | |
281 { | |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
282 if(src==dst) return; |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
283 |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
19372
diff
changeset
|
284 if(dstStride==srcStride) fast_memcpy(dst, src, srcStride*height); |
6424 | 285 else |
286 { | |
287 for(y=0; y<height; y++) | |
288 { | |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
19372
diff
changeset
|
289 fast_memcpy(dst, src, width); |
6424 | 290 dst+= dstStride; |
6448 | 291 src+= srcStride; |
6424 | 292 } |
293 } | |
294 return; | |
295 } | |
296 | |
297 for(y=0; y<height; y++) | |
298 { | |
299 if(fp->temporal) shift= rand()&(MAX_SHIFT -1); | |
300 else shift= nonTempRandShift[y]; | |
301 | |
6448 | 302 if(fp->quality==0) shift&= ~7; |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
303 if (fp->averaged) { |
6964 | 304 lineNoiseAvg(dst, src, width, fp->prev_shift[y]); |
305 fp->prev_shift[y][fp->shiftptr] = noise + shift; | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
306 } else { |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
307 lineNoise(dst, src, noise, width, shift); |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
308 } |
6424 | 309 dst+= dstStride; |
310 src+= srcStride; | |
311 } | |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
312 fp->shiftptr++; |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
313 if (fp->shiftptr == 3) fp->shiftptr = 0; |
6424 | 314 } |
315 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
316 static int config(struct vf_instance *vf, |
6424 | 317 int width, int height, int d_width, int d_height, |
318 unsigned int flags, unsigned int outfmt){ | |
6448 | 319 |
6424 | 320 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
321 } | |
322 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
323 static void get_image(struct vf_instance *vf, mp_image_t *mpi){ |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
324 if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change |
6962 | 325 if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
326 // ok, we can do pp in-place (or pp disabled): |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
327 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
328 mpi->type, mpi->flags, mpi->w, mpi->h); |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
329 mpi->planes[0]=vf->dmpi->planes[0]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
330 mpi->stride[0]=vf->dmpi->stride[0]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
331 mpi->width=vf->dmpi->width; |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
332 if(mpi->flags&MP_IMGFLAG_PLANAR){ |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
333 mpi->planes[1]=vf->dmpi->planes[1]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
334 mpi->planes[2]=vf->dmpi->planes[2]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
335 mpi->stride[1]=vf->dmpi->stride[1]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
336 mpi->stride[2]=vf->dmpi->stride[2]; |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
337 } |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
338 mpi->flags|=MP_IMGFLAG_DIRECT; |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
339 } |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
340 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
341 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ |
6424 | 342 mp_image_t *dmpi; |
343 | |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
344 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
345 // no DR, so get a new image! hope we'll get DR buffer: |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
346 vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, |
6424 | 347 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
348 mpi->w,mpi->h); |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
349 //printf("nodr\n"); |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
350 } |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
351 //else printf("dr\n"); |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9934
diff
changeset
|
352 dmpi= vf->dmpi; |
6424 | 353 |
354 noise(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, &vf->priv->lumaParam); | |
355 noise(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam); | |
356 noise(dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2, &vf->priv->chromaParam); | |
357 | |
9934 | 358 vf_clone_mpi_attributes(dmpi, mpi); |
6424 | 359 |
28290 | 360 #if HAVE_MMX |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
361 if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t"); |
6424 | 362 #endif |
28290 | 363 #if HAVE_MMX2 |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
26727
diff
changeset
|
364 if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t"); |
6424 | 365 #endif |
366 | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
367 return vf_next_put_image(vf,dmpi, pts); |
6424 | 368 } |
369 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
370 static void uninit(struct vf_instance *vf){ |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
371 if(!vf->priv) return; |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
372 |
31003
00825525514e
Replace memalign(x) (x > 8) by av_malloc() to prevent crashes on systems
zuxy
parents:
30708
diff
changeset
|
373 if(vf->priv->chromaParam.noise) av_free(vf->priv->chromaParam.noise); |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
374 vf->priv->chromaParam.noise= NULL; |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
375 |
31003
00825525514e
Replace memalign(x) (x > 8) by av_malloc() to prevent crashes on systems
zuxy
parents:
30708
diff
changeset
|
376 if(vf->priv->lumaParam.noise) av_free(vf->priv->lumaParam.noise); |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
377 vf->priv->lumaParam.noise= NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29040
diff
changeset
|
378 |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
379 free(vf->priv); |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
380 vf->priv=NULL; |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
381 } |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
382 |
6424 | 383 //===========================================================================// |
384 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
385 static int query_format(struct vf_instance *vf, unsigned int fmt){ |
6424 | 386 switch(fmt) |
387 { | |
388 case IMGFMT_YV12: | |
389 case IMGFMT_I420: | |
390 case IMGFMT_IYUV: | |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
391 return vf_next_query_format(vf,vf->priv->outfmt); |
6424 | 392 } |
393 return 0; | |
394 } | |
395 | |
396 static void parse(FilterParam *fp, char* args){ | |
397 char *pos; | |
398 char *max= strchr(args, ':'); | |
399 | |
400 if(!max) max= args + strlen(args); | |
401 | |
402 fp->strength= atoi(args); | |
403 pos= strchr(args, 'u'); | |
404 if(pos && pos<max) fp->uniform=1; | |
405 pos= strchr(args, 't'); | |
406 if(pos && pos<max) fp->temporal=1; | |
6448 | 407 pos= strchr(args, 'h'); |
408 if(pos && pos<max) fp->quality=1; | |
6990
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
409 pos= strchr(args, 'p'); |
857bae3001e8
semi regular noise pattern patch by (Jindrich Makovicka <makovick at kmlinux dot fjfi dot cvut dot cz>)
michael
parents:
6966
diff
changeset
|
410 if(pos && pos<max) fp->pattern=1; |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
411 pos= strchr(args, 'a'); |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
412 if(pos && pos<max) { |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
413 fp->temporal=1; |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
414 fp->averaged=1; |
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
415 } |
6424 | 416 |
417 if(fp->strength) initNoise(fp); | |
418 } | |
419 | |
30708 | 420 static const unsigned int fmt_list[]={ |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
421 IMGFMT_YV12, |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
422 IMGFMT_I420, |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
423 IMGFMT_IYUV, |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
424 0 |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
425 }; |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
426 |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
29263
diff
changeset
|
427 static int vf_open(vf_instance_t *vf, char *args){ |
6424 | 428 vf->config=config; |
429 vf->put_image=put_image; | |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
430 vf->get_image=get_image; |
6424 | 431 vf->query_format=query_format; |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
432 vf->uninit=uninit; |
6424 | 433 vf->priv=malloc(sizeof(struct vf_priv_s)); |
434 memset(vf->priv, 0, sizeof(struct vf_priv_s)); | |
435 if(args) | |
436 { | |
437 char *arg2= strchr(args,':'); | |
438 if(arg2) parse(&vf->priv->chromaParam, arg2+1); | |
439 parse(&vf->priv->lumaParam, args); | |
440 } | |
6447
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
441 |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
442 // check csp: |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
443 vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
444 if(!vf->priv->outfmt) |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
445 { |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
446 uninit(vf); |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
447 return 0; // no csp match :( |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
448 } |
751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
michael
parents:
6424
diff
changeset
|
449 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29040
diff
changeset
|
450 |
28290 | 451 #if HAVE_MMX |
6966 | 452 if(gCpuCaps.hasMMX){ |
453 lineNoise= lineNoise_MMX; | |
454 lineNoiseAvg= lineNoiseAvg_MMX; | |
455 } | |
6424 | 456 #endif |
28290 | 457 #if HAVE_MMX2 |
6424 | 458 if(gCpuCaps.hasMMX2) lineNoise= lineNoise_MMX2; |
6963
76fee64d884a
film/average noise patch by (Jindrich Makovicka <makovick at KMLinux dot fjfi dot cvut dot cz>)
michael
parents:
6962
diff
changeset
|
459 // if(gCpuCaps.hasMMX) lineNoiseAvg= lineNoiseAvg_MMX2; |
6424 | 460 #endif |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29040
diff
changeset
|
461 |
6424 | 462 return 1; |
463 } | |
464 | |
25221 | 465 const vf_info_t vf_info_noise = { |
18684
c9de3673e299
typo noticed by Alexander Monakov monoid$$at$$fds-net$$dot$$ru
diego
parents:
18104
diff
changeset
|
466 "noise generator", |
6424 | 467 "noise", |
468 "Michael Niedermayer", | |
469 "", | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
29263
diff
changeset
|
470 vf_open, |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
7368
diff
changeset
|
471 NULL |
6424 | 472 }; |
473 | |
474 //===========================================================================// |