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
1e928298
Commit
1e928298
authored
Jul 01, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vda: use I420 instead of UYVY
parent
5097a477
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
26 deletions
+33
-26
modules/codec/avcodec/va.c
modules/codec/avcodec/va.c
+1
-2
modules/codec/avcodec/vda.c
modules/codec/avcodec/vda.c
+32
-24
No files found.
modules/codec/avcodec/va.c
View file @
1e928298
...
@@ -49,8 +49,7 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt)
...
@@ -49,8 +49,7 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt)
#endif
#endif
#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(53, 14, 0))
#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(53, 14, 0))
case
AV_PIX_FMT_VDA
:
case
AV_PIX_FMT_VDA
:
case
AV_PIX_FMT_VDA_VLD
:
return
VLC_CODEC_I420
;
return
VLC_CODEC_UYVY
;
#endif
#endif
#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 4, 0))
#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 4, 0))
case
AV_PIX_FMT_VDPAU
:
case
AV_PIX_FMT_VDPAU
:
...
...
modules/codec/avcodec/vda.c
View file @
1e928298
...
@@ -53,31 +53,27 @@ static int Get( vlc_va_t *, picture_t *, uint8_t ** );
...
@@ -53,31 +53,27 @@ static int Get( vlc_va_t *, picture_t *, uint8_t ** );
static
int
Extract
(
vlc_va_t
*
,
picture_t
*
,
uint8_t
*
);
static
int
Extract
(
vlc_va_t
*
,
picture_t
*
,
uint8_t
*
);
static
void
Release
(
void
*
opaque
,
uint8_t
*
data
);
static
void
Release
(
void
*
opaque
,
uint8_t
*
data
);
static
void
vda_Copy422YpCbCr8
(
picture_t
*
p_pic
,
static
void
copy420YpCbCr8Planar
(
picture_t
*
p_pic
,
CVPixelBufferRef
buffer
)
CVPixelBufferRef
buffer
,
unsigned
i_width
,
unsigned
i_height
)
{
{
int
i_dst_stride
,
i_src_stride
;
uint8_t
*
pp_plane
[
2
]
;
uint8_t
*
p_dst
,
*
p_src
;
size_t
pi_pitch
[
2
]
;
CVPixelBufferLockBaseAddress
(
buffer
,
0
);
if
(
!
buffer
)
return
;
for
(
int
i_plane
=
0
;
i_plane
<
p_pic
->
i_planes
;
i_plane
++
)
CVPixelBufferLockBaseAddress
(
buffer
,
0
);
{
p_dst
=
p_pic
->
p
[
i_plane
].
p_pixels
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
p_src
=
CVPixelBufferGetBaseAddressOfPlane
(
buffer
,
i_plane
);
pp_plane
[
i
]
=
CVPixelBufferGetBaseAddressOfPlane
(
buffer
,
i
);
i_dst_stride
=
p_pic
->
p
[
i_plane
].
i_pitch
;
pi_pitch
[
i
]
=
CVPixelBufferGetBytesPerRowOfPlane
(
buffer
,
i
);
i_src_stride
=
CVPixelBufferGetBytesPerRowOfPlane
(
buffer
,
i_plane
);
for
(
int
i_line
=
0
;
i_line
<
p_pic
->
p
[
i_plane
].
i_visible_lines
;
i_line
++
)
{
memcpy
(
p_dst
,
p_src
,
i_src_stride
);
p_src
+=
i_src_stride
;
p_dst
+=
i_dst_stride
;
}
}
}
CVPixelBufferUnlockBaseAddress
(
buffer
,
0
);
CopyFromNv12ToI420
(
p_pic
,
pp_plane
,
pi_pitch
,
i_width
,
i_height
);
CVPixelBufferUnlockBaseAddress
(
buffer
,
0
);
}
}
vlc_module_begin
()
vlc_module_begin
()
...
@@ -91,7 +87,9 @@ vlc_module_end ()
...
@@ -91,7 +87,9 @@ vlc_module_end ()
struct
vlc_va_sys_t
struct
vlc_va_sys_t
{
{
struct
vda_context
hw_ctx
;
AVVDAContext
*
vdactx
;
int
i_width
;
int
i_height
;
};
};
static
int
Open
(
vlc_va_t
*
va
,
static
int
Open
(
vlc_va_t
*
va
,
...
@@ -146,6 +144,11 @@ static int Open(vlc_va_t *va,
...
@@ -146,6 +144,11 @@ static int Open(vlc_va_t *va,
if
(
unlikely
(
sys
==
NULL
))
if
(
unlikely
(
sys
==
NULL
))
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
sys
->
vdactx
=
av_vda_alloc_context
();
sys
->
vdactx
->
cv_pix_fmt_type
=
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
;
sys
->
i_width
=
avctx
->
width
;
sys
->
i_height
=
avctx
->
height
;
va
->
sys
=
sys
;
va
->
sys
=
sys
;
va
->
description
=
(
char
*
)
"VDA"
;
va
->
description
=
(
char
*
)
"VDA"
;
va
->
setup
=
Setup
;
va
->
setup
=
Setup
;
...
@@ -164,14 +167,17 @@ static void Close( vlc_va_t *va, AVCodecContext *avctx )
...
@@ -164,14 +167,17 @@ static void Close( vlc_va_t *va, AVCodecContext *avctx )
static
int
Setup
(
vlc_va_t
*
va
,
AVCodecContext
*
avctx
,
vlc_fourcc_t
*
pi_chroma
)
static
int
Setup
(
vlc_va_t
*
va
,
AVCodecContext
*
avctx
,
vlc_fourcc_t
*
pi_chroma
)
{
{
int
i_ret
=
av_vda_default_init
(
avctx
);
vlc_va_sys_t
*
sys
=
va
->
sys
;
int
i_ret
=
av_vda_default_init2
(
avctx
,
sys
->
vdactx
);
msg_Dbg
(
va
,
"Creating VDA decoder %i"
,
i_ret
);
msg_Dbg
(
va
,
"Creating VDA decoder %i"
,
i_ret
);
if
(
i_ret
!=
0
)
if
(
i_ret
!=
0
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
*
pi_chroma
=
VLC_CODEC_
UYVY
;
*
pi_chroma
=
VLC_CODEC_
I420
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -194,6 +200,8 @@ static void Release( void *opaque, uint8_t *data )
...
@@ -194,6 +200,8 @@ static void Release( void *opaque, uint8_t *data )
static
int
Extract
(
vlc_va_t
*
va
,
picture_t
*
p_picture
,
uint8_t
*
data
)
static
int
Extract
(
vlc_va_t
*
va
,
picture_t
*
p_picture
,
uint8_t
*
data
)
{
{
vlc_va_sys_t
*
sys
=
va
->
sys
;
CVPixelBufferRef
cv_buffer
=
(
CVPixelBufferRef
)
data
;
CVPixelBufferRef
cv_buffer
=
(
CVPixelBufferRef
)
data
;
if
(
!
cv_buffer
)
if
(
!
cv_buffer
)
...
@@ -207,7 +215,7 @@ static int Extract( vlc_va_t *va, picture_t *p_picture, uint8_t *data )
...
@@ -207,7 +215,7 @@ static int Extract( vlc_va_t *va, picture_t *p_picture, uint8_t *data )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
vda_Copy422YpCbCr8
(
p_picture
,
cv_buffer
);
copy420YpCbCr8Planar
(
p_picture
,
cv_buffer
,
sys
->
i_width
,
sys
->
i_height
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
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