Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
455
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
485f4173
Commit
485f4173
authored
7 years ago
by
Thomas Guillem
Browse files
Options
Downloads
Patches
Plain Diff
chroma: i420_nv12: handle more conversions using copy helper
parent
41b390e2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/video_chroma/i420_nv12.c
+92
-7
92 additions, 7 deletions
modules/video_chroma/i420_nv12.c
with
92 additions
and
7 deletions
modules/video_chroma/i420_nv12.c
+
92
−
7
View file @
485f4173
...
...
@@ -78,9 +78,62 @@ static void YV12_NV12( filter_t *p_filter, picture_t *p_src,
I420_NV12
(
p_filter
,
p_src
,
p_dst
);
}
static
void
NV12_I420
(
filter_t
*
p_filter
,
picture_t
*
p_src
,
picture_t
*
p_dst
)
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
p_dst
->
format
.
i_x_offset
=
p_src
->
format
.
i_x_offset
;
p_dst
->
format
.
i_y_offset
=
p_src
->
format
.
i_y_offset
;
const
size_t
pitches
[]
=
GET_PITCHES
(
p_src
);
const
uint8_t
*
planes
[]
=
GET_PLANES
(
p_src
);
Copy420_SP_to_P
(
p_dst
,
planes
,
pitches
,
p_src
->
format
.
i_y_offset
+
p_src
->
format
.
i_visible_height
,
&
p_sys
->
cache
);
}
static
void
NV12_YV12
(
filter_t
*
p_filter
,
picture_t
*
p_src
,
picture_t
*
p_dst
)
{
NV12_I420
(
p_filter
,
p_src
,
p_dst
);
picture_SwapUV
(
p_dst
);
}
static
void
I42010B_P010
(
filter_t
*
p_filter
,
picture_t
*
p_src
,
picture_t
*
p_dst
)
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
p_dst
->
format
.
i_x_offset
=
p_src
->
format
.
i_x_offset
;
p_dst
->
format
.
i_y_offset
=
p_src
->
format
.
i_y_offset
;
const
size_t
pitches
[]
=
GET_PITCHES
(
p_src
);
const
uint8_t
*
planes
[]
=
GET_PLANES
(
p_src
);
Copy420_16_P_to_SP
(
p_dst
,
planes
,
pitches
,
p_src
->
format
.
i_y_offset
+
p_src
->
format
.
i_visible_height
,
-
6
,
&
p_sys
->
cache
);
}
static
void
P010_I42010B
(
filter_t
*
p_filter
,
picture_t
*
p_src
,
picture_t
*
p_dst
)
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
p_dst
->
format
.
i_x_offset
=
p_src
->
format
.
i_x_offset
;
p_dst
->
format
.
i_y_offset
=
p_src
->
format
.
i_y_offset
;
const
size_t
pitches
[]
=
GET_PITCHES
(
p_src
);
const
uint8_t
*
planes
[]
=
GET_PLANES
(
p_src
);
Copy420_16_SP_to_P
(
p_dst
,
planes
,
pitches
,
p_src
->
format
.
i_y_offset
+
p_src
->
format
.
i_visible_height
,
6
,
&
p_sys
->
cache
);
}
/* Following functions are local */
VIDEO_FILTER_WRAPPER
(
I420_NV12
)
VIDEO_FILTER_WRAPPER
(
YV12_NV12
)
VIDEO_FILTER_WRAPPER
(
NV12_I420
)
VIDEO_FILTER_WRAPPER
(
NV12_YV12
)
VIDEO_FILTER_WRAPPER
(
I42010B_P010
)
VIDEO_FILTER_WRAPPER
(
P010_I42010B
)
/*****************************************************************************
* Create: allocate a chroma function
...
...
@@ -91,15 +144,11 @@ static int Create( vlc_object_t *p_this )
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
if
(
p_filter
->
fmt_out
.
video
.
i_chroma
!=
VLC_CODEC_NV12
)
return
-
1
;
/* video must be even, because 4:2:0 is subsampled by 2 in both ways */
if
(
p_filter
->
fmt_in
.
video
.
i_width
&
1
||
p_filter
->
fmt_in
.
video
.
i_height
&
1
)
{
return
-
1
;
}
/* resizing not supported */
if
(
p_filter
->
fmt_in
.
video
.
i_x_offset
+
p_filter
->
fmt_in
.
video
.
i_visible_width
!=
...
...
@@ -109,16 +158,52 @@ static int Create( vlc_object_t *p_this )
||
p_filter
->
fmt_in
.
video
.
orientation
!=
p_filter
->
fmt_out
.
video
.
orientation
)
return
-
1
;
switch
(
p_filter
->
fmt_in
.
video
.
i_chroma
)
vlc_fourcc_t
infcc
=
p_filter
->
fmt_in
.
video
.
i_chroma
;
vlc_fourcc_t
outfcc
=
p_filter
->
fmt_out
.
video
.
i_chroma
;
uint8_t
pixel_bytes
=
1
;
switch
(
infcc
)
{
case
VLC_CODEC_I420
:
case
VLC_CODEC_J420
:
if
(
outfcc
!=
VLC_CODEC_NV12
)
return
-
1
;
p_filter
->
pf_video_filter
=
I420_NV12_Filter
;
break
;
case
VLC_CODEC_YV12
:
if
(
outfcc
!=
VLC_CODEC_NV12
)
return
-
1
;
p_filter
->
pf_video_filter
=
YV12_NV12_Filter
;
break
;
case
VLC_CODEC_NV12
:
switch
(
outfcc
)
{
case
VLC_CODEC_I420
:
case
VLC_CODEC_J420
:
p_filter
->
pf_video_filter
=
NV12_I420_Filter
;
break
;
case
VLC_CODEC_YV12
:
p_filter
->
pf_video_filter
=
NV12_YV12_Filter
;
break
;
default:
return
-
1
;
}
break
;
case
VLC_CODEC_I420_10L
:
if
(
outfcc
!=
VLC_CODEC_P010
)
return
-
1
;
pixel_bytes
=
2
;
p_filter
->
pf_video_filter
=
I42010B_P010_Filter
;
break
;
case
VLC_CODEC_P010
:
if
(
outfcc
!=
VLC_CODEC_I420_10L
)
return
-
1
;
pixel_bytes
=
2
;
p_filter
->
pf_video_filter
=
P010_I42010B_Filter
;
break
;
default:
return
-
1
;
...
...
@@ -129,8 +214,8 @@ static int Create( vlc_object_t *p_this )
if
(
!
p_sys
)
return
VLC_ENOMEM
;
CopyInitCache
(
&
p_sys
->
cache
,
p_filter
->
fmt_in
.
video
.
i_x_offset
+
p_filter
->
fmt_in
.
video
.
i_visible_width
);
CopyInitCache
(
&
p_sys
->
cache
,
(
p_filter
->
fmt_in
.
video
.
i_x_offset
+
p_filter
->
fmt_in
.
video
.
i_visible_width
)
*
pixel_bytes
);
p_filter
->
p_sys
=
p_sys
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment