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
bff576c7
Commit
bff576c7
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_lut: switch to filter_frame
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
eb7e7e82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
16 deletions
+23
-16
vf_lut.c
libavfilter/vf_lut.c
+23
-16
No files found.
libavfilter/vf_lut.c
View file @
bff576c7
...
@@ -259,22 +259,28 @@ static int config_props(AVFilterLink *inlink)
...
@@ -259,22 +259,28 @@ static int config_props(AVFilterLink *inlink)
return
0
;
return
0
;
}
}
static
int
draw_slice
(
AVFilterLink
*
inlink
,
int
y
,
int
h
,
int
slice_dir
)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
in
)
{
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterContext
*
ctx
=
inlink
->
dst
;
LutContext
*
lut
=
ctx
->
priv
;
LutContext
*
lut
=
ctx
->
priv
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFilterBufferRef
*
inpic
=
inlink
->
cur_buf
;
AVFilterBufferRef
*
out
;
AVFilterBufferRef
*
outpic
=
outlink
->
out_buf
;
uint8_t
*
inrow
,
*
outrow
,
*
inrow0
,
*
outrow0
;
uint8_t
*
inrow
,
*
outrow
,
*
inrow0
,
*
outrow0
;
int
i
,
j
,
plane
;
int
i
,
j
,
plane
;
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
);
if
(
lut
->
is_rgb
)
{
if
(
lut
->
is_rgb
)
{
/* packed */
/* packed */
inrow0
=
in
pic
->
data
[
0
]
+
y
*
inpic
->
linesize
[
0
];
inrow0
=
in
->
data
[
0
];
outrow0
=
out
pic
->
data
[
0
]
+
y
*
outpic
->
linesize
[
0
];
outrow0
=
out
->
data
[
0
];
for
(
i
=
0
;
i
<
h
;
i
++
)
{
for
(
i
=
0
;
i
<
in
->
video
->
h
;
i
++
)
{
int
w
=
inlink
->
w
;
int
w
=
inlink
->
w
;
const
uint8_t
(
*
tab
)[
256
]
=
(
const
uint8_t
(
*
)[
256
])
lut
->
lut
;
const
uint8_t
(
*
tab
)[
256
]
=
(
const
uint8_t
(
*
)[
256
])
lut
->
lut
;
inrow
=
inrow0
;
inrow
=
inrow0
;
...
@@ -293,36 +299,37 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
...
@@ -293,36 +299,37 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
outrow
+=
lut
->
step
;
outrow
+=
lut
->
step
;
inrow
+=
lut
->
step
;
inrow
+=
lut
->
step
;
}
}
inrow0
+=
in
pic
->
linesize
[
0
];
inrow0
+=
in
->
linesize
[
0
];
outrow0
+=
out
pic
->
linesize
[
0
];
outrow0
+=
out
->
linesize
[
0
];
}
}
}
else
{
}
else
{
/* planar */
/* planar */
for
(
plane
=
0
;
plane
<
4
&&
in
pic
->
data
[
plane
];
plane
++
)
{
for
(
plane
=
0
;
plane
<
4
&&
in
->
data
[
plane
];
plane
++
)
{
int
vsub
=
plane
==
1
||
plane
==
2
?
lut
->
vsub
:
0
;
int
vsub
=
plane
==
1
||
plane
==
2
?
lut
->
vsub
:
0
;
int
hsub
=
plane
==
1
||
plane
==
2
?
lut
->
hsub
:
0
;
int
hsub
=
plane
==
1
||
plane
==
2
?
lut
->
hsub
:
0
;
inrow
=
in
pic
->
data
[
plane
]
+
(
y
>>
vsub
)
*
inpic
->
linesize
[
plane
];
inrow
=
in
->
data
[
plane
];
outrow
=
out
pic
->
data
[
plane
]
+
(
y
>>
vsub
)
*
outpic
->
linesize
[
plane
];
outrow
=
out
->
data
[
plane
];
for
(
i
=
0
;
i
<
(
h
+
(
1
<<
vsub
)
-
1
)
>>
vsub
;
i
++
)
{
for
(
i
=
0
;
i
<
(
in
->
video
->
h
+
(
1
<<
vsub
)
-
1
)
>>
vsub
;
i
++
)
{
const
uint8_t
*
tab
=
lut
->
lut
[
plane
];
const
uint8_t
*
tab
=
lut
->
lut
[
plane
];
int
w
=
(
inlink
->
w
+
(
1
<<
hsub
)
-
1
)
>>
hsub
;
int
w
=
(
inlink
->
w
+
(
1
<<
hsub
)
-
1
)
>>
hsub
;
for
(
j
=
0
;
j
<
w
;
j
++
)
for
(
j
=
0
;
j
<
w
;
j
++
)
outrow
[
j
]
=
tab
[
inrow
[
j
]];
outrow
[
j
]
=
tab
[
inrow
[
j
]];
inrow
+=
in
pic
->
linesize
[
plane
];
inrow
+=
in
->
linesize
[
plane
];
outrow
+=
out
pic
->
linesize
[
plane
];
outrow
+=
out
->
linesize
[
plane
];
}
}
}
}
}
}
return
ff_draw_slice
(
outlink
,
y
,
h
,
slice_dir
);
avfilter_unref_bufferp
(
&
in
);
return
ff_filter_frame
(
outlink
,
out
);
}
}
static
const
AVFilterPad
inputs
[]
=
{
static
const
AVFilterPad
inputs
[]
=
{
{
.
name
=
"default"
,
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
draw_slice
=
draw_slic
e
,
.
filter_frame
=
filter_fram
e
,
.
config_props
=
config_props
,
.
config_props
=
config_props
,
.
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