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