Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
28c10c83
Commit
28c10c83
authored
Mar 08, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/codec/ffmpeg/video_filter.c: a few fixes and cleanup.
parent
739d192a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
28 deletions
+39
-28
modules/codec/ffmpeg/video_filter.c
modules/codec/ffmpeg/video_filter.c
+39
-28
No files found.
modules/codec/ffmpeg/video_filter.c
View file @
28c10c83
...
...
@@ -50,6 +50,7 @@ struct filter_sys_t
{
vlc_bool_t
b_resize
;
vlc_bool_t
b_convert
;
vlc_bool_t
b_resize_first
;
es_format_t
fmt_in
;
int
i_src_ffmpeg_chroma
;
...
...
@@ -98,7 +99,6 @@ int E_(OpenFilter)( vlc_object_t *p_this )
/* Misc init */
p_sys
->
p_rsc
=
NULL
;
p_sys
->
b_convert
=
b_convert
;
p_sys
->
i_src_ffmpeg_chroma
=
E_
(
GetFfmpegChroma
)(
p_filter
->
fmt_in
.
video
.
i_chroma
);
p_sys
->
i_dst_ffmpeg_chroma
=
...
...
@@ -107,31 +107,17 @@ int E_(OpenFilter)( vlc_object_t *p_this )
es_format_Init
(
&
p_sys
->
fmt_in
,
0
,
0
);
es_format_Init
(
&
p_sys
->
fmt_out
,
0
,
0
);
/* Dummy alloc, will be reallocated in CheckInit */
avpicture_alloc
(
&
p_sys
->
tmp_pic
,
p_sys
->
i_src_ffmpeg_chroma
,
p_filter
->
fmt_out
.
video
.
i_width
,
p_filter
->
fmt_out
.
video
.
i_height
);
if
(
CheckInit
(
p_filter
)
!=
VLC_SUCCESS
)
{
free
(
p_sys
);
return
VLC_EGENERIC
;
}
if
(
p_sys
->
b_resize
&&
p_sys
->
b_convert
)
{
if
(
p_filter
->
fmt_in
.
video
.
i_width
*
p_filter
->
fmt_in
.
video
.
i_height
>
p_filter
->
fmt_out
.
video
.
i_width
*
p_filter
->
fmt_out
.
video
.
i_height
)
{
/* Resizing then conversion */
avpicture_alloc
(
&
p_sys
->
tmp_pic
,
p_sys
->
i_src_ffmpeg_chroma
,
p_filter
->
fmt_out
.
video
.
i_width
,
p_filter
->
fmt_out
.
video
.
i_height
);
}
else
{
/* Conversion then resizing */
avpicture_alloc
(
&
p_sys
->
tmp_pic
,
p_sys
->
i_dst_ffmpeg_chroma
,
p_filter
->
fmt_in
.
video
.
i_width
,
p_filter
->
fmt_in
.
video
.
i_height
);
}
}
msg_Dbg
(
p_filter
,
"input: %ix%i %4.4s -> %ix%i %4.4s"
,
p_filter
->
fmt_in
.
video
.
i_width
,
p_filter
->
fmt_in
.
video
.
i_height
,
(
char
*
)
&
p_filter
->
fmt_in
.
video
.
i_chroma
,
...
...
@@ -174,10 +160,21 @@ static int CheckInit( filter_t *p_filter )
if
(
p_sys
->
p_rsc
)
img_resample_close
(
p_sys
->
p_rsc
);
p_sys
->
p_rsc
=
0
;
p_sys
->
b_convert
=
p_filter
->
fmt_in
.
video
.
i_chroma
!=
p_filter
->
fmt_out
.
video
.
i_chroma
;
p_sys
->
b_resize
=
p_filter
->
fmt_in
.
video
.
i_width
!=
p_filter
->
fmt_out
.
video
.
i_width
||
p_filter
->
fmt_in
.
video
.
i_height
!=
p_filter
->
fmt_out
.
video
.
i_height
;
p_sys
->
b_resize_first
=
p_filter
->
fmt_in
.
video
.
i_width
*
p_filter
->
fmt_in
.
video
.
i_height
>
p_filter
->
fmt_out
.
video
.
i_width
*
p_filter
->
fmt_out
.
video
.
i_height
;
if
(
E_
(
GetFfmpegChroma
)(
p_filter
->
fmt_in
.
video
.
i_chroma
)
!=
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
)
)
p_sys
->
b_resize_first
=
VLC_FALSE
;
if
(
p_sys
->
b_resize
)
{
p_sys
->
p_rsc
=
img_resample_init
(
p_filter
->
fmt_out
.
video
.
i_width
,
...
...
@@ -192,6 +189,23 @@ static int CheckInit( filter_t *p_filter )
}
}
avpicture_free
(
&
p_sys
->
tmp_pic
);
if
(
p_sys
->
b_resize_first
)
{
/* Resizing then conversion */
avpicture_alloc
(
&
p_sys
->
tmp_pic
,
p_sys
->
i_src_ffmpeg_chroma
,
p_filter
->
fmt_out
.
video
.
i_width
,
p_filter
->
fmt_out
.
video
.
i_height
);
}
else
{
/* Conversion then resizing */
avpicture_alloc
(
&
p_sys
->
tmp_pic
,
p_sys
->
i_dst_ffmpeg_chroma
,
p_filter
->
fmt_in
.
video
.
i_width
,
p_filter
->
fmt_in
.
video
.
i_height
);
}
p_sys
->
fmt_in
=
p_filter
->
fmt_in
;
p_sys
->
fmt_out
=
p_filter
->
fmt_out
;
}
...
...
@@ -208,7 +222,6 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_pic )
AVPicture
src_pic
,
dest_pic
,
inter_pic
;
AVPicture
*
p_src
,
*
p_dst
;
picture_t
*
p_pic_dst
;
vlc_bool_t
b_resize
=
p_sys
->
b_resize
;
int
i
;
/* Check if format properties changed */
...
...
@@ -256,15 +269,13 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_pic )
p_src
=
&
src_pic
;
if
(
b_resize
&&
p_sys
->
p_rsc
)
if
(
p_sys
->
b_resize
&&
p_sys
->
p_rsc
)
{
p_dst
=
&
dest_pic
;
if
(
p_filter
->
fmt_in
.
video
.
i_width
*
p_filter
->
fmt_in
.
video
.
i_height
>
p_filter
->
fmt_out
.
video
.
i_width
*
p_filter
->
fmt_out
.
video
.
i_height
)
if
(
p_sys
->
b_resize_first
)
{
if
(
p_sys
->
b_convert
)
p_dst
=
&
p_sys
->
tmp_pic
;
if
(
p_sys
->
b_convert
)
p_dst
=
&
p_sys
->
tmp_pic
;
img_resample
(
p_sys
->
p_rsc
,
p_dst
,
p_src
);
b_resize
=
VLC_FALSE
;
p_src
=
p_dst
;
}
}
...
...
@@ -273,7 +284,7 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_pic )
{
video_format_t
*
p_fmt
=
&
p_filter
->
fmt_out
.
video
;
p_dst
=
&
dest_pic
;
if
(
b_resize
)
if
(
p_sys
->
b_resize
&&
!
p_sys
->
b_resize_first
)
{
p_dst
=
&
p_sys
->
tmp_pic
;
p_fmt
=
&
p_filter
->
fmt_in
.
video
;
...
...
@@ -286,7 +297,7 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_pic )
p_src
=
p_dst
;
}
if
(
b_resize
&&
p_sys
->
p_rsc
)
if
(
p_sys
->
b_resize
&&
!
p_sys
->
b_resize_first
&&
p_sys
->
p_rsc
)
{
p_dst
=
&
dest_pic
;
img_resample
(
p_sys
->
p_rsc
,
p_dst
,
p_src
);
...
...
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