annotate libmpcodecs/vf_eq.c @ 29154:d26f4b307224

Introduce ADD_ALL_DIRS function to factorize clean and distclean target commands to remove certain patterns in all subdirectories.
author diego
date Sun, 19 Apr 2009 15:51:06 +0000
parents 25337a2147e7
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
1 #include <stdio.h>
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
2 #include <stdlib.h>
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
3 #include <string.h>
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
4 #include <inttypes.h>
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
5
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14715
diff changeset
6 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14715
diff changeset
7 #include "mp_msg.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14715
diff changeset
8 #include "cpudetect.h"
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
9
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
10 #include "img_format.h"
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
11 #include "mp_image.h"
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
12 #include "vf.h"
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
13
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 14715
diff changeset
14 #include "libvo/video_out.h"
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
15
9599
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
16 #include "m_option.h"
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
17 #include "m_struct.h"
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
18
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
19 static struct vf_priv_s {
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
20 unsigned char *buf;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
21 int brightness;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
22 int contrast;
22027
0b262e00bc99 Mark m_struct_t defaults as const
reimar
parents: 19372
diff changeset
23 } const vf_priv_dflt = {
9599
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
24 NULL,
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
25 0,
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
26 0
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
27 };
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
28
28290
25337a2147e7 Lots and lots of #ifdef ARCH_... -> #if ARCH_...
reimar
parents: 27754
diff changeset
29 #if HAVE_MMX
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
30 static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, int sstride,
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
31 int w, int h, int brightness, int contrast)
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
32 {
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
33 int i;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
34 int pel;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
35 int dstep = dstride-w;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
36 int sstep = sstride-w;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
37 short brvec[4];
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
38 short contvec[4];
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
39
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
40 contrast = ((contrast+100)*256*16)/100;
ba46984544bb optimization
michael
parents: 7065
diff changeset
41 brightness = ((brightness+100)*511)/200-128 - contrast/32;
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
42
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
43 brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
44 contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
45
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
46 while (h--) {
27754
08d18fe9da52 Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents: 25221
diff changeset
47 __asm__ volatile (
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
48 "movq (%5), %%mm3 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
49 "movq (%6), %%mm4 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
50 "pxor %%mm0, %%mm0 \n\t"
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
51 "movl %4, %%eax\n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18746
diff changeset
52 ASMALIGN(4)
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
53 "1: \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
54 "movq (%0), %%mm1 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
55 "movq (%0), %%mm2 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
56 "punpcklbw %%mm0, %%mm1 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
57 "punpckhbw %%mm0, %%mm2 \n\t"
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
58 "psllw $4, %%mm1 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
59 "psllw $4, %%mm2 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
60 "pmulhw %%mm4, %%mm1 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
61 "pmulhw %%mm4, %%mm2 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
62 "paddw %%mm3, %%mm1 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
63 "paddw %%mm3, %%mm2 \n\t"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
64 "packuswb %%mm2, %%mm1 \n\t"
13720
821f464b4d90 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents: 9599
diff changeset
65 "add $8, %0 \n\t"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
66 "movq %%mm1, (%1) \n\t"
13720
821f464b4d90 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents: 9599
diff changeset
67 "add $8, %1 \n\t"
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
68 "decl %%eax \n\t"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
69 "jnz 1b \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
70 : "=r" (src), "=r" (dest)
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
71 : "0" (src), "1" (dest), "r" (w>>3), "r" (brvec), "r" (contvec)
ba46984544bb optimization
michael
parents: 7065
diff changeset
72 : "%eax"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
73 );
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
74
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
75 for (i = w&7; i; i--)
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
76 {
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
77 pel = ((*src++* contrast)>>12) + brightness;
ba46984544bb optimization
michael
parents: 7065
diff changeset
78 if(pel&768) pel = (-pel)>>31;
ba46984544bb optimization
michael
parents: 7065
diff changeset
79 *dest++ = pel;
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
80 }
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
81
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
82 src += sstep;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
83 dest += dstep;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
84 }
27754
08d18fe9da52 Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents: 25221
diff changeset
85 __asm__ volatile ( "emms \n\t" ::: "memory" );
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
86 }
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
87 #endif
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
88
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
89 static void process_C(unsigned char *dest, int dstride, unsigned char *src, int sstride,
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
90 int w, int h, int brightness, int contrast)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
91 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
92 int i;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
93 int pel;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
94 int dstep = dstride-w;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
95 int sstep = sstride-w;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
96
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
97 contrast = ((contrast+100)*256*256)/100;
ba46984544bb optimization
michael
parents: 7065
diff changeset
98 brightness = ((brightness+100)*511)/200-128 - contrast/512;
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
99
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
100 while (h--) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
101 for (i = w; i; i--)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
102 {
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
103 pel = ((*src++* contrast)>>16) + brightness;
ba46984544bb optimization
michael
parents: 7065
diff changeset
104 if(pel&768) pel = (-pel)>>31;
ba46984544bb optimization
michael
parents: 7065
diff changeset
105 *dest++ = pel;
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
106 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
107 src += sstep;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
108 dest += dstep;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
109 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
110 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
111
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
112 static void (*process)(unsigned char *dest, int dstride, unsigned char *src, int sstride,
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
113 int w, int h, int brightness, int contrast);
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
114
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
115 /* FIXME: add packed yuv version of process */
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
116
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
117 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
118 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
119 mp_image_t *dmpi;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
120
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
121 dmpi=vf_get_image(vf->next, mpi->imgfmt,
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
122 MP_IMGTYPE_EXPORT, 0,
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
123 mpi->w, mpi->h);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
124
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
125 dmpi->stride[0] = mpi->stride[0];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
126 dmpi->planes[1] = mpi->planes[1];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
127 dmpi->planes[2] = mpi->planes[2];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
128 dmpi->stride[1] = mpi->stride[1];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
129 dmpi->stride[2] = mpi->stride[2];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
130
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
131 if (!vf->priv->buf) vf->priv->buf = malloc(mpi->stride[0]*mpi->h);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
132
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
133 if ((vf->priv->brightness == 0) && (vf->priv->contrast == 0))
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
134 dmpi->planes[0] = mpi->planes[0];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
135 else {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
136 dmpi->planes[0] = vf->priv->buf;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
137 process(dmpi->planes[0], dmpi->stride[0],
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
138 mpi->planes[0], mpi->stride[0],
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
139 mpi->w, mpi->h, vf->priv->brightness,
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
140 vf->priv->contrast);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
141 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
142
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
143 return vf_next_put_image(vf,dmpi, pts);
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
144 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
145
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
146 static int control(struct vf_instance_s* vf, int request, void* data)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
147 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
148 vf_equalizer_t *eq;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
149
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
150 switch (request) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
151 case VFCTRL_SET_EQUALIZER:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
152 eq = data;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
153 if (!strcmp(eq->item,"brightness")) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
154 vf->priv->brightness = eq->value;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
155 return CONTROL_TRUE;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
156 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
157 else if (!strcmp(eq->item,"contrast")) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
158 vf->priv->contrast = eq->value;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
159 return CONTROL_TRUE;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
160 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
161 break;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
162 case VFCTRL_GET_EQUALIZER:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
163 eq = data;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
164 if (!strcmp(eq->item,"brightness")) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
165 eq->value = vf->priv->brightness;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
166 return CONTROL_TRUE;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
167 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
168 else if (!strcmp(eq->item,"contrast")) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
169 eq->value = vf->priv->contrast;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
170 return CONTROL_TRUE;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
171 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
172 break;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
173 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
174 return vf_next_control(vf, request, data);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
175 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
176
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
177 static int query_format(struct vf_instance_s* vf, unsigned int fmt)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
178 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
179 switch (fmt) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
180 case IMGFMT_YVU9:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
181 case IMGFMT_IF09:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
182 case IMGFMT_YV12:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
183 case IMGFMT_I420:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
184 case IMGFMT_IYUV:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
185 case IMGFMT_CLPL:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
186 case IMGFMT_Y800:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
187 case IMGFMT_Y8:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
188 case IMGFMT_NV12:
14715
1fab95e4513c Improved NV12/NV21 support.
syrjala
parents: 13720
diff changeset
189 case IMGFMT_NV21:
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
190 case IMGFMT_444P:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
191 case IMGFMT_422P:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
192 case IMGFMT_411P:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
193 return vf_next_query_format(vf, fmt);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
194 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
195 return 0;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
196 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
197
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
198 static void uninit(struct vf_instance_s* vf)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
199 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
200 if (vf->priv->buf) free(vf->priv->buf);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
201 free(vf->priv);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
202 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
203
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
204 static int open(vf_instance_t *vf, char* args)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
205 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
206 vf->control=control;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
207 vf->query_format=query_format;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
208 vf->put_image=put_image;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
209 vf->uninit=uninit;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
210
9599
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
211 if(!vf->priv) {
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
212 vf->priv = malloc(sizeof(struct vf_priv_s));
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
213 memset(vf->priv, 0, sizeof(struct vf_priv_s));
9599
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
214 }
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
215 if (args) sscanf(args, "%d:%d", &vf->priv->brightness, &vf->priv->contrast);
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
216
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
217 process = process_C;
28290
25337a2147e7 Lots and lots of #ifdef ARCH_... -> #if ARCH_...
reimar
parents: 27754
diff changeset
218 #if HAVE_MMX
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
219 if(gCpuCaps.hasMMX) process = process_MMX;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
220 #endif
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
221
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
222 return 1;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
223 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
224
9599
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
225 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
226 static m_option_t vf_opts_fields[] = {
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
227 {"brightness", ST_OFF(brightness), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
228 {"contrast", ST_OFF(contrast), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
229 { NULL, NULL, 0, 0, 0, 0, NULL }
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
230 };
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
231
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
232 static m_struct_t vf_opts = {
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
233 "eq",
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
234 sizeof(struct vf_priv_s),
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
235 &vf_priv_dflt,
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
236 vf_opts_fields
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
237 };
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
238
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 23373
diff changeset
239 const vf_info_t vf_info_eq = {
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
240 "soft video equalizer",
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
241 "eq",
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
242 "Richard Felker",
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
243 "",
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 7368
diff changeset
244 open,
9599
77bddc6d9266 Support for the new options stuff
albeu
parents: 9593
diff changeset
245 &vf_opts
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
246 };
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
247