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
a03e79ed
Commit
a03e79ed
authored
Jul 08, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: fix broken logic in metadata handling
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
970c8df7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
10 deletions
+18
-10
vf_bbox.c
libavfilter/vf_bbox.c
+1
-1
vf_cropdetect.c
libavfilter/vf_cropdetect.c
+1
-1
vf_psnr.c
libavfilter/vf_psnr.c
+16
-8
No files found.
libavfilter/vf_bbox.c
View file @
a03e79ed
...
...
@@ -62,7 +62,7 @@ static int query_formats(AVFilterContext *ctx)
#define SET_META(key, value) \
snprintf(buf, sizeof(buf), "%d", value); \
av_dict_set(metadata,
#key, buf, 0); \
av_dict_set(metadata,
key, buf, 0);
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
{
...
...
libavfilter/vf_cropdetect.c
View file @
a03e79ed
...
...
@@ -114,7 +114,7 @@ static int config_input(AVFilterLink *inlink)
#define SET_META(key, value) \
snprintf(buf, sizeof(buf), "%d", value); \
av_dict_set(metadata,
#key, buf, 0) \
av_dict_set(metadata,
key, buf, 0)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
{
...
...
libavfilter/vf_psnr.c
View file @
a03e79ed
...
...
@@ -98,16 +98,24 @@ void compute_images_mse(const uint8_t *main_data[4], const int main_linesizes[4]
}
}
#define SET_META(key, comp, value) \
snprintf(buf, sizeof(buf), "%0.2f", value); \
av_dict_set(metadata, #key #comp, buf, 0); \
static
void
set_meta
(
AVDictionary
**
metadata
,
const
char
*
key
,
char
comp
,
float
d
)
{
char
value
[
128
];
snprintf
(
value
,
sizeof
(
value
),
"%0.2f"
,
d
);
if
(
comp
)
{
char
key2
[
128
];
snprintf
(
key2
,
sizeof
(
key2
),
"%s%c"
,
key
,
comp
);
av_dict_set
(
metadata
,
key2
,
value
,
0
);
}
else
{
av_dict_set
(
metadata
,
key
,
value
,
0
);
}
}
static
AVFrame
*
do_psnr
(
AVFilterContext
*
ctx
,
AVFrame
*
main
,
const
AVFrame
*
ref
)
{
PSNRContext
*
s
=
ctx
->
priv
;
double
comp_mse
[
4
],
mse
=
0
;
char
buf
[
32
];
int
j
,
c
;
AVDictionary
**
metadata
=
avpriv_frame_get_metadatap
(
main
);
...
...
@@ -127,10 +135,10 @@ static AVFrame *do_psnr(AVFilterContext *ctx, AVFrame *main,
for
(
j
=
0
;
j
<
s
->
desc
->
nb_components
;
j
++
)
{
c
=
s
->
is_rgb
?
s
->
rgba_map
[
j
]
:
j
;
SET_META
(
"lavfi.psnr.mse."
,
s
->
comps
[
j
],
comp_mse
[
c
]);
SET_META
(
"lavfi.psnr.mse_avg"
,
""
,
mse
);
SET_META
(
"lavfi.psnr.s."
,
s
->
comps
[
j
],
get_psnr
(
comp_mse
[
c
],
1
,
s
->
max
[
c
]));
SET_META
(
"lavfi.psnr.s_avg"
,
""
,
get_psnr
(
mse
,
1
,
s
->
average_max
));
set_meta
(
metadata
,
"lavfi.psnr.mse."
,
s
->
comps
[
j
],
comp_mse
[
c
]);
set_meta
(
metadata
,
"lavfi.psnr.mse_avg"
,
0
,
mse
);
set_meta
(
metadata
,
"lavfi.psnr.s."
,
s
->
comps
[
j
],
get_psnr
(
comp_mse
[
c
],
1
,
s
->
max
[
c
]));
set_meta
(
metadata
,
"lavfi.psnr.s_avg"
,
0
,
get_psnr
(
mse
,
1
,
s
->
average_max
));
}
if
(
s
->
stats_file
)
{
...
...
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