[vlc-devel] [PATCH 1/2] Split adjust filter in two source files
Martin Briza
Gamajun at seznam.cz
Fri Aug 19 15:04:13 CEST 2011
From: Martin Briza <xbriza00 at stud.fit.vutbr.cz>
Preparation for adding assembly hue/saturation processing functions
Two new function pointers in p_sys to clipping and non-clipping U and V channel processing cycle
---
modules/video_filter/Modules.am | 2 +-
modules/video_filter/adjust.c | 237 ++++++++---------------------
modules/video_filter/adjust_sat_hue.c | 269 +++++++++++++++++++++++++++++++++
modules/video_filter/adjust_sat_hue.h | 63 ++++++++
4 files changed, 394 insertions(+), 177 deletions(-)
create mode 100644 modules/video_filter/adjust_sat_hue.c
create mode 100644 modules/video_filter/adjust_sat_hue.h
diff --git a/modules/video_filter/Modules.am b/modules/video_filter/Modules.am
index e6abb4f..3bc47ca 100644
--- a/modules/video_filter/Modules.am
+++ b/modules/video_filter/Modules.am
@@ -3,7 +3,7 @@ SOURCES_mosaic = mosaic.c mosaic.h
SOURCES_transform = transform.c
SOURCES_invert = invert.c
SOURCES_mirror = mirror.c
-SOURCES_adjust = adjust.c
+SOURCES_adjust = adjust.c adjust_sat_hue.c
SOURCES_wall = wall.c
SOURCES_clone = clone.c
SOURCES_crop = crop.c
diff --git a/modules/video_filter/adjust.c b/modules/video_filter/adjust.c
index 9ccfafc..bc3e944 100644
--- a/modules/video_filter/adjust.c
+++ b/modules/video_filter/adjust.c
@@ -6,6 +6,7 @@
*
* Authors: Simon Latapie <garf at via.ecp.fr>
* Antoine Cellerier <dionoea -at- videolan d0t org>
+ * Martin Briza <gamajun at seznam.cz> (SSE)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,6 +40,8 @@
#include <vlc_filter.h>
#include "filter_picture.h"
+#include "adjust_sat_hue.h"
+
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
@@ -63,7 +66,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
#define THRES_TEXT N_("Brightness threshold")
#define THRES_LONGTEXT N_("When this mode is enabled, pixels will be " \
- "shown as black or white. The threshold value will be the brightness " \
+ "shown as black or white. The threshold value will be the brighness " \
"defined below." )
#define CONT_TEXT N_("Image contrast (0-2)")
#define CONT_LONGTEXT N_("Set the image contrast, between 0 and 2. Defaults to 1.")
@@ -117,7 +120,11 @@ struct filter_sys_t
int i_hue;
double f_saturation;
double f_gamma;
- bool b_brightness_threshold;
+ bool b_brightness_threshold;
+ int (* pf_process_sat_hue)( picture_t *, picture_t *, int, int, int,
+ int, int );
+ int (* pf_process_sat_hue_clip)( picture_t *, picture_t *, int, int,
+ int, int, int );
};
/*****************************************************************************
@@ -128,24 +135,6 @@ static int Create( vlc_object_t *p_this )
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys;
- switch( p_filter->fmt_in.video.i_chroma )
- {
- CASE_PLANAR_YUV
- /* Planar YUV */
- p_filter->pf_video_filter = FilterPlanar;
- break;
-
- CASE_PACKED_YUV_422
- /* Packed YUV 4:2:2 */
- p_filter->pf_video_filter = FilterPacked;
- break;
-
- default:
- msg_Err( p_filter, "Unsupported input chroma (%4.4s)",
- (char*)&(p_filter->fmt_in.video.i_chroma) );
- return VLC_EGENERIC;
- }
-
if( p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma )
{
msg_Err( p_filter, "Input and output chromas don't match" );
@@ -171,6 +160,30 @@ static int Create( vlc_object_t *p_this )
p_sys->b_brightness_threshold =
var_CreateGetBoolCommand( p_filter, "brightness-threshold" );
+ /* Choose Planar/Packed function and pointer to a Hue/Saturation processing
+ * function*/
+ switch( p_filter->fmt_in.video.i_chroma )
+ {
+ CASE_PLANAR_YUV
+ /* Planar YUV */
+ p_filter->pf_video_filter = FilterPlanar;
+ p_sys->pf_process_sat_hue_clip = planar_sat_hue_clip_C;
+ p_sys->pf_process_sat_hue = planar_sat_hue_C;
+ break;
+
+ CASE_PACKED_YUV_422
+ /* Packed YUV 4:2:2 */
+ p_filter->pf_video_filter = FilterPacked;
+ p_sys->pf_process_sat_hue_clip = packed_sat_hue_clip_C;
+ p_sys->pf_process_sat_hue = packed_sat_hue_C;
+ break;
+
+ default:
+ msg_Err( p_filter, "Unsupported input chroma (%4.4s)",
+ (char*)&(p_filter->fmt_in.video.i_chroma) );
+ return VLC_EGENERIC;
+ }
+
vlc_mutex_init( &p_sys->lock );
var_AddCallback( p_filter, "contrast", AdjustCallback, p_sys );
var_AddCallback( p_filter, "brightness", AdjustCallback, p_sys );
@@ -212,8 +225,8 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
int pi_gamma[256];
picture_t *p_outpic;
- uint8_t *p_in, *p_in_v, *p_in_end, *p_line_end;
- uint8_t *p_out, *p_out_v;
+ uint8_t *p_in, *p_in_end, *p_line_end;
+ uint8_t *p_out;
bool b_thres;
double f_hue;
@@ -322,101 +335,25 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
* Do the U and V planes
*/
- p_in = p_pic->p[U_PLANE].p_pixels;
- p_in_v = p_pic->p[V_PLANE].p_pixels;
- p_in_end = p_in + p_pic->p[U_PLANE].i_visible_lines
- * p_pic->p[U_PLANE].i_pitch - 8;
-
- p_out = p_outpic->p[U_PLANE].p_pixels;
- p_out_v = p_outpic->p[V_PLANE].p_pixels;
-
i_sin = sin(f_hue) * 256;
i_cos = cos(f_hue) * 256;
i_x = ( cos(f_hue) + sin(f_hue) ) * 32768;
i_y = ( cos(f_hue) - sin(f_hue) ) * 32768;
- if ( i_sat > 256 )
+ if (i_sat > 256)
{
-#define WRITE_UV_CLIP() \
- i_u = *p_in++ ; i_v = *p_in_v++ ; \
- *p_out++ = clip_uint8_vlc( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
- * i_sat) >> 8) + 128); \
- *p_out_v++ = clip_uint8_vlc( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
- * i_sat) >> 8) + 128)
-
- uint8_t i_u, i_v;
-
- for( ; p_in < p_in_end ; )
- {
- p_line_end = p_in + p_pic->p[U_PLANE].i_visible_pitch - 8;
-
- for( ; p_in < p_line_end ; )
- {
- /* Do 8 pixels at a time */
- WRITE_UV_CLIP(); WRITE_UV_CLIP();
- WRITE_UV_CLIP(); WRITE_UV_CLIP();
- WRITE_UV_CLIP(); WRITE_UV_CLIP();
- WRITE_UV_CLIP(); WRITE_UV_CLIP();
- }
-
- p_line_end += 8;
-
- for( ; p_in < p_line_end ; )
- {
- WRITE_UV_CLIP();
- }
-
- p_in += p_pic->p[U_PLANE].i_pitch
- - p_pic->p[U_PLANE].i_visible_pitch;
- p_in_v += p_pic->p[V_PLANE].i_pitch
- - p_pic->p[V_PLANE].i_visible_pitch;
- p_out += p_outpic->p[U_PLANE].i_pitch
- - p_outpic->p[U_PLANE].i_visible_pitch;
- p_out_v += p_outpic->p[V_PLANE].i_pitch
- - p_outpic->p[V_PLANE].i_visible_pitch;
- }
-#undef WRITE_UV_CLIP
+ /* Currently no errors are implemented in the function, if any are added
+ * check them here */
+ p_sys->pf_process_sat_hue_clip( p_pic, p_outpic, i_sin, i_cos, i_sat,
+ i_x, i_y );
}
else
{
-#define WRITE_UV() \
- i_u = *p_in++ ; i_v = *p_in_v++ ; \
- *p_out++ = (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
- * i_sat) >> 8) + 128; \
- *p_out_v++ = (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
- * i_sat) >> 8) + 128
-
- uint8_t i_u, i_v;
-
- for( ; p_in < p_in_end ; )
- {
- p_line_end = p_in + p_pic->p[U_PLANE].i_visible_pitch - 8;
-
- for( ; p_in < p_line_end ; )
- {
- /* Do 8 pixels at a time */
- WRITE_UV(); WRITE_UV(); WRITE_UV(); WRITE_UV();
- WRITE_UV(); WRITE_UV(); WRITE_UV(); WRITE_UV();
- }
-
- p_line_end += 8;
-
- for( ; p_in < p_line_end ; )
- {
- WRITE_UV();
- }
-
- p_in += p_pic->p[U_PLANE].i_pitch
- - p_pic->p[U_PLANE].i_visible_pitch;
- p_in_v += p_pic->p[V_PLANE].i_pitch
- - p_pic->p[V_PLANE].i_visible_pitch;
- p_out += p_outpic->p[U_PLANE].i_pitch
- - p_outpic->p[U_PLANE].i_visible_pitch;
- p_out_v += p_outpic->p[V_PLANE].i_pitch
- - p_outpic->p[V_PLANE].i_visible_pitch;
- }
-#undef WRITE_UV
+ /* Currently no errors are implemented in the function, if any are added
+ * check them here */
+ p_sys->pf_process_sat_hue( p_pic, p_outpic, i_sin, i_cos, i_sat,
+ i_x, i_y );
}
return CopyInfoAndRelease( p_outpic, p_pic );
@@ -574,83 +511,31 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
i_x = ( cos(f_hue) + sin(f_hue) ) * 32768;
i_y = ( cos(f_hue) - sin(f_hue) ) * 32768;
- if ( i_sat > 256 )
+ if (i_sat > 256)
{
-#define WRITE_UV_CLIP() \
- i_u = *p_in; p_in += 4; i_v = *p_in_v; p_in_v += 4; \
- *p_out = clip_uint8_vlc( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
- * i_sat) >> 8) + 128); \
- p_out += 4; \
- *p_out_v = clip_uint8_vlc( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
- * i_sat) >> 8) + 128); \
- p_out_v += 4
-
- uint8_t i_u, i_v;
-
- for( ; p_in < p_in_end ; )
+ if ( p_sys->pf_process_sat_hue_clip( p_pic, p_outpic, i_sin, i_cos, i_sat,
+ i_x, i_y ) != VLC_SUCCESS )
{
- p_line_end = p_in + i_visible_pitch - 8 * 4;
-
- for( ; p_in < p_line_end ; )
- {
- /* Do 8 pixels at a time */
- WRITE_UV_CLIP(); WRITE_UV_CLIP();
- WRITE_UV_CLIP(); WRITE_UV_CLIP();
- WRITE_UV_CLIP(); WRITE_UV_CLIP();
- WRITE_UV_CLIP(); WRITE_UV_CLIP();
- }
-
- p_line_end += 8 * 4;
-
- for( ; p_in < p_line_end ; )
- {
- WRITE_UV_CLIP();
- }
-
- p_in += i_pitch - i_visible_pitch;
- p_in_v += i_pitch - i_visible_pitch;
- p_out += i_pitch - i_visible_pitch;
- p_out_v += i_pitch - i_visible_pitch;
+ /* Currently only one error can happen in the function, but if there
+ * will be more of them, this message must go away */
+ msg_Warn( p_filter, "Unsupported input chroma (%4.4s)",
+ (char*)&(p_pic->format.i_chroma) );
+ picture_Release( p_pic );
+ return NULL;
}
-#undef WRITE_UV_CLIP
}
else
{
-#define WRITE_UV() \
- i_u = *p_in; p_in += 4; i_v = *p_in_v; p_in_v += 4; \
- *p_out = (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
- * i_sat) >> 8) + 128; \
- p_out += 4; \
- *p_out_v = (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
- * i_sat) >> 8) + 128; \
- p_out_v += 4
-
- uint8_t i_u, i_v;
-
- for( ; p_in < p_in_end ; )
+ if ( p_sys->pf_process_sat_hue( p_pic, p_outpic, i_sin, i_cos, i_sat,
+ i_x, i_y ) != VLC_SUCCESS )
{
- p_line_end = p_in + i_visible_pitch - 8 * 4;
-
- for( ; p_in < p_line_end ; )
- {
- /* Do 8 pixels at a time */
- WRITE_UV(); WRITE_UV(); WRITE_UV(); WRITE_UV();
- WRITE_UV(); WRITE_UV(); WRITE_UV(); WRITE_UV();
- }
-
- p_line_end += 8 * 4;
-
- for( ; p_in < p_line_end ; )
- {
- WRITE_UV();
- }
-
- p_in += i_pitch - i_visible_pitch;
- p_in_v += i_pitch - i_visible_pitch;
- p_out += i_pitch - i_visible_pitch;
- p_out_v += i_pitch - i_visible_pitch;
+ /* Currently only one error can happen in the function, but if there
+ * will be more of them, this message must go away */
+ msg_Warn( p_filter, "Unsupported input chroma (%4.4s)",
+ (char*)&(p_pic->format.i_chroma) );
+ picture_Release( p_pic );
+ return NULL;
}
-#undef WRITE_UV
}
return CopyInfoAndRelease( p_outpic, p_pic );
diff --git a/modules/video_filter/adjust_sat_hue.c b/modules/video_filter/adjust_sat_hue.c
new file mode 100644
index 0000000..9a9458c
--- /dev/null
+++ b/modules/video_filter/adjust_sat_hue.c
@@ -0,0 +1,269 @@
+/*****************************************************************************
+ * adjust_sat_hue.c : Hue/Saturation executive part of adjust plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000-2006 the VideoLAN team
+ *
+ * Authors: Simon Latapie <garf at via.ecp.fr>
+ * Antoine Cellerier <dionoea -at- videolan d0t org>
+ * Martin Briza <gamajun at seznam.cz> (SSE)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_filter.h>
+#include "filter_picture.h"
+#include "adjust_sat_hue.h"
+
+#define PLANAR_WRITE_UV_CLIP() \
+ i_u = *p_in++ ; i_v = *p_in_v++ ; \
+ *p_out++ = clip_uint8_vlc( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
+ * i_sat) >> 8) + 128); \
+ *p_out_v++ = clip_uint8_vlc( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
+ * i_sat) >> 8) + 128)
+
+#define PLANAR_WRITE_UV() \
+ i_u = *p_in++ ; i_v = *p_in_v++ ; \
+ *p_out++ = (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
+ * i_sat) >> 8) + 128; \
+ *p_out_v++ = (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
+ * i_sat) >> 8) + 128
+
+#define PACKED_WRITE_UV_CLIP() \
+ i_u = *p_in; p_in += 4; i_v = *p_in_v; p_in_v += 4; \
+ *p_out = clip_uint8_vlc( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
+ * i_sat) >> 8) + 128); \
+ p_out += 4; \
+ *p_out_v = clip_uint8_vlc( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
+ * i_sat) >> 8) + 128); \
+ p_out_v += 4
+
+#define PACKED_WRITE_UV() \
+ i_u = *p_in; p_in += 4; i_v = *p_in_v; p_in_v += 4; \
+ *p_out = (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
+ * i_sat) >> 8) + 128; \
+ p_out += 4; \
+ *p_out_v = (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
+ * i_sat) >> 8) + 128; \
+ p_out_v += 4
+
+#define ADJUST_2_TIMES(x) x; x
+#define ADJUST_4_TIMES(x) x; x; x; x
+#define ADJUST_8_TIMES(x) x; x; x; x; x; x; x; x
+
+/*****************************************************************************
+ * Hue and saturation adjusting routines
+ *****************************************************************************/
+
+int planar_sat_hue_clip_C( picture_t * p_pic, picture_t * p_outpic, int i_sin, int i_cos,
+ int i_sat, int i_x, int i_y )
+{
+ uint8_t *p_in, *p_in_v, *p_in_end, *p_line_end;
+ uint8_t *p_out, *p_out_v;
+
+ p_in = p_pic->p[U_PLANE].p_pixels;
+ p_in_v = p_pic->p[V_PLANE].p_pixels;
+ p_in_end = p_in + p_pic->p[U_PLANE].i_visible_lines
+ * p_pic->p[U_PLANE].i_pitch - 8;
+
+ p_out = p_outpic->p[U_PLANE].p_pixels;
+ p_out_v = p_outpic->p[V_PLANE].p_pixels;
+
+ uint8_t i_u, i_v;
+
+ for( ; p_in < p_in_end ; )
+ {
+ p_line_end = p_in + p_pic->p[U_PLANE].i_visible_pitch - 8;
+
+ for( ; p_in < p_line_end ; )
+ {
+ /* Do 8 pixels at a time */
+ ADJUST_8_TIMES( PLANAR_WRITE_UV_CLIP() );
+ }
+
+ p_line_end += 8;
+
+ for( ; p_in < p_line_end ; )
+ {
+ PLANAR_WRITE_UV_CLIP();
+ }
+
+ p_in += p_pic->p[U_PLANE].i_pitch
+ - p_pic->p[U_PLANE].i_visible_pitch;
+ p_in_v += p_pic->p[V_PLANE].i_pitch
+ - p_pic->p[V_PLANE].i_visible_pitch;
+ p_out += p_outpic->p[U_PLANE].i_pitch
+ - p_outpic->p[U_PLANE].i_visible_pitch;
+ p_out_v += p_outpic->p[V_PLANE].i_pitch
+ - p_outpic->p[V_PLANE].i_visible_pitch;
+ }
+
+ return VLC_SUCCESS;
+}
+
+int planar_sat_hue_C( picture_t * p_pic, picture_t * p_outpic, int i_sin, int i_cos,
+ int i_sat, int i_x, int i_y )
+{
+ uint8_t *p_in, *p_in_v, *p_in_end, *p_line_end;
+ uint8_t *p_out, *p_out_v;
+
+ p_in = p_pic->p[U_PLANE].p_pixels;
+ p_in_v = p_pic->p[V_PLANE].p_pixels;
+ p_in_end = p_in + p_pic->p[U_PLANE].i_visible_lines
+ * p_pic->p[U_PLANE].i_pitch - 8;
+
+ p_out = p_outpic->p[U_PLANE].p_pixels;
+ p_out_v = p_outpic->p[V_PLANE].p_pixels;
+
+ uint8_t i_u, i_v;
+
+ for( ; p_in < p_in_end ; )
+ {
+ p_line_end = p_in + p_pic->p[U_PLANE].i_visible_pitch - 8;
+
+ for( ; p_in < p_line_end ; )
+ {
+ /* Do 8 pixels at a time */
+ ADJUST_8_TIMES( PLANAR_WRITE_UV() );
+ }
+
+ p_line_end += 8;
+
+ for( ; p_in < p_line_end ; )
+ {
+ PLANAR_WRITE_UV();
+ }
+
+ p_in += p_pic->p[U_PLANE].i_pitch
+ - p_pic->p[U_PLANE].i_visible_pitch;
+ p_in_v += p_pic->p[V_PLANE].i_pitch
+ - p_pic->p[V_PLANE].i_visible_pitch;
+ p_out += p_outpic->p[U_PLANE].i_pitch
+ - p_outpic->p[U_PLANE].i_visible_pitch;
+ p_out_v += p_outpic->p[V_PLANE].i_pitch
+ - p_outpic->p[V_PLANE].i_visible_pitch;
+ }
+
+ return VLC_SUCCESS;
+}
+
+int packed_sat_hue_clip_C( picture_t * p_pic, picture_t * p_outpic, int i_sin, int i_cos,
+ int i_sat, int i_x, int i_y )
+{
+ uint8_t *p_in, *p_in_v, *p_in_end, *p_line_end;
+ uint8_t *p_out, *p_out_v;
+
+ int i_y_offset, i_u_offset, i_v_offset;
+ int i_visible_lines, i_pitch, i_visible_pitch;
+
+
+ if ( GetPackedYuvOffsets( p_pic->format.i_chroma, &i_y_offset,
+ &i_u_offset, &i_v_offset ) != VLC_SUCCESS )
+ return VLC_EGENERIC;
+
+ i_visible_lines = p_pic->p->i_visible_lines;
+ i_pitch = p_pic->p->i_pitch;
+ i_visible_pitch = p_pic->p->i_visible_pitch;
+
+ p_in = p_pic->p->p_pixels + i_u_offset;
+ p_in_v = p_pic->p->p_pixels + i_v_offset;
+ p_in_end = p_in + i_visible_lines * i_pitch - 8 * 4;
+
+ p_out = p_outpic->p->p_pixels + i_u_offset;
+ p_out_v = p_outpic->p->p_pixels + i_v_offset;
+
+ uint8_t i_u, i_v;
+
+ for( ; p_in < p_in_end ; )
+ {
+ p_line_end = p_in + i_visible_pitch - 8 * 4;
+
+ for( ; p_in < p_line_end ; )
+ {
+ /* Do 8 pixels at a time */
+ ADJUST_8_TIMES( PACKED_WRITE_UV_CLIP() );
+ }
+
+ p_line_end += 8 * 4;
+
+ for( ; p_in < p_line_end ; )
+ {
+ PACKED_WRITE_UV_CLIP();
+ }
+
+ p_in += i_pitch - i_visible_pitch;
+ p_in_v += i_pitch - i_visible_pitch;
+ p_out += i_pitch - i_visible_pitch;
+ p_out_v += i_pitch - i_visible_pitch;
+ }
+
+ return VLC_SUCCESS;
+}
+
+int packed_sat_hue_C( picture_t * p_pic, picture_t * p_outpic, int i_sin,
+ int i_cos, int i_sat, int i_x, int i_y )
+{
+ uint8_t *p_in, *p_in_v, *p_in_end, *p_line_end;
+ uint8_t *p_out, *p_out_v;
+
+ int i_y_offset, i_u_offset, i_v_offset;
+ int i_visible_lines, i_pitch, i_visible_pitch;
+
+
+ if ( GetPackedYuvOffsets( p_pic->format.i_chroma, &i_y_offset,
+ &i_u_offset, &i_v_offset ) != VLC_SUCCESS )
+ return VLC_EGENERIC;
+
+ i_visible_lines = p_pic->p->i_visible_lines;
+ i_pitch = p_pic->p->i_pitch;
+ i_visible_pitch = p_pic->p->i_visible_pitch;
+
+ p_in = p_pic->p->p_pixels + i_u_offset;
+ p_in_v = p_pic->p->p_pixels + i_v_offset;
+ p_in_end = p_in + i_visible_lines * i_pitch - 8 * 4;
+
+ p_out = p_outpic->p->p_pixels + i_u_offset;
+ p_out_v = p_outpic->p->p_pixels + i_v_offset;
+
+ uint8_t i_u, i_v;
+
+ for( ; p_in < p_in_end ; )
+ {
+ p_line_end = p_in + i_visible_pitch - 8 * 4;
+
+ for( ; p_in < p_line_end ; )
+ {
+ /* Do 8 pixels at a time */
+ ADJUST_8_TIMES( PACKED_WRITE_UV() );
+ }
+
+ p_line_end += 8 * 4;
+
+ for( ; p_in < p_line_end ; )
+ {
+ PACKED_WRITE_UV();
+ }
+
+ p_in += i_pitch - i_visible_pitch;
+ p_in_v += i_pitch - i_visible_pitch;
+ p_out += i_pitch - i_visible_pitch;
+ p_out_v += i_pitch - i_visible_pitch;
+ }
+
+ return VLC_SUCCESS;
+}
\ No newline at end of file
diff --git a/modules/video_filter/adjust_sat_hue.h b/modules/video_filter/adjust_sat_hue.h
new file mode 100644
index 0000000..1e177fe
--- /dev/null
+++ b/modules/video_filter/adjust_sat_hue.h
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * adjust_sat_hue.h : Hue/Saturation executive part of adjust plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2011 the VideoLAN team
+ *
+ * Authors: Simon Latapie <garf at via.ecp.fr>
+ * Antoine Cellerier <dionoea -at- videolan d0t org>
+ * Martin Briza <gamajun at seznam.cz> (SSE)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <vlc_common.h>
+#include <vlc_cpu.h>
+
+/**
+ * Functions processing saturation and hue of adjust filter.
+ * Prototype and parameters stay the same across different variations.
+ *
+ * @param p_pic Source picture
+ * @param p_outpic Destination picture
+ * @param i_sin Sinus value of hue
+ * @param i_cos Cosinus value of hue
+ * @param i_sat Saturation
+ * @param i_x Additional value of saturation
+ * @param i_y Additional value of saturation
+ */
+
+/**
+ * Basic C compiler generated function for planar format, i_sat > 256
+ */
+int planar_sat_hue_clip_C( picture_t * p_pic, picture_t * p_outpic,
+ int i_sin, int i_cos, int i_sat, int i_x, int i_y );
+
+/**
+ * Basic C compiler generated function for planar format, i_sat <= 256
+ */
+int planar_sat_hue_C( picture_t * p_pic, picture_t * p_outpic,
+ int i_sin, int i_cos, int i_sat, int i_x, int i_y );
+
+/**
+ * Basic C compiler generated function for packed format, i_sat > 256
+ */
+int packed_sat_hue_clip_C( picture_t * p_pic, picture_t * p_outpic,
+ int i_sin, int i_cos, int i_sat, int i_x, int i_y );
+
+/**
+ * Basic C compiler generated function for packed format, i_sat <= 256
+ */
+int packed_sat_hue_C( picture_t * p_pic, picture_t * p_outpic,
+ int i_sin, int i_cos, int i_sat, int i_x, int i_y );
--
1.7.1
More information about the vlc-devel
mailing list