Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
454
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
8a44e3b5
Commit
8a44e3b5
authored
4 years ago
by
Alexandre Janniaux
Browse files
Options
Downloads
Patches
Plain Diff
vhs: refactor integers
parent
c46f0f64
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/video_filter/vhs.c
+16
-15
16 additions, 15 deletions
modules/video_filter/vhs.c
with
16 additions
and
15 deletions
modules/video_filter/vhs.c
+
16
−
15
View file @
8a44e3b5
...
...
@@ -43,7 +43,7 @@ static inline int64_t MOD(int64_t a, int64_t b) {
#define MAX_BLUE_RED_LINES 100
typedef
struct
{
int32_t
i_offset
;
unsigned
i_offset
;
uint16_t
i_intensity
;
bool
b_blue_red
;
vlc_tick_t
i_stop_trigger
;
...
...
@@ -54,7 +54,7 @@ typedef struct
/* general data */
bool
b_init
;
int32
_t
i_planes
;
size
_t
i_planes
;
int32_t
i_height
[
VOUT_MAX_PLANES
];
/* note: each plane may have different dimensions */
int32_t
i_width
[
VOUT_MAX_PLANES
];
int32_t
i_visible_pitch
[
VOUT_MAX_PLANES
];
...
...
@@ -63,11 +63,11 @@ typedef struct
vlc_tick_t
i_cur_time
;
/* sliding & offset effect */
int
32_t
i_phase_speed
;
int
32_t
i_phase_ofs
;
int
32_t
i_offset_ofs
;
int
32_t
i_sliding_ofs
;
int
32_t
i_sliding_speed
;
int
i_phase_speed
;
int
i_phase_ofs
;
int
i_offset_ofs
;
int
i_sliding_ofs
;
int
i_sliding_speed
;
vlc_tick_t
i_offset_trigger
;
vlc_tick_t
i_sliding_trigger
;
vlc_tick_t
i_sliding_stop_trig
;
...
...
@@ -224,7 +224,7 @@ static int vhs_allocate_data( filter_t *p_filter, picture_t *p_pic_in ) {
*/
p_sys
->
i_planes
=
p_pic_in
->
i_planes
;
for
(
int32
_t
i_p
=
0
;
i_p
<
p_sys
->
i_planes
;
i_p
++
)
{
for
(
size
_t
i_p
=
0
;
i_p
<
p_sys
->
i_planes
;
i_p
++
)
{
p_sys
->
i_visible_pitch
[
i_p
]
=
(
int
)
p_pic_in
->
p
[
i_p
].
i_visible_pitch
;
p_sys
->
i_height
[
i_p
]
=
(
int
)
p_pic_in
->
p
[
i_p
].
i_visible_lines
;
p_sys
->
i_width
[
i_p
]
=
(
int
)
p_pic_in
->
p
[
i_p
].
i_visible_pitch
/
p_pic_in
->
p
[
i_p
].
i_pixel_pitch
;
...
...
@@ -260,7 +260,7 @@ static int vhs_blue_red_line_effect( filter_t *p_filter, picture_t *p_pic_out )
/* generate new blue or red lines */
if
(
p_sys
->
i_BR_line_trigger
<=
p_sys
->
i_cur_time
)
{
for
(
uint32
_t
i_b
=
0
;
i_b
<
MAX_BLUE_RED_LINES
;
i_b
++
)
for
(
size
_t
i_b
=
0
;
i_b
<
MAX_BLUE_RED_LINES
;
i_b
++
)
if
(
p_sys
->
p_BR_lines
[
i_b
]
==
NULL
)
{
/* allocate data */
p_sys
->
p_BR_lines
[
i_b
]
=
calloc
(
1
,
sizeof
(
blue_red_line_t
)
);
...
...
@@ -283,7 +283,7 @@ static int vhs_blue_red_line_effect( filter_t *p_filter, picture_t *p_pic_out )
/* manage and apply current blue/red lines */
for
(
uint8
_t
i_b
=
0
;
i_b
<
MAX_BLUE_RED_LINES
;
i_b
++
)
for
(
size
_t
i_b
=
0
;
i_b
<
MAX_BLUE_RED_LINES
;
i_b
++
)
if
(
p_sys
->
p_BR_lines
[
i_b
]
)
{
/* remove outdated ones */
if
(
p_sys
->
p_BR_lines
[
i_b
]
->
i_stop_trigger
<=
p_sys
->
i_cur_time
)
{
...
...
@@ -292,7 +292,7 @@ static int vhs_blue_red_line_effect( filter_t *p_filter, picture_t *p_pic_out )
}
/* otherwise apply */
for
(
int32
_t
i_p
=
0
;
i_p
<
p_sys
->
i_planes
;
i_p
++
)
{
for
(
size
_t
i_p
=
0
;
i_p
<
p_sys
->
i_planes
;
i_p
++
)
{
uint32_t
i_pix_ofs
=
p_sys
->
p_BR_lines
[
i_b
]
->
i_offset
*
p_pic_out
->
p
[
i_p
].
i_visible_lines
/
p_sys
->
i_height
[
Y_PLANE
]
...
...
@@ -340,7 +340,7 @@ static void vhs_blue_red_dots_effect( filter_t *p_filter, picture_t *p_pic_out )
uint16_t
i_y
=
(
unsigned
)
vlc_mrand48
()
%
p_sys
->
i_height
[
Y_PLANE
];
bool
b_color
=
(
(
(
unsigned
)
vlc_mrand48
()
%
2
)
==
0
);
for
(
int32
_t
i_p
=
0
;
i_p
<
p_sys
->
i_planes
;
i_p
++
)
{
for
(
size
_t
i_p
=
0
;
i_p
<
p_sys
->
i_planes
;
i_p
++
)
{
uint32_t
i_pix_ofs
=
i_y
*
p_pic_out
->
p
[
i_p
].
i_visible_lines
/
p_sys
->
i_height
[
Y_PLANE
]
...
...
@@ -481,7 +481,7 @@ static int vhs_sliding_effect_apply( filter_t *p_filter, picture_t *p_pic_out )
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
for
(
uint8
_t
i_p
=
0
;
i_p
<
p_
pic_out
->
i_planes
;
i_p
++
)
{
for
(
size
_t
i_p
=
0
;
i_p
<
p_
sys
->
i_planes
;
i_p
++
)
{
/* first allocate temporary buffer for swap operation */
uint8_t
*
p_temp_buf
;
if
(
!
p_sys
->
i_sliding_type_duplicate
)
{
...
...
@@ -496,9 +496,10 @@ static int vhs_sliding_effect_apply( filter_t *p_filter, picture_t *p_pic_out )
p_temp_buf
=
p_pic_out
->
p
[
i_p
].
p_pixels
;
/* copy lines to output_pic */
for
(
int32_t
i_y
=
0
;
i_y
<
p_pic_out
->
p
[
i_p
].
i_visible_lines
;
i_y
++
)
size_t
lines
=
p_pic_out
->
p
[
i_p
].
i_visible_lines
;
for
(
size_t
i_y
=
0
;
i_y
<
lines
;
i_y
++
)
{
int
32_t
i_ofs
=
p_sys
->
i_offset_ofs
+
p_sys
->
i_sliding_ofs
;
int
i_ofs
=
p_sys
->
i_offset_ofs
+
p_sys
->
i_sliding_ofs
;
if
(
(
p_sys
->
i_sliding_speed
==
0
)
||
!
p_sys
->
i_sliding_type_duplicate
)
i_ofs
+=
p_sys
->
i_phase_ofs
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment