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
38d8ef17
Commit
38d8ef17
authored
Jun 11, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codec/avcodec/vaapi_x11.c: Implement CopyPalette().
Create a palette for a VAImage when our region picture has one.
parent
2646cc96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
modules/codec/avcodec/vaapi_x11.c
modules/codec/avcodec/vaapi_x11.c
+49
-0
No files found.
modules/codec/avcodec/vaapi_x11.c
View file @
38d8ef17
...
...
@@ -30,6 +30,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_es.h>
#include <vlc_picture.h>
#include <vlc_vout_display.h>
#include <vlc_vout_window.h>
...
...
@@ -647,6 +648,48 @@ static VAStatus SubpictureUnlink( vlc_va_conn_t *p_connection, VASurfaceID surfa
return
status
;
}
static
void
CopyPalette
(
vout_display_t
*
vd
,
VAImage
*
image
,
video_palette_t
*
p_palette
)
{
vout_display_sys_t
*
sys
=
vd
->
sys
;
/* vaSetImagePalette
* pointer to an array holding the palette data. The size of the array is
* num_palette_entries * entry_bytes in size. The order of the components
* in the palette is described by the component_order in VAImage struct
*/
uint8_t
*
palette
=
(
uint8_t
*
)
calloc
(
p_palette
->
i_entries
,
4
*
sizeof
(
uint8_t
));
if
(
!
palette
)
return
;
#define RED 0
#define BLUE 1
#define GREEN 2
#define ALPHA 3
int
entries
;
for
(
entries
=
0
;
entries
<
p_palette
->
i_entries
;
entries
++
)
{
palette
[
RED
]
=
p_palette
->
palette
[
entries
][
RED
];
palette
[
BLUE
]
=
p_palette
->
palette
[
entries
][
BLUE
];
palette
[
GREEN
]
=
p_palette
->
palette
[
entries
][
GREEN
];
palette
[
ALPHA
]
=
p_palette
->
palette
[
entries
][
ALPHA
];
palette
=
palette
+
4
;
}
#undef RED
#undef BLUE
#undef GREEN
#undef ALPHA
image
->
num_palette_entries
=
entries
;
image
->
entry_bytes
=
4
;
/* RGBA has 4 components */
VAStatus
status
=
vaSetImagePalette
(
sys
->
conn
->
p_display
,
image
->
image_id
,
(
unsigned
char
*
)
palette
);
if
(
status
!=
VA_STATUS_SUCCESS
)
msg_Err
(
vd
,
"failed setting palette. (%d)"
,
status
);
}
static
int
CopyPictureToVAImage
(
vout_display_t
*
vd
,
picture_t
*
pic
,
VAImage
*
image
,
VAImageFormat
*
fmt
)
{
...
...
@@ -770,6 +813,12 @@ static int RenderDirectSubpicture(vout_display_t *vd, picture_t *picture, subpic
image
->
format
.
blue_mask
=
region
->
p_picture
->
format
.
i_bmask
;
image
->
format
.
green_mask
=
region
->
p_picture
->
format
.
i_gmask
;
image
->
num_palette_entries
=
0
;
image
->
entry_bytes
=
0
;
if
(
region
->
p_picture
->
format
.
p_palette
)
CopyPalette
(
vd
,
image
,
region
->
p_picture
->
format
.
p_palette
);
/* Create Subpicture */
vasub_cache
->
i_id
=
SubpictureCreate
(
vd
,
subpicture
,
region
,
image
,
sys
->
sflags
);
...
...
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