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
cac9af68
Commit
cac9af68
authored
Oct 01, 2013
by
Marton Balint
Committed by
Paul B Mahol
Oct 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_histogram: add support for subsampled planar yuv modes in waveform mode
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
31a8461d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
vf_histogram.c
libavfilter/vf_histogram.c
+30
-7
filter-video.mak
tests/fate/filter-video.mak
+1
-1
No files found.
libavfilter/vf_histogram.c
View file @
cac9af68
...
@@ -87,6 +87,18 @@ static const enum AVPixelFormat levels_pix_fmts[] = {
...
@@ -87,6 +87,18 @@ static const enum AVPixelFormat levels_pix_fmts[] = {
AV_PIX_FMT_GRAY8
,
AV_PIX_FMT_GBRP
,
AV_PIX_FMT_GBRAP
,
AV_PIX_FMT_NONE
AV_PIX_FMT_GRAY8
,
AV_PIX_FMT_GBRP
,
AV_PIX_FMT_GBRAP
,
AV_PIX_FMT_NONE
};
};
static
const
enum
AVPixelFormat
waveform_pix_fmts
[]
=
{
AV_PIX_FMT_GBRP
,
AV_PIX_FMT_GBRAP
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV444P
,
AV_PIX_FMT_YUV440P
,
AV_PIX_FMT_YUV411P
,
AV_PIX_FMT_YUV410P
,
AV_PIX_FMT_YUVJ440P
,
AV_PIX_FMT_YUVJ411P
,
AV_PIX_FMT_YUVJ420P
,
AV_PIX_FMT_YUVJ422P
,
AV_PIX_FMT_YUVJ444P
,
AV_PIX_FMT_YUVA444P
,
AV_PIX_FMT_YUVA422P
,
AV_PIX_FMT_YUVA420P
,
AV_PIX_FMT_GRAY8
,
AV_PIX_FMT_NONE
};
static
int
query_formats
(
AVFilterContext
*
ctx
)
static
int
query_formats
(
AVFilterContext
*
ctx
)
{
{
HistogramContext
*
h
=
ctx
->
priv
;
HistogramContext
*
h
=
ctx
->
priv
;
...
@@ -94,6 +106,8 @@ static int query_formats(AVFilterContext *ctx)
...
@@ -94,6 +106,8 @@ static int query_formats(AVFilterContext *ctx)
switch
(
h
->
mode
)
{
switch
(
h
->
mode
)
{
case
MODE_WAVEFORM
:
case
MODE_WAVEFORM
:
pix_fmts
=
waveform_pix_fmts
;
break
;
case
MODE_LEVELS
:
case
MODE_LEVELS
:
pix_fmts
=
levels_pix_fmts
;
pix_fmts
=
levels_pix_fmts
;
break
;
break
;
...
@@ -175,8 +189,11 @@ static void gen_waveform(HistogramContext *h, AVFrame *inpicref, AVFrame *outpic
...
@@ -175,8 +189,11 @@ static void gen_waveform(HistogramContext *h, AVFrame *inpicref, AVFrame *outpic
uint8_t
*
dst_data
=
outpicref
->
data
[
plane
]
+
(
col_mode
?
offset
*
dst_linesize
:
offset
);
uint8_t
*
dst_data
=
outpicref
->
data
[
plane
]
+
(
col_mode
?
offset
*
dst_linesize
:
offset
);
uint8_t
*
const
dst_line
=
dst_data
;
uint8_t
*
const
dst_line
=
dst_data
;
const
uint8_t
max
=
255
-
intensity
;
const
uint8_t
max
=
255
-
intensity
;
const
int
src_h
=
inpicref
->
height
;
const
int
is_chroma
=
(
component
==
1
||
component
==
2
);
const
int
src_w
=
inpicref
->
width
;
const
int
shift_w
=
(
is_chroma
?
h
->
desc
->
log2_chroma_w
:
0
);
const
int
shift_h
=
(
is_chroma
?
h
->
desc
->
log2_chroma_h
:
0
);
const
int
src_h
=
FF_CEIL_RSHIFT
(
inpicref
->
height
,
shift_h
);
const
int
src_w
=
FF_CEIL_RSHIFT
(
inpicref
->
width
,
shift_w
);
uint8_t
*
dst
,
*
p
;
uint8_t
*
dst
,
*
p
;
int
y
;
int
y
;
...
@@ -186,9 +203,9 @@ static void gen_waveform(HistogramContext *h, AVFrame *inpicref, AVFrame *outpic
...
@@ -186,9 +203,9 @@ static void gen_waveform(HistogramContext *h, AVFrame *inpicref, AVFrame *outpic
for
(
p
=
src_data
;
p
<
src_data_end
;
p
++
)
{
for
(
p
=
src_data
;
p
<
src_data_end
;
p
++
)
{
uint8_t
*
target
;
uint8_t
*
target
;
if
(
col_mode
)
if
(
col_mode
)
target
=
dst
++
+
dst_linesize
*
*
p
;
target
=
dst
++
+
dst_linesize
*
(
*
p
>>
shift_h
)
;
else
else
target
=
dst_data
+
*
p
;
target
=
dst_data
+
(
*
p
>>
shift_w
)
;
if
(
*
target
<=
max
)
if
(
*
target
<=
max
)
*
target
+=
intensity
;
*
target
+=
intensity
;
else
else
...
@@ -218,9 +235,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
...
@@ -218,9 +235,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out
->
pts
=
in
->
pts
;
out
->
pts
=
in
->
pts
;
for
(
k
=
0
;
k
<
h
->
ncomp
;
k
++
)
for
(
k
=
0
;
k
<
h
->
ncomp
;
k
++
)
{
for
(
i
=
0
;
i
<
outlink
->
h
;
i
++
)
int
is_chroma
=
(
k
==
1
||
k
==
2
);
memset
(
out
->
data
[
k
]
+
i
*
out
->
linesize
[
k
],
h
->
bg_color
[
k
],
outlink
->
w
);
int
dst_h
=
FF_CEIL_RSHIFT
(
outlink
->
h
,
(
is_chroma
?
h
->
desc
->
log2_chroma_h
:
0
));
int
dst_w
=
FF_CEIL_RSHIFT
(
outlink
->
w
,
(
is_chroma
?
h
->
desc
->
log2_chroma_w
:
0
));
for
(
i
=
0
;
i
<
dst_h
;
i
++
)
memset
(
out
->
data
[
h
->
desc
->
comp
[
k
].
plane
]
+
i
*
out
->
linesize
[
h
->
desc
->
comp
[
k
].
plane
],
h
->
bg_color
[
k
],
dst_w
);
}
switch
(
h
->
mode
)
{
switch
(
h
->
mode
)
{
case
MODE_LEVELS
:
case
MODE_LEVELS
:
...
...
tests/fate/filter-video.mak
View file @
cac9af68
...
@@ -57,7 +57,7 @@ FATE_FILTER_VSYNTH-$(CONFIG_HISTOGRAM_FILTER) += fate-filter-histogram-levels
...
@@ -57,7 +57,7 @@ FATE_FILTER_VSYNTH-$(CONFIG_HISTOGRAM_FILTER) += fate-filter-histogram-levels
fate-filter-histogram-levels: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf histogram -flags +bitexact -sws_flags +accurate_rnd+bitexact
fate-filter-histogram-levels: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf histogram -flags +bitexact -sws_flags +accurate_rnd+bitexact
FATE_FILTER_VSYNTH-$(CONFIG_HISTOGRAM_FILTER) += fate-filter-histogram-waveform
FATE_FILTER_VSYNTH-$(CONFIG_HISTOGRAM_FILTER) += fate-filter-histogram-waveform
fate-filter-histogram-waveform: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf histogram=mode=waveform -flags +bitexact -sws_flags +accurate_rnd+bitexact
fate-filter-histogram-waveform: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf
format=yuv444p,
histogram=mode=waveform -flags +bitexact -sws_flags +accurate_rnd+bitexact
FATE_FILTER_VSYNTH-$(CONFIG_OVERLAY_FILTER) += fate-filter-overlay
FATE_FILTER_VSYNTH-$(CONFIG_OVERLAY_FILTER) += fate-filter-overlay
fate-filter-overlay: tests/data/filtergraphs/overlay
fate-filter-overlay: tests/data/filtergraphs/overlay
...
...
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