annotate libmpcodecs/vf_eq.c @ 7282:b21e38a4fbec

links (found on xvid-dev list)
author michael
date Thu, 05 Sep 2002 09:38:06 +0000
parents ebc1cd8014a5
children a894e99c1e51
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
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
6 #include "../config.h"
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
7 #include "../mp_msg.h"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
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
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
14 #include "../libvo/video_out.h"
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
15 #include "../libvo/fastmemcpy.h"
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
16 #include "../postproc/rgb2rgb.h"
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
17
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
18 struct vf_priv_s {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
19 unsigned char *buf;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
20 int brightness;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
21 int contrast;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
22 };
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
23
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
24 #ifdef HAVE_MMX
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
25 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
26 int w, int h, int brightness, int contrast)
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
27 {
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
28 int i;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
29 int pel;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
30 int dstep = dstride-w;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
31 int sstep = sstride-w;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
32 short brvec[4];
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
33 short contvec[4];
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
34
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
35 contrast = ((contrast+100)*256*16)/100;
ba46984544bb optimization
michael
parents: 7065
diff changeset
36 brightness = ((brightness+100)*511)/200-128 - contrast/32;
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
37
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
38 brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
39 contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
40
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
41 while (h--) {
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
42 asm volatile (
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
43 "movq (%5), %%mm3 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
44 "movq (%6), %%mm4 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
45 "pxor %%mm0, %%mm0 \n\t"
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
46 "movl %4, %%eax\n\t"
7107
ebc1cd8014a5 align -> balign patch by (Bj«Órn Sandell <biorn at dce dot chalmers dot se>)
michael
parents: 7078
diff changeset
47 ".balign 16 \n\t"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
48 "1: \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
49 "movq (%0), %%mm1 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
50 "movq (%0), %%mm2 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
51 "punpcklbw %%mm0, %%mm1 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
52 "punpckhbw %%mm0, %%mm2 \n\t"
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
53 "psllw $4, %%mm1 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
54 "psllw $4, %%mm2 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
55 "pmulhw %%mm4, %%mm1 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
56 "pmulhw %%mm4, %%mm2 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
57 "paddw %%mm3, %%mm1 \n\t"
ba46984544bb optimization
michael
parents: 7065
diff changeset
58 "paddw %%mm3, %%mm2 \n\t"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
59 "packuswb %%mm2, %%mm1 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
60 "addl $8, %0 \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
61 "movq %%mm1, (%1) \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
62 "addl $8, %1 \n\t"
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
63 "decl %%eax \n\t"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
64 "jnz 1b \n\t"
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
65 : "=r" (src), "=r" (dest)
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
66 : "0" (src), "1" (dest), "r" (w>>3), "r" (brvec), "r" (contvec)
ba46984544bb optimization
michael
parents: 7065
diff changeset
67 : "%eax"
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
68 );
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
69
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
70 for (i = w&7; i; i--)
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
71 {
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
72 pel = ((*src++* contrast)>>12) + brightness;
ba46984544bb optimization
michael
parents: 7065
diff changeset
73 if(pel&768) pel = (-pel)>>31;
ba46984544bb optimization
michael
parents: 7065
diff changeset
74 *dest++ = pel;
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
75 }
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
76
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
77 src += sstep;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
78 dest += dstep;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
79 }
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
80 asm volatile ( "emms \n\t" ::: "memory" );
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
81 }
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
82 #endif
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
83
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
84 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
85 int w, int h, int brightness, int contrast)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
86 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
87 int i;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
88 int pel;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
89 int dstep = dstride-w;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
90 int sstep = sstride-w;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
91
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
92 contrast = ((contrast+100)*256*256)/100;
ba46984544bb optimization
michael
parents: 7065
diff changeset
93 brightness = ((brightness+100)*511)/200-128 - contrast/512;
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
94
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
95 while (h--) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
96 for (i = w; i; i--)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
97 {
7078
ba46984544bb optimization
michael
parents: 7065
diff changeset
98 pel = ((*src++* contrast)>>16) + brightness;
ba46984544bb optimization
michael
parents: 7065
diff changeset
99 if(pel&768) pel = (-pel)>>31;
ba46984544bb optimization
michael
parents: 7065
diff changeset
100 *dest++ = pel;
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
101 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
102 src += sstep;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
103 dest += dstep;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
104 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
105 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
106
7065
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
107 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
108 int w, int h, int brightness, int contrast);
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
109
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
110 /* FIXME: add packed yuv version of process */
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
111
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
112 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
113 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
114 mp_image_t *dmpi;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
115
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
116 dmpi=vf_get_image(vf->next, mpi->imgfmt,
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
117 MP_IMGTYPE_EXPORT, 0,
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
118 mpi->w, mpi->h);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
119
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
120 dmpi->stride[0] = mpi->stride[0];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
121 dmpi->planes[1] = mpi->planes[1];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
122 dmpi->planes[2] = mpi->planes[2];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
123 dmpi->stride[1] = mpi->stride[1];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
124 dmpi->stride[2] = mpi->stride[2];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
125
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
126 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
127
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
128 if ((vf->priv->brightness == 0) && (vf->priv->contrast == 0))
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
129 dmpi->planes[0] = mpi->planes[0];
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
130 else {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
131 dmpi->planes[0] = vf->priv->buf;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
132 process(dmpi->planes[0], dmpi->stride[0],
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
133 mpi->planes[0], mpi->stride[0],
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
134 mpi->w, mpi->h, vf->priv->brightness,
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
135 vf->priv->contrast);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
136 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
137
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
138 vf_next_put_image(vf,dmpi);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
139 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
140
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
141 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
142 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
143 vf_equalizer_t *eq;
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 switch (request) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
146 case VFCTRL_SET_EQUALIZER:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
147 eq = data;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
148 if (!strcmp(eq->item,"brightness")) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
149 vf->priv->brightness = eq->value;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
150 return CONTROL_TRUE;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
151 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
152 else if (!strcmp(eq->item,"contrast")) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
153 vf->priv->contrast = eq->value;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
154 return CONTROL_TRUE;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
155 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
156 break;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
157 case VFCTRL_GET_EQUALIZER:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
158 eq = data;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
159 if (!strcmp(eq->item,"brightness")) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
160 eq->value = vf->priv->brightness;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
161 return CONTROL_TRUE;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
162 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
163 else if (!strcmp(eq->item,"contrast")) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
164 eq->value = vf->priv->contrast;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
165 return CONTROL_TRUE;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
166 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
167 break;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
168 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
169 return vf_next_control(vf, request, data);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
170 }
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 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
173 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
174 switch (fmt) {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
175 case IMGFMT_YVU9:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
176 case IMGFMT_IF09:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
177 case IMGFMT_YV12:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
178 case IMGFMT_I420:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
179 case IMGFMT_IYUV:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
180 case IMGFMT_CLPL:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
181 case IMGFMT_Y800:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
182 case IMGFMT_Y8:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
183 case IMGFMT_NV12:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
184 case IMGFMT_444P:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
185 case IMGFMT_422P:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
186 case IMGFMT_411P:
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
187 return vf_next_query_format(vf, fmt);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
188 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
189 return 0;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
190 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
191
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
192 static void uninit(struct vf_instance_s* vf)
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
193 {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
194 if (vf->priv->buf) free(vf->priv->buf);
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
195 free(vf->priv);
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 int open(vf_instance_t *vf, char* args)
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 vf->control=control;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
201 vf->query_format=query_format;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
202 vf->put_image=put_image;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
203 vf->uninit=uninit;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
204
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
205 vf->priv = malloc(sizeof(struct vf_priv_s));
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
206 memset(vf->priv, 0, sizeof(struct vf_priv_s));
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
207 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
208
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
209 process = process_C;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
210 #ifdef HAVE_MMX
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
211 if(gCpuCaps.hasMMX) process = process_MMX;
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
212 #endif
7685130ba4bd MMX optimized code for soft equalizer filter
rfelker
parents: 7062
diff changeset
213
7062
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
214 return 1;
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
215 }
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
216
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
217 vf_info_t vf_info_eq = {
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
218 "soft video equalizer",
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
219 "eq",
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
220 "Richard Felker",
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
221 "",
9eae15166ebb soft video equalizer filter, currently supports brightness and
rfelker
parents:
diff changeset
222 open
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