Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
9de76229
Commit
9de76229
authored
Sep 01, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/transpose: implement landscape passthrough mode
Emulate the mp=rotate passthrough mode.
parent
3b34cbce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
9 deletions
+47
-9
filters.texi
doc/filters.texi
+7
-4
version.h
libavfilter/version.h
+1
-1
vf_transpose.c
libavfilter/vf_transpose.c
+39
-4
No files found.
doc/filters.texi
View file @
9de76229
...
@@ -3454,7 +3454,7 @@ It accepts a parameter representing an integer, which can assume the
...
@@ -3454,7 +3454,7 @@ It accepts a parameter representing an integer, which can assume the
values:
values:
@table @samp
@table @samp
@item 0
@item 0
, 4
Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
@example
@example
L.R L.l
L.R L.l
...
@@ -3462,7 +3462,7 @@ L.R L.l
...
@@ -3462,7 +3462,7 @@ L.R L.l
l.r R.r
l.r R.r
@end example
@end example
@item 1
@item 1
, 5
Rotate by 90 degrees clockwise, that is:
Rotate by 90 degrees clockwise, that is:
@example
@example
L.R l.L
L.R l.L
...
@@ -3470,7 +3470,7 @@ L.R l.L
...
@@ -3470,7 +3470,7 @@ L.R l.L
l.r r.R
l.r r.R
@end example
@end example
@item 2
@item 2
, 6
Rotate by 90 degrees counterclockwise, that is:
Rotate by 90 degrees counterclockwise, that is:
@example
@example
L.R R.r
L.R R.r
...
@@ -3478,7 +3478,7 @@ L.R R.r
...
@@ -3478,7 +3478,7 @@ L.R R.r
l.r L.l
l.r L.l
@end example
@end example
@item 3
@item 3
, 7
Rotate by 90 degrees clockwise and vertically flip, that is:
Rotate by 90 degrees clockwise and vertically flip, that is:
@example
@example
L.R r.R
L.R r.R
...
@@ -3487,6 +3487,9 @@ l.r l.L
...
@@ -3487,6 +3487,9 @@ l.r l.L
@end example
@end example
@end table
@end table
For values between 4-7 transposition is only done if the input video
geometry is portrait and not landscape.
@section unsharp
@section unsharp
Sharpen or blur the input video.
Sharpen or blur the input video.
...
...
libavfilter/version.h
View file @
9de76229
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 15
#define LIBAVFILTER_VERSION_MINOR 15
#define LIBAVFILTER_VERSION_MICRO 10
2
#define LIBAVFILTER_VERSION_MICRO 10
3
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
libavfilter/vf_transpose.c
View file @
9de76229
...
@@ -45,6 +45,7 @@ typedef struct {
...
@@ -45,6 +45,7 @@ typedef struct {
/* 2 Rotate by 90 degrees counterclockwise. */
/* 2 Rotate by 90 degrees counterclockwise. */
/* 3 Rotate by 90 degrees clockwise and vflip. */
/* 3 Rotate by 90 degrees clockwise and vflip. */
int
dir
;
int
dir
;
int
passthrough
;
///< landscape passthrough mode enabled
}
TransContext
;
}
TransContext
;
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
...
@@ -55,8 +56,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
...
@@ -55,8 +56,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
if
(
args
)
if
(
args
)
sscanf
(
args
,
"%d"
,
&
trans
->
dir
);
sscanf
(
args
,
"%d"
,
&
trans
->
dir
);
if
(
trans
->
dir
<
0
||
trans
->
dir
>
3
)
{
if
(
trans
->
dir
<
0
||
trans
->
dir
>
7
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid value %d not between 0 and
3
.
\n
"
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid value %d not between 0 and
7
.
\n
"
,
trans
->
dir
);
trans
->
dir
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
...
@@ -97,6 +98,18 @@ static int config_props_output(AVFilterLink *outlink)
...
@@ -97,6 +98,18 @@ static int config_props_output(AVFilterLink *outlink)
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
const
AVPixFmtDescriptor
*
pixdesc
=
&
av_pix_fmt_descriptors
[
outlink
->
format
];
const
AVPixFmtDescriptor
*
pixdesc
=
&
av_pix_fmt_descriptors
[
outlink
->
format
];
if
(
trans
->
dir
&
4
)
{
trans
->
dir
&=
3
;
if
(
inlink
->
w
>=
inlink
->
h
)
{
trans
->
passthrough
=
1
;
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"w:%d h:%d -> w:%d h:%d (landscape passthrough mode)
\n
"
,
inlink
->
w
,
inlink
->
h
,
outlink
->
w
,
outlink
->
h
);
return
0
;
}
}
trans
->
hsub
=
av_pix_fmt_descriptors
[
inlink
->
format
].
log2_chroma_w
;
trans
->
hsub
=
av_pix_fmt_descriptors
[
inlink
->
format
].
log2_chroma_w
;
trans
->
vsub
=
av_pix_fmt_descriptors
[
inlink
->
format
].
log2_chroma_h
;
trans
->
vsub
=
av_pix_fmt_descriptors
[
inlink
->
format
].
log2_chroma_h
;
...
@@ -117,11 +130,24 @@ static int config_props_output(AVFilterLink *outlink)
...
@@ -117,11 +130,24 @@ static int config_props_output(AVFilterLink *outlink)
return
0
;
return
0
;
}
}
static
AVFilterBufferRef
*
get_video_buffer
(
AVFilterLink
*
inlink
,
int
perms
,
int
w
,
int
h
)
{
TransContext
*
trans
=
inlink
->
dst
->
priv
;
return
trans
->
passthrough
?
ff_null_get_video_buffer
(
inlink
,
perms
,
w
,
h
)
:
ff_default_get_video_buffer
(
inlink
,
perms
,
w
,
h
);
}
static
int
start_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
picref
)
static
int
start_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
picref
)
{
{
TransContext
*
trans
=
inlink
->
dst
->
priv
;
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterBufferRef
*
buf_out
;
AVFilterBufferRef
*
buf_out
;
if
(
trans
->
passthrough
)
return
ff_null_start_frame
(
inlink
,
picref
);
outlink
->
out_buf
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
out_buf
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
outlink
->
w
,
outlink
->
h
);
if
(
!
outlink
->
out_buf
)
if
(
!
outlink
->
out_buf
)
...
@@ -150,6 +176,9 @@ static int end_frame(AVFilterLink *inlink)
...
@@ -150,6 +176,9 @@ static int end_frame(AVFilterLink *inlink)
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
int
plane
,
ret
;
int
plane
,
ret
;
if
(
trans
->
passthrough
)
return
ff_null_end_frame
(
inlink
);
for
(
plane
=
0
;
outpic
->
data
[
plane
];
plane
++
)
{
for
(
plane
=
0
;
outpic
->
data
[
plane
];
plane
++
)
{
int
hsub
=
plane
==
1
||
plane
==
2
?
trans
->
hsub
:
0
;
int
hsub
=
plane
==
1
||
plane
==
2
?
trans
->
hsub
:
0
;
int
vsub
=
plane
==
1
||
plane
==
2
?
trans
->
vsub
:
0
;
int
vsub
=
plane
==
1
||
plane
==
2
?
trans
->
vsub
:
0
;
...
@@ -205,7 +234,12 @@ static int end_frame(AVFilterLink *inlink)
...
@@ -205,7 +234,12 @@ static int end_frame(AVFilterLink *inlink)
return
0
;
return
0
;
}
}
static
int
null_draw_slice
(
AVFilterLink
*
link
,
int
y
,
int
h
,
int
slice_dir
)
{
return
0
;
}
static
int
draw_slice
(
AVFilterLink
*
inlink
,
int
y
,
int
h
,
int
slice_dir
)
{
TransContext
*
trans
=
inlink
->
dst
->
priv
;
return
trans
->
passthrough
?
ff_null_draw_slice
(
inlink
,
y
,
h
,
slice_dir
)
:
0
;
}
AVFilter
avfilter_vf_transpose
=
{
AVFilter
avfilter_vf_transpose
=
{
.
name
=
"transpose"
,
.
name
=
"transpose"
,
...
@@ -218,8 +252,9 @@ AVFilter avfilter_vf_transpose = {
...
@@ -218,8 +252,9 @@ AVFilter avfilter_vf_transpose = {
.
inputs
=
(
const
AVFilterPad
[])
{{
.
name
=
"default"
,
.
inputs
=
(
const
AVFilterPad
[])
{{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
get_video_buffer
=
get_video_buffer
,
.
start_frame
=
start_frame
,
.
start_frame
=
start_frame
,
.
draw_slice
=
null_
draw_slice
,
.
draw_slice
=
draw_slice
,
.
end_frame
=
end_frame
,
.
end_frame
=
end_frame
,
.
min_perms
=
AV_PERM_READ
,
},
.
min_perms
=
AV_PERM_READ
,
},
{
.
name
=
NULL
}},
{
.
name
=
NULL
}},
...
...
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