Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
d620366f
Commit
d620366f
authored
Aug 24, 2008
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cross conversions between YUVA and RGBA. Closes #1658.
parent
744c8a72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
49 deletions
+40
-49
modules/video_filter/swscale.c
modules/video_filter/swscale.c
+40
-49
No files found.
modules/video_filter/swscale.c
View file @
d620366f
...
@@ -145,9 +145,7 @@ static int OpenScaler( vlc_object_t *p_this )
...
@@ -145,9 +145,7 @@ static int OpenScaler( vlc_object_t *p_this )
if
(
GetParameters
(
NULL
,
if
(
GetParameters
(
NULL
,
&
p_filter
->
fmt_in
.
video
,
&
p_filter
->
fmt_in
.
video
,
&
p_filter
->
fmt_out
.
video
,
0
)
)
&
p_filter
->
fmt_out
.
video
,
0
)
)
{
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
/* */
/* */
p_filter
->
pf_video_filter
=
Filter
;
p_filter
->
pf_video_filter
=
Filter
;
...
@@ -261,16 +259,16 @@ static int GetParameters( ScalerConfiguration *p_cfg,
...
@@ -261,16 +259,16 @@ static int GetParameters( ScalerConfiguration *p_cfg,
const
video_format_t
*
p_fmto
,
const
video_format_t
*
p_fmto
,
int
i_sws_flags_default
)
int
i_sws_flags_default
)
{
{
int
i_fmti
;
int
i_fmti
=
-
1
;
int
i_fmto
;
int
i_fmto
=
-
1
;
if
(
GetFfmpegChroma
(
&
i_fmti
,
*
p_fmti
)
!=
VLC_SUCCESS
||
GetFfmpegChroma
(
&
i_fmto
,
*
p_fmto
)
!=
VLC_SUCCESS
)
return
VLC_EGENERIC
;
bool
b_has_a
=
false
;
bool
b_has_a
i
=
false
;
bool
b_
add_a
=
false
;
bool
b_
has_ao
=
false
;
int
i_sws_flags
=
i_sws_flags_default
;
int
i_sws_flags
=
i_sws_flags_default
;
GetFfmpegChroma
(
&
i_fmti
,
*
p_fmti
);
GetFfmpegChroma
(
&
i_fmto
,
*
p_fmto
);
if
(
p_fmti
->
i_chroma
==
p_fmto
->
i_chroma
)
if
(
p_fmti
->
i_chroma
==
p_fmto
->
i_chroma
)
{
{
if
(
p_fmti
->
i_chroma
==
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'P'
)
&&
ALLOW_YUVP
)
if
(
p_fmti
->
i_chroma
==
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'P'
)
&&
ALLOW_YUVP
)
...
@@ -278,41 +276,36 @@ static int GetParameters( ScalerConfiguration *p_cfg,
...
@@ -278,41 +276,36 @@ static int GetParameters( ScalerConfiguration *p_cfg,
i_fmti
=
i_fmto
=
PIX_FMT_GRAY8
;
i_fmti
=
i_fmto
=
PIX_FMT_GRAY8
;
i_sws_flags
=
SWS_POINT
;
i_sws_flags
=
SWS_POINT
;
}
}
else
if
(
p_fmti
->
i_chroma
==
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
)
)
}
if
(
p_fmti
->
i_chroma
==
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
)
)
{
{
i_fmti
=
i_fmto
=
PIX_FMT_YUV444P
;
i_fmti
=
PIX_FMT_YUV444P
;
b_has_a
=
true
;
b_has_ai
=
true
;
}
}
else
if
(
p_fmti
->
i_chroma
==
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
else
if
(
p_fmti
->
i_chroma
==
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
{
{
i_fmti
=
i_fmto
=
PIX_FMT_RGBA32
;
i_fmti
=
PIX_FMT_RGBA32
;
b_has_a
=
true
;
b_has_ai
=
true
;
}
}
}
if
(
i_fmti
>=
0
&&
i_fmto
<
0
)
if
(
p_fmto
->
i_chroma
==
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
)
)
{
/* Special case: injecting dummy alpha plane */
switch
(
p_fmto
->
i_chroma
)
{
{
case
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
):
i_fmto
=
PIX_FMT_YUV444P
;
i_fmto
=
PIX_FMT_YUV444P
;
b_add_a
=
true
;
b_has_ao
=
true
;
break
;
case
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
):
i_fmto
=
PIX_FMT_RGBA32
;
b_add_a
=
true
;
break
;
default:
break
;
}
}
else
if
(
p_fmto
->
i_chroma
==
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
{
i_fmti
=
PIX_FMT_RGBA32
;
b_has_ao
=
true
;
}
}
if
(
p_cfg
)
if
(
p_cfg
)
{
{
p_cfg
->
i_fmti
=
i_fmti
;
p_cfg
->
i_fmti
=
i_fmti
;
p_cfg
->
i_fmto
=
i_fmto
;
p_cfg
->
i_fmto
=
i_fmto
;
p_cfg
->
b_has_a
=
b_has_a
;
p_cfg
->
b_has_a
=
b_has_a
i
&&
b_has_ao
;
p_cfg
->
b_add_a
=
b_add_a
;
p_cfg
->
b_add_a
=
(
!
b_has_ai
)
&&
b_has_ao
;
p_cfg
->
i_sws_flags
=
i_sws_flags
;
p_cfg
->
i_sws_flags
=
i_sws_flags
;
}
}
...
@@ -551,20 +544,18 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -551,20 +544,18 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
Convert
(
p_sys
->
ctx
,
p_dst
,
p_src
,
p_fmti
->
i_height
,
0
,
3
);
Convert
(
p_sys
->
ctx
,
p_dst
,
p_src
,
p_fmti
->
i_height
,
0
,
3
);
if
(
p_sys
->
ctxA
)
if
(
p_sys
->
ctxA
)
{
if
(
p_fmto
->
i_chroma
==
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
{
{
/* We extract the A plane to rescale it, and then we reinject it. */
/* We extract the A plane to rescale it, and then we reinject it. */
if
(
p_fmti
->
i_chroma
==
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
ExtractA
(
p_sys
->
p_src_a
,
p_src
,
p_fmti
->
i_width
*
p_sys
->
i_extend_factor
,
p_fmti
->
i_height
);
ExtractA
(
p_sys
->
p_src_a
,
p_src
,
p_fmti
->
i_width
*
p_sys
->
i_extend_factor
,
p_fmti
->
i_height
);
else
plane_CopyPixels
(
p_sys
->
p_src_a
->
p
,
p_src
->
p
+
A_PLANE
);
Convert
(
p_sys
->
ctxA
,
p_sys
->
p_dst_a
,
p_sys
->
p_src_a
,
p_fmti
->
i_height
,
0
,
1
);
Convert
(
p_sys
->
ctxA
,
p_sys
->
p_dst_a
,
p_sys
->
p_src_a
,
p_fmti
->
i_height
,
0
,
1
);
if
(
p_fmto
->
i_chroma
==
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
InjectA
(
p_dst
,
p_sys
->
p_dst_a
,
p_fmto
->
i_width
*
p_sys
->
i_extend_factor
,
p_fmto
->
i_height
);
InjectA
(
p_dst
,
p_sys
->
p_dst_a
,
p_fmto
->
i_width
*
p_sys
->
i_extend_factor
,
p_fmto
->
i_height
);
}
else
else
{
plane_CopyPixels
(
p_dst
->
p
+
A_PLANE
,
p_sys
->
p_dst_a
->
p
);
Convert
(
p_sys
->
ctxA
,
p_dst
,
p_src
,
p_fmti
->
i_height
,
3
,
1
);
}
}
}
else
if
(
p_sys
->
b_add_a
)
else
if
(
p_sys
->
b_add_a
)
{
{
...
...
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