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
1360a812
Commit
1360a812
authored
Feb 02, 2007
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy clip_uint8() function from ffmpeg and replace where applicable for video filters.
parent
0a40fae1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
30 deletions
+22
-30
include/vlc_common.h
include/vlc_common.h
+7
-0
modules/video_filter/adjust.c
modules/video_filter/adjust.c
+4
-9
modules/video_filter/gradient.c
modules/video_filter/gradient.c
+1
-4
modules/video_filter/panoramix.c
modules/video_filter/panoramix.c
+10
-17
No files found.
include/vlc_common.h
View file @
1360a812
...
...
@@ -627,6 +627,13 @@ static int64_t GCD( int64_t a, int64_t b )
else
return
a
;
}
/* function imported from libavutil/common.h */
static
inline
uint8_t
clip_uint8_vlc
(
int32_t
a
)
{
if
(
a
&
(
~
255
)
)
return
(
-
a
)
>>
31
;
else
return
a
;
}
/* Malloc with automatic error */
#define MALLOC_VOID( var, type ) { var = (type*)malloc( sizeof( type) ); \
if( !var ) return; }
...
...
modules/video_filter/adjust.c
View file @
1360a812
...
...
@@ -106,11 +106,6 @@ struct filter_sys_t
{
};
inline
static
int32_t
clip
(
int32_t
a
)
{
return
(
a
>
255
)
?
255
:
(
a
<
0
)
?
0
:
a
;
}
/*****************************************************************************
* Create: allocates adjust video thread output method
*****************************************************************************
...
...
@@ -259,13 +254,13 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
/* Fill the gamma lookup table */
for
(
i
=
0
;
i
<
256
;
i
++
)
{
pi_gamma
[
i
]
=
clip
(
pow
(
i
/
255
.
0
,
f_gamma
)
*
255
.
0
);
pi_gamma
[
i
]
=
clip
_uint8_vlc
(
pow
(
i
/
255
.
0
,
f_gamma
)
*
255
.
0
);
}
/* Fill the luma lookup table */
for
(
i
=
0
;
i
<
256
;
i
++
)
{
pi_luma
[
i
]
=
pi_gamma
[
clip
(
i_lum
+
i_cont
*
i
/
256
)];
pi_luma
[
i
]
=
pi_gamma
[
clip
_uint8_vlc
(
i_lum
+
i_cont
*
i
/
256
)];
}
}
else
...
...
@@ -343,9 +338,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
{
#define WRITE_UV_CLIP() \
i_u = *p_in++ ; i_v = *p_in_v++ ; \
*p_out++ = clip( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
*p_out++ = clip
_uint8_vlc
( (( ((i_u * i_cos + i_v * i_sin - i_x) >> 8) \
* i_sat) >> 8) + 128); \
*p_out_v++ = clip( (( ((i_v * i_cos - i_u * i_sin - i_y) >> 8) \
*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
;
...
...
modules/video_filter/gradient.c
View file @
1360a812
...
...
@@ -418,10 +418,7 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
else
{
FOR
if
(
a
>>
8
)
p_outpix
[
y
*
i_dst_pitch
+
x
]
=
255
;
else
p_outpix
[
y
*
i_dst_pitch
+
x
]
=
(
uint8_t
)
a
;
p_outpix
[
y
*
i_dst_pitch
+
x
]
=
clip_uint8
(
a
);
}
}
}
}
...
...
modules/video_filter/panoramix.c
View file @
1360a812
...
...
@@ -40,8 +40,8 @@
// OS CODE DEPENDANT to get display dimensions
#ifdef SYS_MINGW32
#include <windows.h>
#else
#include <X11/Xlib.h>
#else
#include <X11/Xlib.h>
#endif
#define GAMMA 1
// #define PACKED_YUV 1
...
...
@@ -367,7 +367,7 @@ case VLC_FOURCC('c','y','u','v'): // packed by 2
#ifdef OVERLAP
p_vout
->
p_sys
->
i_offset_x
=
var_CreateGetInteger
(
p_vout
,
"offset-x"
);
if
(
p_vout
->
p_sys
->
i_col
>
2
)
p_vout
->
p_sys
->
i_offset_x
=
0
;
// offset-x is used in case of 2x1 wall & autocrop
if
(
p_vout
->
p_sys
->
i_col
>
2
)
p_vout
->
p_sys
->
i_offset_x
=
0
;
// offset-x is used in case of 2x1 wall & autocrop
p_vout
->
p_sys
->
b_autocrop
=
!
(
var_CreateGetInteger
(
p_vout
,
"crop-ratio"
)
==
0
);
if
(
!
p_vout
->
p_sys
->
b_autocrop
)
p_vout
->
p_sys
->
b_autocrop
=
var_CreateGetInteger
(
p_vout
,
"autocrop"
);
p_vout
->
p_sys
->
b_attenuate
=
var_CreateGetInteger
(
p_vout
,
"panoramix-attenuate"
);
...
...
@@ -383,7 +383,7 @@ case VLC_FOURCC('c','y','u','v'): // packed by 2
double
d_p
=
100
.
0
/
p_vout
->
p_sys
->
bz_middle_pos
;
p_vout
->
p_sys
->
i_ratio_max
=
var_CreateGetInteger
(
p_vout
,
"autocrop-ratio-max"
);
// in crop module with autocrop ...
p_vout
->
p_sys
->
i_ratio
=
var_CreateGetInteger
(
p_vout
,
"crop-ratio"
);
// in crop module with manual ratio ...
p_vout
->
p_sys
->
a_2
=
d_p
*
p_vout
->
p_sys
->
bz_begin
-
(
double
)(
d_p
*
d_p
/
(
d_p
-
1
))
*
p_vout
->
p_sys
->
bz_middle
+
(
double
)(
d_p
/
(
d_p
-
1
))
*
p_vout
->
p_sys
->
bz_end
;
p_vout
->
p_sys
->
a_1
=
-
(
d_p
+
1
)
*
p_vout
->
p_sys
->
bz_begin
+
(
double
)(
d_p
*
d_p
/
(
d_p
-
1
))
*
p_vout
->
p_sys
->
bz_middle
-
(
double
)(
1
/
(
d_p
-
1
))
*
p_vout
->
p_sys
->
bz_end
;
p_vout
->
p_sys
->
a_0
=
p_vout
->
p_sys
->
bz_begin
;
...
...
@@ -498,13 +498,6 @@ static double Gamma_Correction(int i_plane, float f_component, float f_BlackCrus
}
#ifdef PACKED_YUV
/*****************************************************************************
* Clip: clip an 32 bits int in 8 bits
*****************************************************************************/
inline
static
int32_t
clip
(
int32_t
a
)
{
return
(
a
>
255
)
?
255
:
(
a
<
0
)
?
0
:
a
;
}
/*****************************************************************************
* F: Function to calculate Gamma correction
...
...
@@ -516,9 +509,9 @@ static uint8_t F(uint8_t i, float gamma)
// return clip(255 * pow(input, 1.0 / gamma));
if
(
input
<
0
.
5
)
return
clip
((
255
*
pow
(
2
*
input
,
gamma
))
/
2
);
return
clip
_uint8
((
255
*
pow
(
2
*
input
,
gamma
))
/
2
);
else
return
clip
(
255
*
(
1
-
pow
(
2
*
(
1
-
input
),
gamma
)
/
2
));
return
clip
_uint8
(
255
*
(
1
-
pow
(
2
*
(
1
-
input
),
gamma
)
/
2
));
}
#endif
...
...
@@ -543,7 +536,7 @@ static int AdjustHeight( vout_thread_t *p_vout )
#ifdef SYS_MINGW32
i_window_width
=
GetSystemMetrics
(
SM_CXSCREEN
);
i_window_height
=
GetSystemMetrics
(
SM_CYSCREEN
);
#else
#else
Display
*
p_display
=
XOpenDisplay
(
""
);
if
(
p_vout
->
p_sys
->
b_xinerama
)
{
...
...
@@ -554,9 +547,9 @@ static int AdjustHeight( vout_thread_t *p_vout )
{
i_window_width
=
DisplayWidth
(
p_display
,
0
);
i_window_height
=
DisplayHeight
(
p_display
,
0
);
}
XCloseDisplay
(
p_display
);
free
(
p_display
);
}
XCloseDisplay
(
p_display
);
free
(
p_display
);
#endif
var_SetInteger
(
p_vout
,
"width"
,
i_window_width
);
var_SetInteger
(
p_vout
,
"height"
,
i_window_height
);
...
...
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