Mercurial > mplayer.hg
annotate libmpcodecs/vf_eq2.c @ 14104:0e334ea33ebf
MPlayer-translations mailing list created.
author | diego |
---|---|
date | Sun, 05 Dec 2004 13:07:57 +0000 |
parents | 821f464b4d90 |
children | 4a6b79a1ad52 |
rev | line source |
---|---|
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
1 /* |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
2 * vf_eq2.c |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
3 * |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
4 * Software equalizer (brightness, contrast, gamma, saturation) |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
5 * |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
6 * Hampa Hug <hampa@hampa.ch> (original LUT gamma/contrast/brightness filter) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
7 * Daniel Moreno <comac@comac.darktech.org> (saturation, R/G/B gamma support) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
8 * Richard Felker (original MMX contrast/brightness code (vf_eq.c)) |
11166 | 9 * Michael Niedermayer <michalni@gmx.at> (LUT16) |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
10 */ |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
11 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
12 #include <stdio.h> |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
13 #include <stdlib.h> |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
14 #include <string.h> |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
15 #include <math.h> |
11166 | 16 #include <inttypes.h> |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
17 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
18 #include "config.h" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
19 #include "mp_msg.h" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
20 #include "cpudetect.h" |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
21 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
22 #include "img_format.h" |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
23 #include "mp_image.h" |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
24 #include "vf.h" |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
25 |
8087 | 26 #ifdef USE_SETLOCALE |
27 #include <locale.h> | |
28 #endif | |
29 | |
11166 | 30 #define LUT16 |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
31 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
32 /* Per channel parameters */ |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
33 typedef struct eq2_param_t { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
34 unsigned char lut[256]; |
11166 | 35 #ifdef LUT16 |
36 uint16_t lut16[256*256]; | |
37 #endif | |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
38 int lut_clean; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
39 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
40 void (*adjust) (struct eq2_param_t *par, unsigned char *dst, unsigned char *src, |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
41 unsigned w, unsigned h, unsigned dstride, unsigned sstride); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
42 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
43 double c; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
44 double b; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
45 double g; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
46 double w; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
47 } eq2_param_t; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
48 |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
49 typedef struct vf_priv_s { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
50 eq2_param_t param[3]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
51 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
52 double contrast; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
53 double brightness; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
54 double saturation; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
55 |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
56 double gamma; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
57 double gamma_weight; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
58 double rgamma; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
59 double ggamma; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
60 double bgamma; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
61 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
62 unsigned buf_w[3]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
63 unsigned buf_h[3]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
64 unsigned char *buf[3]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
65 } vf_eq2_t; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
66 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
67 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
68 static |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
69 void create_lut (eq2_param_t *par) |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
70 { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
71 unsigned i; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
72 double g, v; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
73 double lw, gw; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
74 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
75 g = par->g; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
76 gw = par->w; |
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
77 lw = 1.0 - gw; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
78 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
79 if ((g < 0.001) || (g > 1000.0)) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
80 g = 1.0; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
81 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
82 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
83 g = 1.0 / g; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
84 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
85 for (i = 0; i < 256; i++) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
86 v = (double) i / 255.0; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
87 v = par->c * (v - 0.5) + 0.5 + par->b; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
88 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
89 if (v <= 0.0) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
90 par->lut[i] = 0; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
91 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
92 else { |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
93 v = v*lw + pow(v, g)*gw; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
94 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
95 if (v >= 1.0) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
96 par->lut[i] = 255; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
97 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
98 else { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
99 par->lut[i] = (unsigned char) (256.0 * v); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
100 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
101 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
102 } |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
103 |
11166 | 104 #ifdef LUT16 |
105 for(i=0; i<256*256; i++){ | |
106 par->lut16[i]= par->lut[i&0xFF] + (par->lut[i>>8]<<8); | |
107 } | |
108 #endif | |
109 | |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
110 par->lut_clean = 1; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
111 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
112 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
113 #ifdef HAVE_MMX |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
114 static |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
115 void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src, |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
116 unsigned w, unsigned h, unsigned dstride, unsigned sstride) |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
117 { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
118 unsigned i; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
119 int contrast, brightness; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
120 unsigned dstep, sstep; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
121 int pel; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
122 short brvec[4]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
123 short contvec[4]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
124 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
125 // printf("\nmmx: src=%p dst=%p w=%d h=%d ds=%d ss=%d\n",src,dst,w,h,dstride,sstride); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
126 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
127 contrast = (int) (par->c * 256 * 16); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
128 brightness = ((int) (100.0 * par->b + 100.0) * 511) / 200 - 128 - contrast / 32; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
129 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
130 brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
131 contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
132 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
133 sstep = sstride - w; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
134 dstep = dstride - w; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
135 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
136 while (h-- > 0) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
137 asm volatile ( |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
138 "movq (%5), %%mm3 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
139 "movq (%6), %%mm4 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
140 "pxor %%mm0, %%mm0 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
141 "movl %4, %%eax\n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
142 ".balign 16 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
143 "1: \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
144 "movq (%0), %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
145 "movq (%0), %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
146 "punpcklbw %%mm0, %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
147 "punpckhbw %%mm0, %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
148 "psllw $4, %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
149 "psllw $4, %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
150 "pmulhw %%mm4, %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
151 "pmulhw %%mm4, %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
152 "paddw %%mm3, %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
153 "paddw %%mm3, %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
154 "packuswb %%mm2, %%mm1 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11169
diff
changeset
|
155 "add $8, %0 \n\t" |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
156 "movq %%mm1, (%1) \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11169
diff
changeset
|
157 "add $8, %1 \n\t" |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
158 "decl %%eax \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
159 "jnz 1b \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
160 : "=r" (src), "=r" (dst) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
161 : "0" (src), "1" (dst), "r" (w >> 3), "r" (brvec), "r" (contvec) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
162 : "%eax" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
163 ); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
164 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
165 for (i = w & 7; i > 0; i--) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
166 pel = ((*src++ * contrast) >> 12) + brightness; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
167 if (pel & 768) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
168 pel = (-pel) >> 31; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
169 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
170 *dst++ = pel; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
171 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
172 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
173 src += sstep; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
174 dst += dstep; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
175 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
176 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
177 asm volatile ( "emms \n\t" ::: "memory" ); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
178 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
179 #endif |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
180 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
181 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
182 void apply_lut (eq2_param_t *par, unsigned char *dst, unsigned char *src, |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
183 unsigned w, unsigned h, unsigned dstride, unsigned sstride) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
184 { |
11166 | 185 unsigned i, j, w2; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
186 unsigned char *lut; |
11166 | 187 uint16_t *lut16; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
188 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
189 if (!par->lut_clean) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
190 create_lut (par); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
191 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
192 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
193 lut = par->lut; |
11166 | 194 #ifdef LUT16 |
195 lut16 = par->lut16; | |
196 w2= (w>>3)<<2; | |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
197 for (j = 0; j < h; j++) { |
11166 | 198 uint16_t *src16= (uint16_t*)src; |
199 uint16_t *dst16= (uint16_t*)dst; | |
200 for (i = 0; i < w2; i+=4) { | |
201 dst16[i+0] = lut16[src16[i+0]]; | |
202 dst16[i+1] = lut16[src16[i+1]]; | |
203 dst16[i+2] = lut16[src16[i+2]]; | |
204 dst16[i+3] = lut16[src16[i+3]]; | |
205 } | |
206 i <<= 1; | |
207 #else | |
208 w2= (w>>3)<<3; | |
209 for (j = 0; j < h; j++) { | |
210 for (i = 0; i < w2; i+=8) { | |
211 dst[i+0] = lut[src[i+0]]; | |
212 dst[i+1] = lut[src[i+1]]; | |
213 dst[i+2] = lut[src[i+2]]; | |
214 dst[i+3] = lut[src[i+3]]; | |
215 dst[i+4] = lut[src[i+4]]; | |
216 dst[i+5] = lut[src[i+5]]; | |
217 dst[i+6] = lut[src[i+6]]; | |
218 dst[i+7] = lut[src[i+7]]; | |
219 } | |
220 #endif | |
221 for (; i < w; i++) { | |
8349
916d5392dcc9
- It fixes a small bug where a byte value is divided by 255.0 to convert
arpi
parents:
8087
diff
changeset
|
222 dst[i] = lut[src[i]]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
223 } |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
224 |
8349
916d5392dcc9
- It fixes a small bug where a byte value is divided by 255.0 to convert
arpi
parents:
8087
diff
changeset
|
225 src += sstride; |
916d5392dcc9
- It fixes a small bug where a byte value is divided by 255.0 to convert
arpi
parents:
8087
diff
changeset
|
226 dst += dstride; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
227 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
228 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
229 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
230 static |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
231 int put_image (vf_instance_t *vf, mp_image_t *src) |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
232 { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
233 unsigned i; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
234 vf_eq2_t *eq2; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
235 mp_image_t *dst; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
236 unsigned long img_n,img_c; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
237 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
238 eq2 = vf->priv; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
239 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
240 if ((eq2->buf_w[0] != src->w) || (eq2->buf_h[0] != src->h)) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
241 eq2->buf_w[0] = src->w; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
242 eq2->buf_h[0] = src->h; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
243 eq2->buf_w[1] = eq2->buf_w[2] = src->w >> src->chroma_x_shift; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
244 eq2->buf_h[1] = eq2->buf_h[2] = src->h >> src->chroma_y_shift; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
245 img_n = eq2->buf_w[0]*eq2->buf_h[0]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
246 if(src->num_planes>1){ |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
247 img_c = eq2->buf_w[1]*eq2->buf_h[1]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
248 eq2->buf[0] = (unsigned char *) realloc (eq2->buf[0], img_n + 2*img_c); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
249 eq2->buf[1] = eq2->buf[0] + img_n; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
250 eq2->buf[2] = eq2->buf[1] + img_c; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
251 } else |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
252 eq2->buf[0] = (unsigned char *) realloc (eq2->buf[0], img_n); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
253 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
254 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
255 dst = vf_get_image (vf->next, src->imgfmt, MP_IMGTYPE_EXPORT, 0, src->w, src->h); |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
256 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
257 for (i = 0; i < ((src->num_planes>1)?3:1); i++) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
258 if (eq2->param[i].adjust != NULL) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
259 dst->planes[i] = eq2->buf[i]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
260 dst->stride[i] = eq2->buf_w[i]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
261 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
262 eq2->param[i].adjust (&eq2->param[i], dst->planes[i], src->planes[i], |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
263 eq2->buf_w[i], eq2->buf_h[i], dst->stride[i], src->stride[i]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
264 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
265 else { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
266 dst->planes[i] = src->planes[i]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
267 dst->stride[i] = src->stride[i]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
268 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
269 } |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
270 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
271 return vf_next_put_image (vf, dst); |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
272 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
273 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
274 static |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
275 void check_values (eq2_param_t *par) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
276 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
277 /* yuck! floating point comparisons... */ |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
278 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
279 if ((par->c == 1.0) && (par->b == 0.0) && (par->g == 1.0)) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
280 par->adjust = NULL; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
281 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
282 #ifdef HAVE_MMX |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
283 else if (par->g == 1.0 && gCpuCaps.hasMMX) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
284 par->adjust = &affine_1d_MMX; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
285 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
286 #endif |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
287 else { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
288 par->adjust = &apply_lut; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
289 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
290 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
291 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
292 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
293 void print_values (vf_eq2_t *eq2) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
294 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
295 mp_msg (MSGT_VFILTER, MSGL_V, "vf_eq2: c=%.2f b=%.2f g=%.4f s=%.2f \n", |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
296 eq2->contrast, eq2->brightness, eq2->gamma, eq2->saturation |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
297 ); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
298 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
299 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
300 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
301 void set_contrast (vf_eq2_t *eq2, double c) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
302 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
303 eq2->contrast = c; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
304 eq2->param[0].c = c; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
305 eq2->param[0].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
306 check_values (&eq2->param[0]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
307 print_values (eq2); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
308 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
309 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
310 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
311 void set_brightness (vf_eq2_t *eq2, double b) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
312 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
313 eq2->brightness = b; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
314 eq2->param[0].b = b; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
315 eq2->param[0].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
316 check_values (&eq2->param[0]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
317 print_values (eq2); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
318 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
319 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
320 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
321 void set_gamma (vf_eq2_t *eq2, double g) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
322 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
323 eq2->gamma = g; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
324 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
325 eq2->param[0].g = eq2->gamma * eq2->ggamma; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
326 eq2->param[1].g = sqrt (eq2->bgamma / eq2->ggamma); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
327 eq2->param[2].g = sqrt (eq2->rgamma / eq2->ggamma); |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
328 eq2->param[0].w = eq2->param[1].w = eq2->param[2].w = eq2->gamma_weight; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
329 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
330 eq2->param[0].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
331 eq2->param[1].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
332 eq2->param[2].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
333 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
334 check_values (&eq2->param[0]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
335 check_values (&eq2->param[1]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
336 check_values (&eq2->param[2]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
337 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
338 print_values (eq2); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
339 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
340 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
341 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
342 void set_saturation (vf_eq2_t *eq2, double s) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
343 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
344 eq2->saturation = s; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
345 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
346 eq2->param[1].c = s; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
347 eq2->param[2].c = s; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
348 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
349 eq2->param[1].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
350 eq2->param[2].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
351 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
352 check_values (&eq2->param[1]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
353 check_values (&eq2->param[2]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
354 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
355 print_values (eq2); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
356 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
357 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
358 static |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
359 int control (vf_instance_t *vf, int request, void *data) |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
360 { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
361 vf_equalizer_t *eq; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
362 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
363 switch (request) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
364 case VFCTRL_SET_EQUALIZER: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
365 eq = (vf_equalizer_t *) data; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
366 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
367 if (strcmp (eq->item, "gamma") == 0) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
368 set_gamma (vf->priv, exp (log (8.0) * eq->value / 100.0)); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
369 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
370 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
371 else if (strcmp (eq->item, "contrast") == 0) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
372 set_contrast (vf->priv, (1.0 / 100.0) * (eq->value + 100)); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
373 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
374 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
375 else if (strcmp (eq->item, "brightness") == 0) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
376 set_brightness (vf->priv, (1.0 / 100.0) * eq->value); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
377 return CONTROL_TRUE; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
378 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
379 else if (strcmp (eq->item, "saturation") == 0) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
380 set_saturation (vf->priv, (double) (eq->value + 100) / 100.0); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
381 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
382 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
383 break; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
384 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
385 case VFCTRL_GET_EQUALIZER: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
386 eq = (vf_equalizer_t *) data; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
387 if (strcmp (eq->item, "gamma") == 0) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
388 eq->value = (int) (100.0 * log (vf->priv->gamma) / log (8.0)); |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
389 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
390 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
391 else if (strcmp (eq->item, "contrast") == 0) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
392 eq->value = (int) (100.0 * vf->priv->contrast) - 100; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
393 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
394 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
395 else if (strcmp (eq->item, "brightness") == 0) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
396 eq->value = (int) (100.0 * vf->priv->brightness); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
397 return CONTROL_TRUE; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
398 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
399 else if (strcmp (eq->item, "saturation") == 0) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
400 eq->value = (int) (100.0 * vf->priv->saturation) - 100; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
401 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
402 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
403 break; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
404 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
405 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
406 return vf_next_control (vf, request, data); |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
407 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
408 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
409 static |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
410 int query_format (vf_instance_t *vf, unsigned fmt) |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
411 { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
412 switch (fmt) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
413 case IMGFMT_YVU9: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
414 case IMGFMT_IF09: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
415 case IMGFMT_YV12: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
416 case IMGFMT_I420: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
417 case IMGFMT_IYUV: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
418 case IMGFMT_Y800: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
419 case IMGFMT_Y8: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
420 case IMGFMT_444P: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
421 case IMGFMT_422P: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
422 case IMGFMT_411P: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
423 return vf_next_query_format (vf, fmt); |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
424 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
425 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
426 return 0; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
427 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
428 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
429 static |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
430 void uninit (vf_instance_t *vf) |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
431 { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
432 if (vf->priv != NULL) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
433 free (vf->priv->buf[0]); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
434 free (vf->priv); |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
435 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
436 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
437 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
438 static |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
439 int open (vf_instance_t *vf, char *args) |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
440 { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
441 unsigned i; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
442 vf_eq2_t *eq2; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
443 double par[8]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
444 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
445 vf->control = control; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
446 vf->query_format = query_format; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
447 vf->put_image = put_image; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
448 vf->uninit = uninit; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
449 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
450 vf->priv = (vf_eq2_t *) malloc (sizeof (vf_eq2_t)); |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
451 eq2 = vf->priv; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
452 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
453 for (i = 0; i < 3; i++) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
454 eq2->buf[i] = NULL; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
455 eq2->buf_w[i] = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
456 eq2->buf_h[i] = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
457 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
458 eq2->param[i].adjust = NULL; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
459 eq2->param[i].c = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
460 eq2->param[i].b = 0.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
461 eq2->param[i].g = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
462 eq2->param[i].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
463 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
464 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
465 eq2->contrast = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
466 eq2->brightness = 0.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
467 eq2->saturation = 1.0; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
468 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
469 eq2->gamma = 1.0; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
470 eq2->gamma_weight = 1.0; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
471 eq2->rgamma = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
472 eq2->ggamma = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
473 eq2->bgamma = 1.0; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
474 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
475 if (args != NULL) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
476 par[0] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
477 par[1] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
478 par[2] = 0.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
479 par[3] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
480 par[4] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
481 par[5] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
482 par[6] = 1.0; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
483 par[7] = 1.0; |
8087 | 484 #ifdef USE_SETLOCALE |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
485 setlocale (LC_NUMERIC, "C"); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
486 #endif |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
487 sscanf (args, "%lf:%lf:%lf:%lf:%lf:%lf:%lf:%lf", |
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
488 par, par + 1, par + 2, par + 3, par + 4, par + 5, par + 6, par + 7 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
489 ); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
490 #ifdef USE_SETLOCALE |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
491 setlocale (LC_NUMERIC, ""); |
8087 | 492 #endif |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
493 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
494 eq2->rgamma = par[4]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
495 eq2->ggamma = par[5]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
496 eq2->bgamma = par[6]; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
497 eq2->gamma_weight = par[7]; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
498 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
499 set_gamma (eq2, par[0]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
500 set_contrast (eq2, par[1]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
501 set_brightness (eq2, par[2]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
502 set_saturation (eq2, par[3]); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
503 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
504 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
505 return 1; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
506 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
507 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
508 vf_info_t vf_info_eq2 = { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
509 "Software equalizer", |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
510 "eq2", |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
511 "Hampa Hug, Daniel Moreno, Richard Felker", |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
512 "", |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9213
diff
changeset
|
513 &open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9213
diff
changeset
|
514 NULL |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
515 }; |