Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
eb7e7e82
Commit
eb7e7e82
authored
Nov 28, 2012
by
Anton Khirnov
Committed by
Michael Niedermayer
Nov 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_hflip: switch to filter_frame
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
dabb993c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
26 deletions
+23
-26
vf_hflip.c
libavfilter/vf_hflip.c
+23
-26
No files found.
libavfilter/vf_hflip.c
View file @
eb7e7e82
...
...
@@ -86,37 +86,34 @@ static int config_props(AVFilterLink *inlink)
return
0
;
}
static
int
start_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
picref
)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
in
)
{
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterContext
*
ctx
=
inlink
->
dst
;
FlipContext
*
flip
=
ctx
->
priv
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFilterBufferRef
*
out
;
uint8_t
*
inrow
,
*
outrow
;
int
i
,
j
,
plane
,
step
,
hsub
,
vsub
;
outlink
->
out_buf
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
avfilter_copy_buffer_ref_props
(
outlink
->
out_buf
,
picref
);
out
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
if
(
!
out
)
{
avfilter_unref_bufferp
(
&
in
);
return
AVERROR
(
ENOMEM
);
}
avfilter_copy_buffer_ref_props
(
out
,
in
);
/* copy palette if required */
if
(
av_pix_fmt_desc_get
(
inlink
->
format
)
->
flags
&
PIX_FMT_PAL
)
memcpy
(
inlink
->
dst
->
outputs
[
0
]
->
out_buf
->
data
[
1
],
picref
->
data
[
1
],
AVPALETTE_SIZE
);
return
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
outlink
->
out_buf
,
~
0
));
}
static
int
draw_slice
(
AVFilterLink
*
inlink
,
int
y
,
int
h
,
int
slice_dir
)
{
FlipContext
*
flip
=
inlink
->
dst
->
priv
;
AVFilterBufferRef
*
inpic
=
inlink
->
cur_buf
;
AVFilterBufferRef
*
outpic
=
inlink
->
dst
->
outputs
[
0
]
->
out_buf
;
uint8_t
*
inrow
,
*
outrow
;
int
i
,
j
,
plane
,
step
,
hsub
,
vsub
;
memcpy
(
out
->
data
[
1
],
in
->
data
[
1
],
AVPALETTE_SIZE
);
for
(
plane
=
0
;
plane
<
4
&&
in
pic
->
data
[
plane
];
plane
++
)
{
for
(
plane
=
0
;
plane
<
4
&&
in
->
data
[
plane
];
plane
++
)
{
step
=
flip
->
max_step
[
plane
];
hsub
=
(
plane
==
1
||
plane
==
2
)
?
flip
->
hsub
:
0
;
vsub
=
(
plane
==
1
||
plane
==
2
)
?
flip
->
vsub
:
0
;
outrow
=
out
pic
->
data
[
plane
]
+
(
y
>>
vsub
)
*
outpic
->
linesize
[
plane
];
inrow
=
in
pic
->
data
[
plane
]
+
(
y
>>
vsub
)
*
inpic
->
linesize
[
plane
]
+
((
inlink
->
w
>>
hsub
)
-
1
)
*
step
;
for
(
i
=
0
;
i
<
h
>>
vsub
;
i
++
)
{
outrow
=
out
->
data
[
plane
];
inrow
=
in
->
data
[
plane
]
+
((
inlink
->
w
>>
hsub
)
-
1
)
*
step
;
for
(
i
=
0
;
i
<
in
->
video
->
h
>>
vsub
;
i
++
)
{
switch
(
step
)
{
case
1
:
for
(
j
=
0
;
j
<
(
inlink
->
w
>>
hsub
);
j
++
)
...
...
@@ -157,20 +154,20 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
memcpy
(
outrow
+
j
*
step
,
inrow
-
j
*
step
,
step
);
}
inrow
+=
in
pic
->
linesize
[
plane
];
outrow
+=
out
pic
->
linesize
[
plane
];
inrow
+=
in
->
linesize
[
plane
];
outrow
+=
out
->
linesize
[
plane
];
}
}
return
ff_draw_slice
(
inlink
->
dst
->
outputs
[
0
],
y
,
h
,
slice_dir
);
avfilter_unref_bufferp
(
&
in
);
return
ff_filter_frame
(
outlink
,
out
);
}
static
const
AVFilterPad
avfilter_vf_hflip_inputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
start_frame
=
start_frame
,
.
draw_slice
=
draw_slice
,
.
filter_frame
=
filter_frame
,
.
config_props
=
config_props
,
.
min_perms
=
AV_PERM_READ
,
},
...
...
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