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
373db314
Commit
373db314
authored
Sep 02, 2007
by
Jean-Paul Saman
Committed by
Jean-Paul Saman
Mar 05, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support RGBA in scale video-filter. This is a backport from trunk [19552:21020].
parent
c5a52b76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
25 deletions
+91
-25
modules/video_filter/scale.c
modules/video_filter/scale.c
+91
-25
No files found.
modules/video_filter/scale.c
View file @
373db314
...
...
@@ -3,7 +3,7 @@
* Uses the low quality "nearest neighbour" algorithm.
*****************************************************************************
* Copyright (C) 2003 the VideoLAN team
* $Id$
* $Id
: fde9f41689fe615649e0431f705af1fc53ecffbd
$
*
* Author: Gildas Bazin <gbazin@videolan.org>
*
...
...
@@ -66,7 +66,8 @@ static int OpenFilter( vlc_object_t *p_this )
filter_sys_t
*
p_sys
;
if
(
(
p_filter
->
fmt_in
.
video
.
i_chroma
!=
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'P'
)
&&
p_filter
->
fmt_in
.
video
.
i_chroma
!=
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
)
)
||
p_filter
->
fmt_in
.
video
.
i_chroma
!=
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
)
&&
p_filter
->
fmt_in
.
video
.
i_chroma
!=
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
||
p_filter
->
fmt_in
.
video
.
i_chroma
!=
p_filter
->
fmt_out
.
video
.
i_chroma
)
{
return
VLC_EGENERIC
;
...
...
@@ -106,10 +107,18 @@ static void CloseFilter( vlc_object_t *p_this )
static
picture_t
*
Filter
(
filter_t
*
p_filter
,
picture_t
*
p_pic
)
{
picture_t
*
p_pic_dst
;
int
i_plane
,
i
,
j
,
k
,
l
;
int
i_plane
;
if
(
!
p_pic
)
return
NULL
;
if
(
(
p_filter
->
fmt_in
.
video
.
i_height
==
0
)
||
(
p_filter
->
fmt_in
.
video
.
i_width
==
0
)
)
return
NULL
;
if
(
(
p_filter
->
fmt_out
.
video
.
i_height
==
0
)
||
(
p_filter
->
fmt_out
.
video
.
i_width
==
0
)
)
return
NULL
;
/* Request output picture */
p_pic_dst
=
p_filter
->
pf_vout_buffer_new
(
p_filter
);
if
(
!
p_pic_dst
)
...
...
@@ -120,30 +129,87 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return
NULL
;
}
for
(
i_plane
=
0
;
i_plane
<
p_pic_dst
->
i_planes
;
i_plane
++
)
if
(
p_filter
->
fmt_in
.
video
.
i_chroma
!=
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
{
uint8_t
*
p_src
=
p_pic
->
p
[
i_plane
].
p_pixels
;
uint8_t
*
p_dst
=
p_pic_dst
->
p
[
i_plane
].
p_pixels
;
int
i_src_pitch
=
p_pic
->
p
[
i_plane
].
i_pitch
;
int
i_dst_pitch
=
p_pic_dst
->
p
[
i_plane
].
i_pitch
;
for
(
i
=
0
;
i
<
p_pic_dst
->
p
[
i_plane
].
i_visible_lines
;
i
++
)
for
(
i_plane
=
0
;
i_plane
<
p_pic_dst
->
i_planes
;
i_plane
++
)
{
l
=
(
p_filter
->
fmt_in
.
video
.
i_height
*
i
+
p_filter
->
fmt_out
.
video
.
i_height
/
2
)
/
p_filter
->
fmt_out
.
video
.
i_height
;
l
=
__MIN
(
(
int
)
p_filter
->
fmt_in
.
video
.
i_height
-
1
,
l
);
for
(
j
=
0
;
j
<
p_pic_dst
->
p
[
i_plane
].
i_visible_pitch
;
j
++
)
const
int
i_src_pitch
=
p_pic
->
p
[
i_plane
].
i_pitch
;
const
int
i_dst_pitch
=
p_pic_dst
->
p
[
i_plane
].
i_pitch
;
const
int
i_src_height
=
p_filter
->
fmt_in
.
video
.
i_height
;
const
int
i_src_width
=
p_filter
->
fmt_in
.
video
.
i_width
;
const
int
i_dst_height
=
p_filter
->
fmt_out
.
video
.
i_height
;
const
int
i_dst_width
=
p_filter
->
fmt_out
.
video
.
i_width
;
const
int
i_dst_visible_lines
=
p_pic_dst
->
p
[
i_plane
].
i_visible_lines
;
const
int
i_dst_visible_pitch
=
p_pic_dst
->
p
[
i_plane
].
i_visible_pitch
;
const
int
i_dst_hidden_pitch
=
i_dst_pitch
-
i_dst_visible_pitch
;
#define SHIFT_SIZE 16
const
int
i_height_coef
=
(
i_src_height
<<
SHIFT_SIZE
)
/
i_dst_height
;
const
int
i_width_coef
=
(
i_src_width
<<
SHIFT_SIZE
)
/
i_dst_width
;
const
int
i_src_height_1
=
i_src_height
-
1
;
const
int
i_src_width_1
=
i_src_width
-
1
;
uint8_t
*
p_src
=
p_pic
->
p
[
i_plane
].
p_pixels
;
uint8_t
*
p_dst
=
p_pic_dst
->
p
[
i_plane
].
p_pixels
;
uint8_t
*
p_dstendline
=
p_dst
+
i_dst_visible_pitch
;
const
uint8_t
*
p_dstend
=
p_dst
+
i_dst_visible_lines
*
i_dst_pitch
;
int
l
=
1
<<
(
SHIFT_SIZE
-
1
);
for
(
;
p_dst
<
p_dstend
;
p_dst
+=
i_dst_hidden_pitch
,
p_dstendline
+=
i_dst_pitch
,
l
+=
i_height_coef
)
{
k
=
(
p_filter
->
fmt_in
.
video
.
i_width
*
j
+
p_filter
->
fmt_out
.
video
.
i_width
/
2
)
/
p_filter
->
fmt_out
.
video
.
i_width
;
k
=
__MIN
(
(
int
)
p_filter
->
fmt_in
.
video
.
i_width
-
1
,
k
);
p_dst
[
i
*
i_dst_pitch
+
j
]
=
p_src
[
l
*
i_src_pitch
+
k
];
int
k
=
1
<<
(
SHIFT_SIZE
-
1
);
uint8_t
*
p_srcl
=
p_src
+
(
__MIN
(
i_src_height_1
,
l
>>
SHIFT_SIZE
)
*
i_src_pitch
);
for
(
;
p_dst
<
p_dstendline
;
p_dst
++
,
k
+=
i_width_coef
)
{
*
p_dst
=
p_srcl
[
__MIN
(
i_src_width_1
,
k
>>
SHIFT_SIZE
)];
}
}
}
}
else
/* RGBA */
{
const
int
i_src_pitch
=
p_pic
->
p
->
i_pitch
;
const
int
i_dst_pitch
=
p_pic_dst
->
p
->
i_pitch
;
const
int
i_src_height
=
p_filter
->
fmt_in
.
video
.
i_height
;
const
int
i_src_width
=
p_filter
->
fmt_in
.
video
.
i_width
;
const
int
i_dst_height
=
p_filter
->
fmt_out
.
video
.
i_height
;
const
int
i_dst_width
=
p_filter
->
fmt_out
.
video
.
i_width
;
const
int
i_dst_visible_lines
=
p_pic_dst
->
p
->
i_visible_lines
;
const
int
i_dst_visible_pitch
=
p_pic_dst
->
p
->
i_visible_pitch
;
const
int
i_dst_hidden_pitch
=
i_dst_pitch
-
i_dst_visible_pitch
;
const
int
i_height_coef
=
(
i_src_height
<<
SHIFT_SIZE
)
/
i_dst_height
;
const
int
i_width_coef
=
(
i_src_width
<<
SHIFT_SIZE
)
/
i_dst_width
;
const
int
i_src_height_1
=
i_src_height
-
1
;
const
int
i_src_width_1
=
i_src_width
-
1
;
uint32_t
*
p_src
=
(
uint32_t
*
)
p_pic
->
p
->
p_pixels
;
uint32_t
*
p_dst
=
(
uint32_t
*
)
p_pic_dst
->
p
->
p_pixels
;
uint32_t
*
p_dstendline
=
p_dst
+
(
i_dst_visible_pitch
>>
2
);
const
uint32_t
*
p_dstend
=
p_dst
+
i_dst_visible_lines
*
(
i_dst_pitch
>>
2
);
int
l
=
1
<<
(
SHIFT_SIZE
-
1
);
for
(
;
p_dst
<
p_dstend
;
p_dst
+=
(
i_dst_hidden_pitch
>>
2
),
p_dstendline
+=
(
i_dst_pitch
>>
2
),
l
+=
i_height_coef
)
{
int
k
=
1
<<
(
SHIFT_SIZE
-
1
);
uint32_t
*
p_srcl
=
p_src
+
(
__MIN
(
i_src_height_1
,
l
>>
SHIFT_SIZE
)
*
(
i_src_pitch
>>
2
));
for
(
;
p_dst
<
p_dstendline
;
p_dst
++
,
k
+=
i_width_coef
)
{
*
p_dst
=
p_srcl
[
__MIN
(
i_src_width_1
,
k
>>
SHIFT_SIZE
)];
}
}
}
...
...
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