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
10af2bf6
Commit
10af2bf6
authored
Jan 01, 2013
by
Timo Rothenpieler
Committed by
Rafaël Carré
Jan 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vaapi: Use vaDeriveImage instead of vaGetImage if available
Signed-off-by:
Rafaël Carré
<
funman@videolan.org
>
parent
10d7463d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
8 deletions
+38
-8
modules/codec/avcodec/vaapi.c
modules/codec/avcodec/vaapi.c
+38
-8
No files found.
modules/codec/avcodec/vaapi.c
View file @
10af2bf6
...
...
@@ -86,6 +86,7 @@ struct vlc_va_sys_t
VAImage
image
;
copy_cache_t
image_cache
;
bool
b_supports_derive
;
};
/* */
...
...
@@ -199,6 +200,8 @@ static int Open( vlc_va_t *p_external, int i_codec_id )
p_va
->
i_surface_count
=
i_surface_count
;
p_va
->
b_supports_derive
=
false
;
if
(
asprintf
(
&
p_external
->
description
,
"VA API version %d.%d"
,
p_va
->
i_version_major
,
p_va
->
i_version_minor
)
<
0
)
p_external
->
description
=
NULL
;
...
...
@@ -217,6 +220,10 @@ static void DestroySurfaces( vlc_va_sys_t *p_va )
CopyCleanCache
(
&
p_va
->
image_cache
);
vaDestroyImage
(
p_va
->
p_display
,
p_va
->
image
.
image_id
);
}
else
if
(
p_va
->
b_supports_derive
)
{
CopyCleanCache
(
&
p_va
->
image_cache
);
}
if
(
p_va
->
i_context_id
!=
VA_INVALID_ID
)
vaDestroyContext
(
p_va
->
p_display
,
p_va
->
i_context_id
);
...
...
@@ -289,6 +296,13 @@ static int CreateSurfaces( vlc_va_sys_t *p_va, void **pp_hw_ctx, vlc_fourcc_t *p
goto
error
;
}
VAImage
test_image
;
if
(
vaDeriveImage
(
p_va
->
p_display
,
pi_surface_id
[
0
],
&
test_image
)
==
VA_STATUS_SUCCESS
)
{
p_va
->
b_supports_derive
=
true
;
vaDestroyImage
(
p_va
->
p_display
,
test_image
.
image_id
);
}
vlc_fourcc_t
i_chroma
=
0
;
VAImageFormat
fmt
;
for
(
int
i
=
0
;
i
<
i_fmt_count
;
i
++
)
...
...
@@ -322,6 +336,12 @@ static int CreateSurfaces( vlc_va_sys_t *p_va, void **pp_hw_ctx, vlc_fourcc_t *p
goto
error
;
*
pi_chroma
=
i_chroma
;
if
(
p_va
->
b_supports_derive
)
{
vaDestroyImage
(
p_va
->
p_display
,
p_va
->
image
.
image_id
);
p_va
->
image
.
image_id
=
VA_INVALID_ID
;
}
if
(
unlikely
(
CopyInitCache
(
&
p_va
->
image_cache
,
i_width
))
)
goto
error
;
...
...
@@ -380,14 +400,18 @@ static int Extract( vlc_va_t *p_external, picture_t *p_picture, AVFrame *p_ff )
#endif
return
VLC_EGENERIC
;
/* XXX vaDeriveImage may be better but it is not supported by
* my setup.
*/
if
(
p_va
->
b_supports_derive
)
{
if
(
vaDeriveImage
(
p_va
->
p_display
,
i_surface_id
,
&
(
p_va
->
image
))
!=
VA_STATUS_SUCCESS
)
return
VLC_EGENERIC
;
}
else
{
if
(
vaGetImage
(
p_va
->
p_display
,
i_surface_id
,
0
,
0
,
p_va
->
i_surface_width
,
p_va
->
i_surface_height
,
p_va
->
image
.
image_id
)
)
return
VLC_EGENERIC
;
}
void
*
p_base
;
if
(
vaMapBuffer
(
p_va
->
p_display
,
p_va
->
image
.
buf
,
&
p_base
)
)
...
...
@@ -432,6 +456,12 @@ static int Extract( vlc_va_t *p_external, picture_t *p_picture, AVFrame *p_ff )
if
(
vaUnmapBuffer
(
p_va
->
p_display
,
p_va
->
image
.
buf
)
)
return
VLC_EGENERIC
;
if
(
p_va
->
b_supports_derive
)
{
vaDestroyImage
(
p_va
->
p_display
,
p_va
->
image
.
image_id
);
p_va
->
image
.
image_id
=
VA_INVALID_ID
;
}
return
VLC_SUCCESS
;
}
static
int
Get
(
vlc_va_t
*
p_external
,
AVFrame
*
p_ff
)
...
...
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