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