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
Show 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 )
...
@@ -627,6 +627,13 @@ static int64_t GCD( int64_t a, int64_t b )
else
return
a
;
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 */
/* Malloc with automatic error */
#define MALLOC_VOID( var, type ) { var = (type*)malloc( sizeof( type) ); \
#define MALLOC_VOID( var, type ) { var = (type*)malloc( sizeof( type) ); \
if( !var ) return; }
if( !var ) return; }
...
...
modules/video_filter/adjust.c
View file @
1360a812
...
@@ -106,11 +106,6 @@ struct filter_sys_t
...
@@ -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
* Create: allocates adjust video thread output method
*****************************************************************************
*****************************************************************************
...
@@ -259,13 +254,13 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -259,13 +254,13 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
/* Fill the gamma lookup table */
/* Fill the gamma lookup table */
for
(
i
=
0
;
i
<
256
;
i
++
)
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 */
/* Fill the luma lookup table */
for
(
i
=
0
;
i
<
256
;
i
++
)
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
else
...
@@ -343,9 +338,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -343,9 +338,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
{
{
#define WRITE_UV_CLIP() \
#define WRITE_UV_CLIP() \
i_u = *p_in++ ; i_v = *p_in_v++ ; \
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); \
* 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)
* i_sat) >> 8) + 128)
uint8_t
i_u
,
i_v
;
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,
...
@@ -418,10 +418,7 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
else
else
{
{
FOR
FOR
if
(
a
>>
8
)
p_outpix
[
y
*
i_dst_pitch
+
x
]
=
clip_uint8
(
a
);
p_outpix
[
y
*
i_dst_pitch
+
x
]
=
255
;
else
p_outpix
[
y
*
i_dst_pitch
+
x
]
=
(
uint8_t
)
a
;
}
}
}
}
}
}
}
}
...
...
modules/video_filter/panoramix.c
View file @
1360a812
...
@@ -498,13 +498,6 @@ static double Gamma_Correction(int i_plane, float f_component, float f_BlackCrus
...
@@ -498,13 +498,6 @@ static double Gamma_Correction(int i_plane, float f_component, float f_BlackCrus
}
}
#ifdef PACKED_YUV
#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
* F: Function to calculate Gamma correction
...
@@ -516,9 +509,9 @@ static uint8_t F(uint8_t i, float gamma)
...
@@ -516,9 +509,9 @@ static uint8_t F(uint8_t i, float gamma)
// return clip(255 * pow(input, 1.0 / gamma));
// return clip(255 * pow(input, 1.0 / gamma));
if
(
input
<
0
.
5
)
if
(
input
<
0
.
5
)
return
clip
((
255
*
pow
(
2
*
input
,
gamma
))
/
2
);
return
clip
_uint8
((
255
*
pow
(
2
*
input
,
gamma
))
/
2
);
else
else
return
clip
(
255
*
(
1
-
pow
(
2
*
(
1
-
input
),
gamma
)
/
2
));
return
clip
_uint8
(
255
*
(
1
-
pow
(
2
*
(
1
-
input
),
gamma
)
/
2
));
}
}
#endif
#endif
...
...
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