1 /*****************************************************************************
2 * adjust.c : Contrast/Hue/Saturation/Brightness video plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2006 VLC authors and VideoLAN
5 * $Id: fc12d666402bafcaa9ea1ac13d6696ddc578953a $
6 *
7 * Authors: Simon Latapie <garf@via.ecp.fr>
8 * Antoine Cellerier <dionoea -at- videolan d0t org>
9 * Martin Briza <gamajun@seznam.cz> (SSE)
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
25
26 /*****************************************************************************
27 * Preamble
28 *****************************************************************************/
29
30 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
33
34 #include <math.h>
35
36 #include <vlc_common.h>
37 #include <vlc_atomic.h>
38 #include <vlc_plugin.h>
39 #include <vlc_filter.h>
40 #include <vlc_picture.h>
41 #include "filter_picture.h"
42
43 #include "adjust_sat_hue.h"
44
45 /*****************************************************************************
46 * Local prototypes
47 *****************************************************************************/
48 static int Create ( vlc_object_t * );
49 static void Destroy ( vlc_object_t * );
50
51 static picture_t *FilterPlanar( filter_t *, picture_t * );
52 static picture_t *FilterPacked( filter_t *, picture_t * );
53 static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
54 vlc_value_t oldval, vlc_value_t newval,
55 void *p_data );
56
57 /*****************************************************************************
58 * Module descriptor
59 *****************************************************************************/
60
61 #define THRES_TEXT N_("Brightness threshold")
62 #define THRES_LONGTEXT N_("When this mode is enabled, pixels will be " \
63 "shown as black or white. The threshold value will be the brightness " \
64 "defined below." )
65 #define CONT_TEXT N_("Image contrast (0-2)")
66 #define CONT_LONGTEXT N_("Set the image contrast, between 0 and 2. Defaults to 1.")
67 #define HUE_TEXT N_("Image hue (-180..180)")
68 #define HUE_LONGTEXT N_("Set the image hue, between -180 and 180. Defaults to 0.")
69 #define SAT_TEXT N_("Image saturation (0-3)")
70 #define SAT_LONGTEXT N_("Set the image saturation, between 0 and 3. Defaults to 1.")
71 #define LUM_TEXT N_("Image brightness (0-2)")
72 #define LUM_LONGTEXT N_("Set the image brightness, between 0 and 2. Defaults to 1.")
73 #define GAMMA_TEXT N_("Image gamma (0-10)")
74 #define GAMMA_LONGTEXT N_("Set the image gamma, between 0.01 and 10. Defaults to 1.")
75
76 vlc_module_begin ()
77 set_description( N_("Image properties filter") )
78 set_shortname( N_("Image adjust" ))
79 set_category( CAT_VIDEO )
80 set_subcategory( SUBCAT_VIDEO_VFILTER )
81 set_capability( "video filter", 0 )
82
83 add_float_with_range( "contrast", 1.0, 0.0, 2.0,
84 CONT_TEXT, CONT_LONGTEXT, false )
85 change_safe()
86 add_float_with_range( "brightness", 1.0, 0.0, 2.0,
87 LUM_TEXT, LUM_LONGTEXT, false )
88 change_safe()
89 add_float_with_range( "hue", 0, -180., +180.,
90 HUE_TEXT, HUE_LONGTEXT, false )
91 change_safe()
92 add_float_with_range( "saturation", 1.0, 0.0, 3.0,
93 SAT_TEXT, SAT_LONGTEXT, false )
94 change_safe()
95 add_float_with_range( "gamma", 1.0, 0.01, 10.0,
96 GAMMA_TEXT, GAMMA_LONGTEXT, false )
97 change_safe()
98 add_bool( "brightness-threshold", false,
99 THRES_TEXT, THRES_LONGTEXT, false )
100 change_safe()
101
102 add_shortcut( "adjust" )
103 set_callbacks( Create, Destroy )
104 vlc_module_end ()
105
106 static const char *const ppsz_filter_options[] = {
107 "contrast", "brightness", "hue", "saturation", "gamma",
108 "brightness-threshold", NULL
109 };
110
111 /*****************************************************************************
112 * filter_sys_t: adjust filter method descriptor
113 *****************************************************************************/
114 struct filter_sys_t
115 {
116 vlc_atomic_float f_contrast;
117 vlc_atomic_float f_brightness;
118 vlc_atomic_float f_hue;
119 vlc_atomic_float f_saturation;
120 vlc_atomic_float f_gamma;
121 atomic_bool b_brightness_threshold;
122 int (*pf_process_sat_hue)( picture_t *, picture_t *, int, int, int,
123 int, int );
124 int (*pf_process_sat_hue_clip)( picture_t *, picture_t *, int, int,
125 int, int, int );
126 };
127
128 /*****************************************************************************
129 * Create: allocates adjust video filter
130 *****************************************************************************/
Create(vlc_object_t * p_this)131 static int Create( vlc_object_t *p_this )
132 {
133 filter_t *p_filter = (filter_t *)p_this;
134 filter_sys_t *p_sys;
135
136 if( p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma )
137 {
138 msg_Err( p_filter, "Input and output chromas don't match" );
139 return VLC_EGENERIC;
140 }
141
142 /* Allocate structure */
143 p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
144 if( p_filter->p_sys == NULL )
145 return VLC_ENOMEM;
146 p_sys = p_filter->p_sys;
147
148 /* Choose Planar/Packed function and pointer to a Hue/Saturation processing
149 * function*/
150 switch( p_filter->fmt_in.video.i_chroma )
151 {
152 CASE_PLANAR_YUV
153 /* Planar YUV */
154 p_filter->pf_video_filter = FilterPlanar;
155 p_sys->pf_process_sat_hue_clip = planar_sat_hue_clip_C;
156 p_sys->pf_process_sat_hue = planar_sat_hue_C;
157 break;
158
159 CASE_PLANAR_YUV10
160 CASE_PLANAR_YUV9
161 /* Planar YUV 9-bit or 10-bit */
162 p_filter->pf_video_filter = FilterPlanar;
163 p_sys->pf_process_sat_hue_clip = planar_sat_hue_clip_C_16;
164 p_sys->pf_process_sat_hue = planar_sat_hue_C_16;
165 break;
166
167 CASE_PACKED_YUV_422
168 /* Packed YUV 4:2:2 */
169 p_filter->pf_video_filter = FilterPacked;
170 p_sys->pf_process_sat_hue_clip = packed_sat_hue_clip_C;
171 p_sys->pf_process_sat_hue = packed_sat_hue_C;
172 break;
173
174 default:
175 msg_Dbg( p_filter, "Unsupported input chroma (%4.4s)",
176 (char*)&(p_filter->fmt_in.video.i_chroma) );
177 free(p_sys);
178 return VLC_EGENERIC;
179 }
180
181 /* needed to get options passed in transcode using the
182 * adjust{name=value} syntax */
183 config_ChainParse( p_filter, "", ppsz_filter_options, p_filter->p_cfg );
184
185 vlc_atomic_init_float( &p_sys->f_contrast,
186 var_CreateGetFloatCommand( p_filter, "contrast" ) );
187 vlc_atomic_init_float( &p_sys->f_brightness,
188 var_CreateGetFloatCommand( p_filter, "brightness" ) );
189 vlc_atomic_init_float( &p_sys->f_hue,
190 var_CreateGetFloatCommand( p_filter, "hue" ) );
191 vlc_atomic_init_float( &p_sys->f_saturation,
192 var_CreateGetFloatCommand( p_filter, "saturation" ) );
193 vlc_atomic_init_float( &p_sys->f_gamma,
194 var_CreateGetFloatCommand( p_filter, "gamma" ) );
195 atomic_init( &p_sys->b_brightness_threshold,
196 var_CreateGetBoolCommand( p_filter, "brightness-threshold" ) );
197
198 var_AddCallback( p_filter, "contrast", AdjustCallback, p_sys );
199 var_AddCallback( p_filter, "brightness", AdjustCallback, p_sys );
200 var_AddCallback( p_filter, "hue", AdjustCallback, p_sys );
201 var_AddCallback( p_filter, "saturation", AdjustCallback, p_sys );
202 var_AddCallback( p_filter, "gamma", AdjustCallback, p_sys );
203 var_AddCallback( p_filter, "brightness-threshold",
204 AdjustCallback, p_sys );
205
206 return VLC_SUCCESS;
207 }
208
209 /*****************************************************************************
210 * Destroy: destroy adjust video filter
211 *****************************************************************************/
Destroy(vlc_object_t * p_this)212 static void Destroy( vlc_object_t *p_this )
213 {
214 filter_t *p_filter = (filter_t *)p_this;
215 filter_sys_t *p_sys = p_filter->p_sys;
216
217 var_DelCallback( p_filter, "contrast", AdjustCallback, p_sys );
218 var_DelCallback( p_filter, "brightness", AdjustCallback, p_sys );
219 var_DelCallback( p_filter, "hue", AdjustCallback, p_sys );
220 var_DelCallback( p_filter, "saturation", AdjustCallback, p_sys );
221 var_DelCallback( p_filter, "gamma", AdjustCallback, p_sys );
222 var_DelCallback( p_filter, "brightness-threshold",
223 AdjustCallback, p_sys );
224
225 free( p_sys );
226 }
227
228 /*****************************************************************************
229 * Run the filter on a Planar YUV picture
230 *****************************************************************************/
FilterPlanar(filter_t * p_filter,picture_t * p_pic)231 static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
232 {
233 /* The full range will only be used for 10-bit */
234 int pi_luma[1024];
235 int pi_gamma[1024];
236
237 picture_t *p_outpic;
238
239 filter_sys_t *p_sys = p_filter->p_sys;
240
241 if( !p_pic ) return NULL;
242
243 p_outpic = filter_NewPicture( p_filter );
244 if( !p_outpic )
245 {
246 picture_Release( p_pic );
247 return NULL;
248 }
249
250 bool b_16bit;
251 float f_range;
252 switch( p_filter->fmt_in.video.i_chroma )
253 {
254 CASE_PLANAR_YUV10
255 b_16bit = true;
256 f_range = 1024.f;
257 break;
258 CASE_PLANAR_YUV9
259 b_16bit = true;
260 f_range = 512.f;
261 break;
262 default:
263 b_16bit = false;
264 f_range = 256.f;
265 }
266
267 const float f_max = f_range - 1.f;
268 const unsigned i_max = f_max;
269 const int i_range = f_range;
270 const unsigned i_size = i_range;
271 const unsigned i_mid = i_range >> 1;
272
273 /* Get variables */
274 int32_t i_cont = lroundf( vlc_atomic_load_float( &p_sys->f_contrast ) * f_max );
275 int32_t i_lum = lroundf( (vlc_atomic_load_float( &p_sys->f_brightness ) - 1.f) * f_max );
276 float f_hue = vlc_atomic_load_float( &p_sys->f_hue ) * (float)(M_PI / 180.);
277 int i_sat = (int)( vlc_atomic_load_float( &p_sys->f_saturation ) * f_range );
278 float f_gamma = 1.f / vlc_atomic_load_float( &p_sys->f_gamma );
279
280 /*
281 * Threshold mode drops out everything about luma, contrast and gamma.
282 */
283 if( !atomic_load( &p_sys->b_brightness_threshold ) )
284 {
285
286 /* Contrast is a fast but kludged function, so I put this gap to be
287 * cleaner :) */
288 i_lum += i_mid - i_cont / 2;
289
290 /* Fill the gamma lookup table */
291 for( unsigned i = 0 ; i < i_size; i++ )
292 {
293 pi_gamma[ i ] = VLC_CLIP( powf(i / f_max, f_gamma) * f_max, 0, i_max );
294 }
295
296 /* Fill the luma lookup table */
297 for( unsigned i = 0 ; i < i_size; i++ )
298 {
299 pi_luma[ i ] = pi_gamma[VLC_CLIP( (int)(i_lum + i_cont * i / i_range), 0, i_max )];
300 }
301 }
302 else
303 {
304 /*
305 * We get luma as threshold value: the higher it is, the darker is
306 * the image. Should I reverse this?
307 */
308 for( int i = 0 ; i < i_range; i++ )
309 {
310 pi_luma[ i ] = (i < i_lum) ? 0 : i_max;
311 }
312
313 /*
314 * Desaturates image to avoid that strange yellow halo...
315 */
316 i_sat = 0;
317 }
318
319 /*
320 * Do the Y plane
321 */
322 if ( b_16bit )
323 {
324 uint16_t *p_in, *p_in_end, *p_line_end;
325 uint16_t *p_out;
326 p_in = (uint16_t *) p_pic->p[Y_PLANE].p_pixels;
327 p_in_end = p_in + p_pic->p[Y_PLANE].i_visible_lines
328 * (p_pic->p[Y_PLANE].i_pitch >> 1) - 8;
329
330 p_out = (uint16_t *) p_outpic->p[Y_PLANE].p_pixels;
331
332 for( ; p_in < p_in_end ; )
333 {
334 p_line_end = p_in + (p_pic->p[Y_PLANE].i_visible_pitch >> 1) - 8;
335
336 for( ; p_in < p_line_end ; )
337 {
338 /* Do 8 pixels at a time */
339 *p_out++ = pi_luma[ *p_in++ ]; *p_out++ = pi_luma[ *p_in++ ];
340 *p_out++ = pi_luma[ *p_in++ ]; *p_out++ = pi_luma[ *p_in++ ];
341 *p_out++ = pi_luma[ *p_in++ ]; *p_out++ = pi_luma[ *p_in++ ];
342 *p_out++ = pi_luma[ *p_in++ ]; *p_out++ = pi_luma[ *p_in++ ];
343 }
344
345 p_line_end += 8;
346
347 for( ; p_in < p_line_end ; )
348 {
349 *p_out++ = pi_luma[ *p_in++ ];
350 }
351
352 p_in += (p_pic->p[Y_PLANE].i_pitch >> 1)
353 - (p_pic->p[Y_PLANE].i_visible_pitch >> 1);
354 p_out += (p_outpic->p[Y_PLANE].i_pitch >> 1)
355 - (p_outpic->p[Y_PLANE].i_visible_pitch >> 1);
356 }
357 }
358 else
359 {
360 uint8_t *p_in, *p_in_end, *p_line_end;
361 uint8_t *p_out;
362 p_in = p_pic->p[Y_PLANE].p_pixels;
363 p_in_end = p_in + p_pic->p[Y_PLANE].i_visible_lines
364 * p_pic->p[Y_PLANE].i_pitch - 8;
365
366 p_out = p_outpic->p[Y_PLANE].p_pixels;
367
368 for( ; p_in < p_in_end ; )
369 {
370 p_line_end = p_in + p_pic->p[Y_PLANE].i_visible_pitch - 8;
371
372 for( ; p_in < p_line_end ; )
373 {
374 /* Do 8 pixels at a time */
375 *p_out++ = pi_luma[ *p_in++ ]; *p_out++ = pi_luma[ *p_in++ ];
376 *p_out++ = pi_luma[ *p_in++ ]; *p_out++ = pi_luma[ *p_in++ ];
377 *p_out++ = pi_luma[ *p_in++ ]; *p_out++ = pi_luma[ *p_in++ ];
378 *p_out++ = pi_luma[ *p_in++ ]; *p_out++ = pi_luma[ *p_in++ ];
379 }
380
381 p_line_end += 8;
382
383 for( ; p_in < p_line_end ; )
384 {
385 *p_out++ = pi_luma[ *p_in++ ];
386 }
387
388 p_in += p_pic->p[Y_PLANE].i_pitch
389 - p_pic->p[Y_PLANE].i_visible_pitch;
390 p_out += p_outpic->p[Y_PLANE].i_pitch
391 - p_outpic->p[Y_PLANE].i_visible_pitch;
392 }
393 }
394
395 /*
396 * Do the U and V planes
397 */
398
399 int i_sin = sinf(f_hue) * f_max;
400 int i_cos = cosf(f_hue) * f_max;
401
402 /* pow(2, (bpp * 2) - 1) */
403 int i_x = ( cosf(f_hue) + sinf(f_hue) ) * f_range * i_mid;
404 int i_y = ( cosf(f_hue) - sinf(f_hue) ) * f_range * i_mid;
405
406 if ( i_sat > i_range )
407 {
408 /* Currently no errors are implemented in the function, if any are added
409 * check them here */
410 p_sys->pf_process_sat_hue_clip( p_pic, p_outpic, i_sin, i_cos, i_sat,
411 i_x, i_y );
412 }
413 else
414 {
415 /* Currently no errors are implemented in the function, if any are added
416 * check them here */
417 p_sys->pf_process_sat_hue( p_pic, p_outpic, i_sin, i_cos, i_sat,
418 i_x, i_y );
419 }
420
421 return CopyInfoAndRelease( p_outpic, p_pic );
422 }
423
424 /*****************************************************************************
425 * Run the filter on a Packed YUV picture
426 *****************************************************************************/
FilterPacked(filter_t * p_filter,picture_t * p_pic)427 static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
428 {
429 int pi_luma[256];
430 int pi_gamma[256];
431
432 picture_t *p_outpic;
433 uint8_t *p_in, *p_in_end, *p_line_end;
434 uint8_t *p_out;
435 int i_y_offset, i_u_offset, i_v_offset;
436
437 int i_pitch, i_visible_pitch;
438
439 double f_hue;
440 double f_gamma;
441 int32_t i_cont, i_lum;
442 int i_sat, i_sin, i_cos, i_x, i_y;
443
444 filter_sys_t *p_sys = p_filter->p_sys;
445
446 if( !p_pic ) return NULL;
447
448 i_pitch = p_pic->p->i_pitch;
449 i_visible_pitch = p_pic->p->i_visible_pitch;
450
451 if( GetPackedYuvOffsets( p_pic->format.i_chroma, &i_y_offset,
452 &i_u_offset, &i_v_offset ) != VLC_SUCCESS )
453 {
454 msg_Warn( p_filter, "Unsupported input chroma (%4.4s)",
455 (char*)&(p_pic->format.i_chroma) );
456
457 picture_Release( p_pic );
458 return NULL;
459 }
460
461 p_outpic = filter_NewPicture( p_filter );
462 if( !p_outpic )
463 {
464 msg_Warn( p_filter, "can't get output picture" );
465
466 picture_Release( p_pic );
467 return NULL;
468 }
469
470 /* Get variables */
471 i_cont = (int)( vlc_atomic_load_float( &p_sys->f_contrast ) * 255 );
472 i_lum = (int)( (vlc_atomic_load_float( &p_sys->f_brightness ) - 1.0)*255 );
473 f_hue = vlc_atomic_load_float( &p_sys->f_hue ) * (float)(M_PI / 180.);
474 i_sat = (int)( vlc_atomic_load_float( &p_sys->f_saturation ) * 256 );
475 f_gamma = 1.0 / vlc_atomic_load_float( &p_sys->f_gamma );
476
477 /*
478 * Threshold mode drops out everything about luma, contrast and gamma.
479 */
480 if( !atomic_load( &p_sys->b_brightness_threshold ) )
481 {
482
483 /* Contrast is a fast but kludged function, so I put this gap to be
484 * cleaner :) */
485 i_lum += 128 - i_cont / 2;
486
487 /* Fill the gamma lookup table */
488 for( int i = 0 ; i < 256 ; i++ )
489 {
490 pi_gamma[ i ] = clip_uint8_vlc( pow(i / 255.0, f_gamma) * 255.0);
491 }
492
493 /* Fill the luma lookup table */
494 for( int i = 0 ; i < 256 ; i++ )
495 {
496 pi_luma[ i ] = pi_gamma[clip_uint8_vlc( i_lum + i_cont * i / 256)];
497 }
498 }
499 else
500 {
501 /*
502 * We get luma as threshold value: the higher it is, the darker is
503 * the image. Should I reverse this?
504 */
505 for( int i = 0 ; i < 256 ; i++ )
506 {
507 pi_luma[ i ] = (i < i_lum) ? 0 : 255;
508 }
509
510 /*
511 * Desaturates image to avoid that strange yellow halo...
512 */
513 i_sat = 0;
514 }
515
516 /*
517 * Do the Y plane
518 */
519
520 p_in = p_pic->p->p_pixels + i_y_offset;
521 p_in_end = p_in + p_pic->p->i_visible_lines * p_pic->p->i_pitch - 8 * 4;
522
523 p_out = p_outpic->p->p_pixels + i_y_offset;
524
525 for( ; p_in < p_in_end ; )
526 {
527 p_line_end = p_in + i_visible_pitch - 8 * 4;
528
529 for( ; p_in < p_line_end ; )
530 {
531 /* Do 8 pixels at a time */
532 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
533 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
534 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
535 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
536 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
537 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
538 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
539 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
540 }
541
542 p_line_end += 8 * 4;
543
544 for( ; p_in < p_line_end ; )
545 {
546 *p_out = pi_luma[ *p_in ]; p_in += 2; p_out += 2;
547 }
548
549 p_in += i_pitch - p_pic->p->i_visible_pitch;
550 p_out += i_pitch - p_outpic->p->i_visible_pitch;
551 }
552
553 /*
554 * Do the U and V planes
555 */
556
557 i_sin = sin(f_hue) * 256;
558 i_cos = cos(f_hue) * 256;
559
560 i_x = ( cos(f_hue) + sin(f_hue) ) * 32768;
561 i_y = ( cos(f_hue) - sin(f_hue) ) * 32768;
562
563 if ( i_sat > 256 )
564 {
565 if ( p_sys->pf_process_sat_hue_clip( p_pic, p_outpic, i_sin, i_cos, i_sat,
566 i_x, i_y ) != VLC_SUCCESS )
567 {
568 /* Currently only one error can happen in the function, but if there
569 * will be more of them, this message must go away */
570 msg_Warn( p_filter, "Unsupported input chroma (%4.4s)",
571 (char*)&(p_pic->format.i_chroma) );
572 picture_Release( p_pic );
573 return NULL;
574 }
575 }
576 else
577 {
578 if ( p_sys->pf_process_sat_hue( p_pic, p_outpic, i_sin, i_cos, i_sat,
579 i_x, i_y ) != VLC_SUCCESS )
580 {
581 /* Currently only one error can happen in the function, but if there
582 * will be more of them, this message must go away */
583 msg_Warn( p_filter, "Unsupported input chroma (%4.4s)",
584 (char*)&(p_pic->format.i_chroma) );
585 picture_Release( p_pic );
586 return NULL;
587 }
588 }
589
590 return CopyInfoAndRelease( p_outpic, p_pic );
591 }
592
AdjustCallback(vlc_object_t * p_this,char const * psz_var,vlc_value_t oldval,vlc_value_t newval,void * p_data)593 static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
594 vlc_value_t oldval, vlc_value_t newval,
595 void *p_data )
596 {
597 VLC_UNUSED(p_this); VLC_UNUSED(oldval);
598 filter_sys_t *p_sys = (filter_sys_t *)p_data;
599
600 if( !strcmp( psz_var, "contrast" ) )
601 vlc_atomic_store_float( &p_sys->f_contrast, newval.f_float );
602 else if( !strcmp( psz_var, "brightness" ) )
603 vlc_atomic_store_float( &p_sys->f_brightness, newval.f_float );
604 else if( !strcmp( psz_var, "hue" ) )
605 vlc_atomic_store_float( &p_sys->f_hue, newval.f_float );
606 else if( !strcmp( psz_var, "saturation" ) )
607 vlc_atomic_store_float( &p_sys->f_saturation, newval.f_float );
608 else if( !strcmp( psz_var, "gamma" ) )
609 vlc_atomic_store_float( &p_sys->f_gamma, newval.f_float );
610 else if( !strcmp( psz_var, "brightness-threshold" ) )
611 atomic_store( &p_sys->b_brightness_threshold, newval.b_bool );
612
613 return VLC_SUCCESS;
614 }
615