Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
7af58f03
Commit
7af58f03
authored
Nov 23, 2002
by
Simon Latapie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* yuv filter was a bit useless. Hope adjust filter is more usefull :)
parent
c06c5c0d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
164 additions
and
56 deletions
+164
-56
configure.ac.in
configure.ac.in
+1
-1
modules/video_filter/Modules.am
modules/video_filter/Modules.am
+1
-1
modules/video_filter/adjust.c
modules/video_filter/adjust.c
+162
-54
No files found.
configure.ac.in
View file @
7af58f03
...
...
@@ -597,7 +597,7 @@ PLUGINS="${PLUGINS} es audio mpeg_system ps ts"
PLUGINS="${PLUGINS} idct idctclassic motion mpeg_video spudec mpeg_audio"
#PLUGINS="${PLUGINS} a52old imdct downmix"
PLUGINS="${PLUGINS} lpcm a52"
PLUGINS="${PLUGINS} deinterlace invert
yuv
wall transform distort clone crop motionblur"
PLUGINS="${PLUGINS} deinterlace invert
adjust
wall transform distort clone crop motionblur"
PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif fixed32tofloat32 fixed32tos16 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler"
PLUGINS="${PLUGINS} trivial_channel_mixer"
...
...
modules/video_filter/Modules.am
View file @
7af58f03
SOURCES_transform = modules/video_filter/transform.c
SOURCES_invert = modules/video_filter/invert.c
SOURCES_
yuv = modules/video_filter/yuv
.c
SOURCES_
adjust = modules/video_filter/adjust
.c
SOURCES_distort = modules/video_filter/distort.c
SOURCES_wall = modules/video_filter/wall.c
SOURCES_clone = modules/video_filter/clone.c
...
...
modules/video_filter/
yuv
.c
→
modules/video_filter/
adjust
.c
View file @
7af58f03
/*****************************************************************************
*
yuv.c : YUV plans modifier
video plugin for vlc
*
adjust.c : Contrast/Hue/Saturation/Brightness
video plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id:
yuv.c,v 1.1 2002/10/26 01:08:13
garf Exp $
* $Id:
adjust.c,v 1.1 2002/11/23 00:11:17
garf Exp $
*
* Authors: Simon Latapie <garf@via.ecp.fr>, Samuel Hocevar <sam@zoy.org>
*
...
...
@@ -27,6 +27,7 @@
#include <errno.h>
#include <stdlib.h>
/* malloc(), free() */
#include <string.h>
#include <math.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
...
...
@@ -47,52 +48,54 @@ static void Render ( vout_thread_t *, picture_t * );
* Module descriptor
*****************************************************************************/
#define Y_TEXT N_("Y plan modifier")
#define Y_LONGTEXT N_("between 0 and 255, default to 255")
#define Y_INV_TEXT N_("invert Y plan")
#define Y_INV_LONGTEXT N_("same function as invert filter")
#define CONT_TEXT N_("Contrast")
#define CONT_LONGTEXT N_("Default to 1")
#define HUE_TEXT N_("Hue")
#define HUE_LONGTEXT N_("Between 0 and 360. Default to 0")
#define SAT_TEXT N_("Saturation")
#define SAT_LONGTEXT N_("Default to 1")
#define LUM_TEXT N_("Brightness")
#define LUM_LONGTEXT N_("Default to 1")
#define U_TEXT N_("U plan modifier")
#define U_LONGTEXT N_("between 0 and 255, default to 255")
#define U_INV_TEXT N_("invert U plan")
#define U_INV_LONGTEXT N_("same function as invert filter")
#define V_TEXT N_("V plan modifier")
#define V_LONGTEXT N_("between 0 and 255, default to 255")
#define V_INV_TEXT N_("invert V plan")
#define V_INV_LONGTEXT N_("same function as invert filter")
vlc_module_begin
();
add_category_hint
(
N_
(
"Miscellaneous"
),
NULL
);
add_integer
(
"Y plan"
,
255
,
NULL
,
Y_TEXT
,
Y_LONGTEXT
);
add_bool
(
"invert Y"
,
0
,
NULL
,
Y_INV_TEXT
,
Y_INV_LONGTEXT
);
add_integer
(
"U plan"
,
255
,
NULL
,
U_TEXT
,
U_LONGTEXT
);
add_bool
(
"invert U"
,
0
,
NULL
,
U_INV_TEXT
,
U_INV_LONGTEXT
);
add_integer
(
"V plan"
,
255
,
NULL
,
V_TEXT
,
V_LONGTEXT
);
add_bool
(
"invert V"
,
0
,
NULL
,
V_INV_TEXT
,
V_INV_LONGTEXT
);
set_description
(
_
(
"yuv plan modifier filter"
)
);
add_float
(
"Contrast"
,
1
.
0
,
NULL
,
CONT_TEXT
,
CONT_LONGTEXT
);
add_float
(
"Brightness"
,
1
.
0
,
NULL
,
LUM_TEXT
,
LUM_LONGTEXT
);
add_integer
(
"Hue"
,
0
,
NULL
,
HUE_TEXT
,
HUE_LONGTEXT
);
add_float
(
"Saturation"
,
1
.
0
,
NULL
,
SAT_TEXT
,
SAT_LONGTEXT
);
set_description
(
_
(
"Contrast/Hue/Saturation/Brightness filter"
)
);
set_capability
(
"video filter"
,
0
);
add_shortcut
(
"
yuv
"
);
add_shortcut
(
"
adjust
"
);
set_callbacks
(
Create
,
Destroy
);
vlc_module_end
();
/*****************************************************************************
* vout_sys_t:
YUV
video output method descriptor
* vout_sys_t:
adjust
video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the
YUV
specific properties of an output thread.
* It describes the
adjust
specific properties of an output thread.
*****************************************************************************/
struct
vout_sys_t
{
int
i_coeff
[
3
];
vlc_bool_t
b_invert
[
3
];
vout_thread_t
*
p_vout
;
};
static
int32_t
maxmin
(
int32_t
a
)
{
if
(
a
>
255
)
return
255
;
else
if
(
a
<
0
)
return
0
;
else
return
a
;
}
/*****************************************************************************
* Create: allocates
YUV
video thread output method
* Create: allocates
adjust
video thread output method
*****************************************************************************
* This function allocates and initializes a
YUV
vout method.
* This function allocates and initializes a
adjust
vout method.
*****************************************************************************/
static
int
Create
(
vlc_object_t
*
p_this
)
{
...
...
@@ -116,7 +119,7 @@ static int Create( vlc_object_t *p_this )
}
/*****************************************************************************
* Init: initialize
YUV
video thread output method
* Init: initialize
adjust
video thread output method
*****************************************************************************/
static
int
Init
(
vout_thread_t
*
p_vout
)
{
...
...
@@ -153,7 +156,7 @@ static int Init( vout_thread_t *p_vout )
}
/*****************************************************************************
* End: terminate
YUV
video thread output method
* End: terminate
adjust
video thread output method
*****************************************************************************/
static
void
End
(
vout_thread_t
*
p_vout
)
{
...
...
@@ -168,9 +171,9 @@ static void End( vout_thread_t *p_vout )
}
/*****************************************************************************
* Destroy: destroy
YUV
video thread output method
* Destroy: destroy
adjust
video thread output method
*****************************************************************************
* Terminate an output method created by
YUV
CreateOutputMethod
* Terminate an output method created by
adjust
CreateOutputMethod
*****************************************************************************/
static
void
Destroy
(
vlc_object_t
*
p_this
)
{
...
...
@@ -184,7 +187,7 @@ static void Destroy( vlc_object_t *p_this )
/*****************************************************************************
* Render: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to
YUV
modified image,
* This function send the currently rendered image to
adjust
modified image,
* waits until it is displayed and switch the two rendering buffers, preparing
* next frame.
*****************************************************************************/
...
...
@@ -192,16 +195,29 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
{
picture_t
*
p_outpic
;
int
i_index
;
s32
cont
;
s32
lum
;
/* Contrast is a fast but cludged function, so I put this gap to be
cleaner :) */
s32
dec
;
double
hue
;
int
i_sat
;
int
i_Sin
;
int
i_Cos
;
/* This is a new frame. Get a structure from the video_output. */
p_vout
->
p_sys
->
i_coeff
[
0
]
=
config_GetInt
(
p_vout
,
"Y plan"
)
;
p_vout
->
p_sys
->
i_coeff
[
1
]
=
config_GetInt
(
p_vout
,
"U plan"
)
;
p_vout
->
p_sys
->
i_coeff
[
2
]
=
config_GetInt
(
p_vout
,
"V plan"
)
;
cont
=
(
s32
)
(
config_GetFloat
(
p_vout
,
"Contrast"
)
*
255
);
lum
=
(
s32
)
(
(
config_GetFloat
(
p_vout
,
"Brightness"
)
*
255
)
-
255
);
hue
=
config_GetInt
(
p_vout
,
"Hue"
)
*
3
.
14159
/
180
;
/* convert in radian */
i_sat
=
(
int
)
(
config_GetFloat
(
p_vout
,
"Saturation"
)
*
256
);
dec
=
128
-
(
cont
/
2
);
i_Sin
=
(
int
)
(
sin
(
hue
)
*
256
);
i_Cos
=
(
int
)
(
cos
(
hue
)
*
256
);
p_vout
->
p_sys
->
b_invert
[
0
]
=
config_GetInt
(
p_vout
,
"invert Y"
)
;
p_vout
->
p_sys
->
b_invert
[
1
]
=
config_GetInt
(
p_vout
,
"invert U"
)
;
p_vout
->
p_sys
->
b_invert
[
2
]
=
config_GetInt
(
p_vout
,
"invert V"
)
;
while
(
(
p_outpic
=
vout_CreatePicture
(
p_vout
->
p_sys
->
p_vout
,
0
,
0
,
0
)
)
==
NULL
)
...
...
@@ -218,29 +234,30 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
for
(
i_index
=
0
;
i_index
<
p_pic
->
i_planes
;
i_index
++
)
{
if
(
i_index
==
0
)
{
u8
*
p_in
,
*
p_in_end
,
*
p_out
;
s32
i_coeff
;
vlc_bool_t
b_inv
;
i_coeff
=
p_vout
->
p_sys
->
i_coeff
[
i_index
];
b_inv
=
p_vout
->
p_sys
->
b_invert
[
i_index
];
p_in
=
p_pic
->
p
[
i_index
].
p_pixels
;
p_in_end
=
p_in
+
p_pic
->
p
[
i_index
].
i_lines
*
p_pic
->
p
[
i_index
].
i_pitch
-
8
;
p_out
=
p_outpic
->
p
[
i_index
].
p_pixels
;
for
(
;
p_in
<
p_in_end
;
)
{
/* Do 8 pixels at a time */
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
)
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
)
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
)
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
)
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
)
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
)
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
)
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
)
;
p_out
++
;
p_in
++
;
}
p_in_end
+=
8
;
...
...
@@ -248,12 +265,103 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
for
(
;
p_in
<
p_in_end
;
)
{
/* Do 1 pixel at a time */
*
p_out
=
(
*
p_in
*
i_coeff
*
(
1
-
2
*
b_inv
))
>>
8
;
p_out
++
;
p_in
++
;
*
p_out
=
maxmin
(
((
*
p_in
*
cont
)
>>
8
)
+
lum
+
dec
);
p_out
++
;
p_in
++
;
}
}
else
{
if
(
i_index
==
1
)
{
u8
*
p_in_u
,
*
p_in_v
,
*
p_in_end
,
*
p_out_u
,
*
p_out_v
,
i_u
,
i_v
;
p_in_u
=
p_pic
->
p
[
i_index
].
p_pixels
;
p_in_v
=
p_pic
->
p
[
i_index
+
1
].
p_pixels
;
p_in_end
=
p_in_u
+
p_pic
->
p
[
i_index
].
i_lines
*
p_pic
->
p
[
i_index
].
i_pitch
-
8
;
p_out_u
=
p_outpic
->
p
[
i_index
].
p_pixels
;
p_out_v
=
p_outpic
->
p
[
i_index
+
1
].
p_pixels
;
for
(
;
p_in_u
<
p_in_end
;
)
{
/* Do 8 pixels at a time */
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
}
p_in_end
+=
8
;
for
(
;
p_in_u
<
p_in_end
;
)
{
/* Do 1 pixel at a time */
i_u
=
*
p_in_u
;
i_v
=
*
p_in_v
;
*
p_out_u
=
maxmin
(
(((((
i_u
*
i_Cos
+
i_v
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
*
p_out_v
=
maxmin
(
(((((
i_v
*
i_Cos
-
i_u
*
i_Sin
)
>>
8
)
-
128
)
*
i_sat
)
>>
8
)
+
128
);
p_out_u
++
;
p_in_u
++
;
p_out_v
++
;
p_in_v
++
;
}
}
}
}
vout_UnlinkPicture
(
p_vout
->
p_sys
->
p_vout
,
p_outpic
);
vout_DisplayPicture
(
p_vout
->
p_sys
->
p_vout
,
p_outpic
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment