Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
0c2466de
Commit
0c2466de
authored
12 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
vf_transpose: switch to an AVOptions-based system.
parent
ffea3b00
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/filters.texi
+14
-6
14 additions, 6 deletions
doc/filters.texi
libavfilter/vf_transpose.c
+30
-22
30 additions, 22 deletions
libavfilter/vf_transpose.c
with
44 additions
and
28 deletions
doc/filters.texi
+
14
−
6
View file @
0c2466de
...
...
@@ -2107,11 +2107,19 @@ will create 5 copies of the input video.
Transpose rows with columns in the input video and optionally flip it.
It accepts a parameter representing an integer, which can assume the
values:
This filter accepts the following options:
@table @option
@item dir
The direction of the transpose.
@end table
The direction can assume the following values:
@table @samp
@item
0
@item
cclock_flip
Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
@example
L.R L.l
...
...
@@ -2119,7 +2127,7 @@ L.R L.l
l.r R.r
@end example
@item
1
@item
clock
Rotate by 90 degrees clockwise, that is:
@example
L.R l.L
...
...
@@ -2127,7 +2135,7 @@ L.R l.L
l.r r.R
@end example
@item
2
@item
cclock
Rotate by 90 degrees counterclockwise, that is:
@example
L.R R.r
...
...
@@ -2135,7 +2143,7 @@ L.R R.r
l.r L.l
@end example
@item
3
@item
clock_flip
Rotate by 90 degrees clockwise and vertically flip, that is:
@example
L.R r.R
...
...
This diff is collapsed.
Click to expand it.
libavfilter/vf_transpose.c
+
30
−
22
View file @
0c2466de
...
...
@@ -31,38 +31,27 @@
#include
"libavutil/pixdesc.h"
#include
"libavutil/imgutils.h"
#include
"libavutil/internal.h"
#include
"libavutil/opt.h"
#include
"avfilter.h"
#include
"formats.h"
#include
"internal.h"
#include
"video.h"
enum
TransposeDir
{
TRANSPOSE_CCLOCK_FLIP
,
TRANSPOSE_CLOCK
,
TRANSPOSE_CCLOCK
,
TRANSPOSE_CLOCK_FLIP
,
};
typedef
struct
{
const
AVClass
*
class
;
int
hsub
,
vsub
;
int
pixsteps
[
4
];
/* 0 Rotate by 90 degrees counterclockwise and vflip. */
/* 1 Rotate by 90 degrees clockwise. */
/* 2 Rotate by 90 degrees counterclockwise. */
/* 3 Rotate by 90 degrees clockwise and vflip. */
int
dir
;
enum
TransposeDir
dir
;
}
TransContext
;
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
TransContext
*
trans
=
ctx
->
priv
;
trans
->
dir
=
0
;
if
(
args
)
sscanf
(
args
,
"%d"
,
&
trans
->
dir
);
if
(
trans
->
dir
<
0
||
trans
->
dir
>
3
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid value %d not between 0 and 3.
\n
"
,
trans
->
dir
);
return
AVERROR
(
EINVAL
);
}
return
0
;
}
static
int
query_formats
(
AVFilterContext
*
ctx
)
{
enum
AVPixelFormat
pix_fmts
[]
=
{
...
...
@@ -198,6 +187,25 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
ff_filter_frame
(
outlink
,
out
);
}
#define OFFSET(x) offsetof(TransContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
options
[]
=
{
{
"dir"
,
"Transpose direction"
,
OFFSET
(
dir
),
AV_OPT_TYPE_INT
,
{
.
i64
=
TRANSPOSE_CCLOCK_FLIP
},
TRANSPOSE_CCLOCK_FLIP
,
TRANSPOSE_CLOCK_FLIP
,
FLAGS
,
"dir"
},
{
"cclock_flip"
,
"counter-clockwise with vertical flip"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
TRANSPOSE_CCLOCK_FLIP
},
.
unit
=
"dir"
},
{
"clock"
,
"clockwise"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
TRANSPOSE_CLOCK
},
.
unit
=
"dir"
},
{
"cclock"
,
"counter-clockwise"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
TRANSPOSE_CCLOCK
},
.
unit
=
"dir"
},
{
"clock_flip"
,
"clockwise with vertical flip"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
TRANSPOSE_CLOCK_FLIP
},
.
unit
=
"dir"
},
{
NULL
},
};
static
const
AVClass
transpose_class
=
{
.
class_name
=
"transpose"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_transpose_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -220,8 +228,8 @@ AVFilter avfilter_vf_transpose = {
.
name
=
"transpose"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Transpose input video."
),
.
init
=
init
,
.
priv_size
=
sizeof
(
TransContext
),
.
priv_class
=
&
transpose_class
,
.
query_formats
=
query_formats
,
...
...
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