Mercurial > mplayer.hg
annotate libmpcodecs/vf_eq2.c @ 32254:70cdc0575aff
Drop obsolete CONFIG_IPV6 #definition for FFmpeg from config.h.
author | diego |
---|---|
date | Tue, 21 Sep 2010 14:16:57 +0000 |
parents | 9fc9d1e788aa |
children |
rev | line source |
---|---|
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
1 /* |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
2 * Software equalizer (brightness, contrast, gamma, saturation) |
7517
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 * 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
|
5 * 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
|
6 * Richard Felker (original MMX contrast/brightness code (vf_eq.c)) |
11166 | 7 * Michael Niedermayer <michalni@gmx.at> (LUT16) |
30514
f43b6757e3f8
Remove stray '/' from comment block, fixes the warning:
diego
parents:
30421
diff
changeset
|
8 * |
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
19 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
20 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
21 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
22 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
24 */ |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
25 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
26 #include <stdio.h> |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
27 #include <stdlib.h> |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
28 #include <string.h> |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
29 #include <math.h> |
11166 | 30 #include <inttypes.h> |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
31 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
32 #include "config.h" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
33 #include "mp_msg.h" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
34 #include "cpudetect.h" |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
35 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
36 #include "img_format.h" |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
37 #include "mp_image.h" |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
38 #include "vf.h" |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
39 |
11166 | 40 #define LUT16 |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
41 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
42 /* Per channel parameters */ |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
43 typedef struct eq2_param_t { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
44 unsigned char lut[256]; |
11166 | 45 #ifdef LUT16 |
46 uint16_t lut16[256*256]; | |
47 #endif | |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
48 int lut_clean; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
49 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
50 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
|
51 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
|
52 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
53 double c; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
54 double b; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
55 double g; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
56 double w; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
57 } eq2_param_t; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
58 |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
59 typedef struct vf_priv_s { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
60 eq2_param_t param[3]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
61 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
62 double contrast; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
63 double brightness; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
64 double saturation; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
65 |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
66 double gamma; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
67 double gamma_weight; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
68 double rgamma; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
69 double ggamma; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
70 double bgamma; |
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 unsigned buf_w[3]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
73 unsigned buf_h[3]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
74 unsigned char *buf[3]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
75 } vf_eq2_t; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
76 |
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 static |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
79 void create_lut (eq2_param_t *par) |
7517
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 unsigned i; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
82 double g, v; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
83 double lw, gw; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
84 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
85 g = par->g; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
86 gw = par->w; |
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
87 lw = 1.0 - gw; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
88 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
89 if ((g < 0.001) || (g > 1000.0)) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
90 g = 1.0; |
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 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
93 g = 1.0 / g; |
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 for (i = 0; i < 256; i++) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
96 v = (double) i / 255.0; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
97 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
|
98 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
99 if (v <= 0.0) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
100 par->lut[i] = 0; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
101 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
102 else { |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
103 v = v*lw + pow(v, g)*gw; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
104 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
105 if (v >= 1.0) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
106 par->lut[i] = 255; |
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 else { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
109 par->lut[i] = (unsigned char) (256.0 * v); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
110 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
111 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
112 } |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
113 |
11166 | 114 #ifdef LUT16 |
115 for(i=0; i<256*256; i++){ | |
116 par->lut16[i]= par->lut[i&0xFF] + (par->lut[i>>8]<<8); | |
117 } | |
118 #endif | |
119 | |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
120 par->lut_clean = 1; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
121 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
122 |
28290 | 123 #if HAVE_MMX |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
124 static |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
125 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
|
126 unsigned w, unsigned h, unsigned dstride, unsigned sstride) |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
127 { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
128 unsigned i; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
129 int contrast, brightness; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
130 unsigned dstep, sstep; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
131 int pel; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
132 short brvec[4]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
133 short contvec[4]; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28290
diff
changeset
|
134 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
135 // 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
|
136 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
137 contrast = (int) (par->c * 256 * 16); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
138 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
|
139 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
140 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
|
141 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
|
142 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
143 sstep = sstride - w; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
144 dstep = dstride - w; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
145 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
146 while (h-- > 0) { |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
25221
diff
changeset
|
147 __asm__ volatile ( |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
148 "movq (%5), %%mm3 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
149 "movq (%6), %%mm4 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
150 "pxor %%mm0, %%mm0 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
151 "movl %4, %%eax\n\t" |
19372
6334c14b38eb
Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents:
18104
diff
changeset
|
152 ASMALIGN(4) |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
153 "1: \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
154 "movq (%0), %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
155 "movq (%0), %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
156 "punpcklbw %%mm0, %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
157 "punpckhbw %%mm0, %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
158 "psllw $4, %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
159 "psllw $4, %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
160 "pmulhw %%mm4, %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
161 "pmulhw %%mm4, %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
162 "paddw %%mm3, %%mm1 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
163 "paddw %%mm3, %%mm2 \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
164 "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
|
165 "add $8, %0 \n\t" |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
166 "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
|
167 "add $8, %1 \n\t" |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
168 "decl %%eax \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
169 "jnz 1b \n\t" |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
170 : "=r" (src), "=r" (dst) |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
171 : "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
|
172 : "%eax" |
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 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
175 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
|
176 pel = ((*src++ * contrast) >> 12) + brightness; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
177 if (pel & 768) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
178 pel = (-pel) >> 31; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
179 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
180 *dst++ = pel; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
181 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
182 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
183 src += sstep; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
184 dst += dstep; |
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 |
27754
08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
diego
parents:
25221
diff
changeset
|
187 __asm__ volatile ( "emms \n\t" ::: "memory" ); |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
188 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
189 #endif |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
190 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
191 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
192 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
|
193 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
|
194 { |
11166 | 195 unsigned i, j, w2; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
196 unsigned char *lut; |
11166 | 197 uint16_t *lut16; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
198 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
199 if (!par->lut_clean) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
200 create_lut (par); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
201 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
202 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
203 lut = par->lut; |
11166 | 204 #ifdef LUT16 |
205 lut16 = par->lut16; | |
206 w2= (w>>3)<<2; | |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
207 for (j = 0; j < h; j++) { |
11166 | 208 uint16_t *src16= (uint16_t*)src; |
209 uint16_t *dst16= (uint16_t*)dst; | |
210 for (i = 0; i < w2; i+=4) { | |
211 dst16[i+0] = lut16[src16[i+0]]; | |
212 dst16[i+1] = lut16[src16[i+1]]; | |
213 dst16[i+2] = lut16[src16[i+2]]; | |
214 dst16[i+3] = lut16[src16[i+3]]; | |
215 } | |
216 i <<= 1; | |
217 #else | |
218 w2= (w>>3)<<3; | |
219 for (j = 0; j < h; j++) { | |
220 for (i = 0; i < w2; i+=8) { | |
221 dst[i+0] = lut[src[i+0]]; | |
222 dst[i+1] = lut[src[i+1]]; | |
223 dst[i+2] = lut[src[i+2]]; | |
224 dst[i+3] = lut[src[i+3]]; | |
225 dst[i+4] = lut[src[i+4]]; | |
226 dst[i+5] = lut[src[i+5]]; | |
227 dst[i+6] = lut[src[i+6]]; | |
228 dst[i+7] = lut[src[i+7]]; | |
229 } | |
230 #endif | |
231 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
|
232 dst[i] = lut[src[i]]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
233 } |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
234 |
8349
916d5392dcc9
- It fixes a small bug where a byte value is divided by 255.0 to convert
arpi
parents:
8087
diff
changeset
|
235 src += sstride; |
916d5392dcc9
- It fixes a small bug where a byte value is divided by 255.0 to convert
arpi
parents:
8087
diff
changeset
|
236 dst += dstride; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
237 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
238 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
239 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
240 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
|
241 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
|
242 { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
243 unsigned i; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
244 vf_eq2_t *eq2; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
245 mp_image_t *dst; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
246 unsigned long img_n,img_c; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
247 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
248 eq2 = vf->priv; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
249 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
250 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
|
251 eq2->buf_w[0] = src->w; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
252 eq2->buf_h[0] = src->h; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
253 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
|
254 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
|
255 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
|
256 if(src->num_planes>1){ |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
257 img_c = eq2->buf_w[1]*eq2->buf_h[1]; |
30702 | 258 eq2->buf[0] = realloc (eq2->buf[0], img_n + 2*img_c); |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
259 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
|
260 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
|
261 } else |
30702 | 262 eq2->buf[0] = realloc (eq2->buf[0], img_n); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
263 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
264 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
265 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
|
266 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
267 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
|
268 if (eq2->param[i].adjust != NULL) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
269 dst->planes[i] = eq2->buf[i]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
270 dst->stride[i] = eq2->buf_w[i]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
271 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
272 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
|
273 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
|
274 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
275 else { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
276 dst->planes[i] = src->planes[i]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
277 dst->stride[i] = src->stride[i]; |
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 } |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
280 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
14542
diff
changeset
|
281 return vf_next_put_image (vf, dst, pts); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
282 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
283 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
284 static |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
285 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
|
286 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
287 /* yuck! floating point comparisons... */ |
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 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
|
290 par->adjust = NULL; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
291 } |
28290 | 292 #if HAVE_MMX |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
293 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
|
294 par->adjust = &affine_1d_MMX; |
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 #endif |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
297 else { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
298 par->adjust = &apply_lut; |
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 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
301 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
302 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
303 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
|
304 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
305 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
|
306 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
|
307 ); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
308 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
309 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
310 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
311 void set_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
|
312 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
313 eq2->contrast = c; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
314 eq2->param[0].c = c; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
315 eq2->param[0].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
316 check_values (&eq2->param[0]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
317 print_values (eq2); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
318 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
319 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
320 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
321 void set_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
|
322 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
323 eq2->brightness = b; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
324 eq2->param[0].b = b; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
325 eq2->param[0].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
326 check_values (&eq2->param[0]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
327 print_values (eq2); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
328 } |
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 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
331 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
|
332 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
333 eq2->gamma = g; |
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 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
|
336 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
|
337 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
|
338 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
|
339 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
340 eq2->param[0].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
341 eq2->param[1].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
342 eq2->param[2].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
343 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
344 check_values (&eq2->param[0]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
345 check_values (&eq2->param[1]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
346 check_values (&eq2->param[2]); |
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 print_values (eq2); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
349 } |
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 static |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
352 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
|
353 { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
354 eq2->saturation = s; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
355 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
356 eq2->param[1].c = s; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
357 eq2->param[2].c = s; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
358 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
359 eq2->param[1].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
360 eq2->param[2].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
361 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
362 check_values (&eq2->param[1]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
363 check_values (&eq2->param[2]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
364 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
365 print_values (eq2); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
366 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
367 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
368 static |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
369 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
|
370 { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
371 vf_equalizer_t *eq; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
372 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
373 switch (request) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
374 case VFCTRL_SET_EQUALIZER: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
375 eq = (vf_equalizer_t *) data; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
376 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
377 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
|
378 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
|
379 return CONTROL_TRUE; |
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 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
|
382 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
|
383 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
384 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
385 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
|
386 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
|
387 return CONTROL_TRUE; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
388 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
389 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
|
390 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
|
391 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
392 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
393 break; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
394 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
395 case VFCTRL_GET_EQUALIZER: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
396 eq = (vf_equalizer_t *) data; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
397 if (strcmp (eq->item, "gamma") == 0) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
398 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
|
399 return CONTROL_TRUE; |
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 else if (strcmp (eq->item, "contrast") == 0) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
402 eq->value = (int) (100.0 * vf->priv->contrast) - 100; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
403 return CONTROL_TRUE; |
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 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
|
406 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
|
407 return CONTROL_TRUE; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
408 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
409 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
|
410 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
|
411 return CONTROL_TRUE; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
412 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
413 break; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
414 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
415 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
416 return vf_next_control (vf, request, data); |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
417 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
418 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
419 static |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
420 int query_format (vf_instance_t *vf, unsigned 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 switch (fmt) { |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
423 case IMGFMT_YVU9: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
424 case IMGFMT_IF09: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
425 case IMGFMT_YV12: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
426 case IMGFMT_I420: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
427 case IMGFMT_IYUV: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
428 case IMGFMT_Y800: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
429 case IMGFMT_Y8: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
430 case IMGFMT_444P: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
431 case IMGFMT_422P: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
432 case IMGFMT_411P: |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
433 return vf_next_query_format (vf, fmt); |
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 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
436 return 0; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
437 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
438 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
439 static |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
440 void uninit (vf_instance_t *vf) |
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 if (vf->priv != NULL) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
443 free (vf->priv->buf[0]); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
444 free (vf->priv); |
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 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
447 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
448 static |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30514
diff
changeset
|
449 int vf_open(vf_instance_t *vf, char *args) |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
450 { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
451 unsigned i; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
452 vf_eq2_t *eq2; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
453 double par[8]; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
454 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
455 vf->control = control; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
456 vf->query_format = query_format; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
457 vf->put_image = put_image; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
458 vf->uninit = uninit; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
459 |
30702 | 460 vf->priv = malloc (sizeof (vf_eq2_t)); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
461 eq2 = vf->priv; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
462 |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
463 for (i = 0; i < 3; i++) { |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
464 eq2->buf[i] = NULL; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
465 eq2->buf_w[i] = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
466 eq2->buf_h[i] = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
467 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
468 eq2->param[i].adjust = NULL; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
469 eq2->param[i].c = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
470 eq2->param[i].b = 0.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
471 eq2->param[i].g = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
472 eq2->param[i].lut_clean = 0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
473 } |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
474 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
475 eq2->contrast = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
476 eq2->brightness = 0.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
477 eq2->saturation = 1.0; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
478 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
479 eq2->gamma = 1.0; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
480 eq2->gamma_weight = 1.0; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
481 eq2->rgamma = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
482 eq2->ggamma = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
483 eq2->bgamma = 1.0; |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
484 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
485 if (args != NULL) { |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
486 par[0] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
487 par[1] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
488 par[2] = 0.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
489 par[3] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
490 par[4] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
491 par[5] = 1.0; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
492 par[6] = 1.0; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
493 par[7] = 1.0; |
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
494 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
|
495 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
|
496 ); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
497 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
498 eq2->rgamma = par[4]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
499 eq2->ggamma = par[5]; |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
500 eq2->bgamma = par[6]; |
11169
9a100ec9135f
gamma weight patch by (Alexander Stege <mplayer at legale-software dot com>)
michael
parents:
11166
diff
changeset
|
501 eq2->gamma_weight = par[7]; |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
502 |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
503 set_gamma (eq2, par[0]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
504 set_contrast (eq2, par[1]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
505 set_brightness (eq2, par[2]); |
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
506 set_saturation (eq2, par[3]); |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
507 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
508 |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
509 return 1; |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
510 } |
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
511 |
25221 | 512 const 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
|
513 "Software equalizer", |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
514 "eq2", |
9213
601ed700e1cc
Based on the discussion in the other thread I made a new
arpi
parents:
8349
diff
changeset
|
515 "Hampa Hug, Daniel Moreno, Richard Felker", |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
516 "", |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30514
diff
changeset
|
517 &vf_open, |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9213
diff
changeset
|
518 NULL |
7517
9d433771b6d0
-vf eq2, LUT-based brightness/contrast/gamma correction (Y-only)
arpi
parents:
diff
changeset
|
519 }; |