40 #if HAVE_MMX && HAVE_6REGS
41 static void process_MMX(
unsigned char *dest,
int dstride,
unsigned char *
src,
int sstride,
42 int w,
int h,
int brightness,
int contrast)
46 int dstep = dstride-w;
47 int sstep = sstride-w;
51 contrast = ((contrast+100)*256*16)/100;
52 brightness = ((brightness+100)*511)/200-128 - contrast/32;
54 brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness;
55 contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast;
59 "movq (%5), %%mm3 \n\t"
60 "movq (%6), %%mm4 \n\t"
61 "pxor %%mm0, %%mm0 \n\t"
65 "movq (%0), %%mm1 \n\t"
66 "movq (%0), %%mm2 \n\t"
67 "punpcklbw %%mm0, %%mm1 \n\t"
68 "punpckhbw %%mm0, %%mm2 \n\t"
69 "psllw $4, %%mm1 \n\t"
70 "psllw $4, %%mm2 \n\t"
71 "pmulhw %%mm4, %%mm1 \n\t"
72 "pmulhw %%mm4, %%mm2 \n\t"
73 "paddw %%mm3, %%mm1 \n\t"
74 "paddw %%mm3, %%mm2 \n\t"
75 "packuswb %%mm2, %%mm1 \n\t"
77 "movq %%mm1, (%1) \n\t"
81 :
"=r" (
src),
"=r" (dest)
82 :
"0" (
src),
"1" (dest),
"r" (w>>3),
"r" (brvec),
"r" (contvec)
88 pel = ((*src++* contrast)>>12) + brightness;
89 if(pel&768) pel = (-pel)>>31;
96 __asm__
volatile (
"emms \n\t" :::
"memory" );
100 static void process_C(
unsigned char *dest,
int dstride,
unsigned char *
src,
int sstride,
101 int w,
int h,
int brightness,
int contrast)
105 int dstep = dstride-w;
106 int sstep = sstride-w;
108 contrast = ((contrast+100)*256*256)/100;
109 brightness = ((brightness+100)*511)/200-128 - contrast/512;
114 pel = ((*src++* contrast)>>16) + brightness;
115 if(pel&768) pel = (-pel)>>31;
123 static void (*
process)(
unsigned char *dest,
int dstride,
unsigned char *
src,
int sstride,
124 int w,
int h,
int brightness,
int contrast);
142 if (!vf->priv->buf) vf->priv->buf = malloc(mpi->
stride[0]*mpi->
h);
144 if ((vf->priv->brightness == 0) && (vf->priv->contrast == 0))
147 dmpi->
planes[0] = vf->priv->buf;
150 mpi->
w, mpi->
h, vf->priv->brightness,
157 static int control(
struct vf_instance *vf,
int request,
void*
data)
164 if (!strcmp(eq->
item,
"brightness")) {
165 vf->priv->brightness = eq->
value;
168 else if (!strcmp(eq->
item,
"contrast")) {
169 vf->priv->contrast = eq->
value;
175 if (!strcmp(eq->
item,
"brightness")) {
176 eq->
value = vf->priv->brightness;
179 else if (!strcmp(eq->
item,
"contrast")) {
180 eq->
value = vf->priv->contrast;
209 static void uninit(
struct vf_instance *vf)
227 #if HAVE_MMX && HAVE_6REGS
235 "soft video equalizer",