Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
f26fe7d9
Commit
f26fe7d9
authored
Oct 27, 2010
by
John Koleszar
Committed by
Code Review
Oct 27, 2010
Browse files
Merge "Output the PSNR for the entire file."
parents
71ecb5d7
3d84da6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
vpxenc.c
View file @
f26fe7d9
...
...
@@ -810,6 +810,23 @@ static unsigned int murmur ( const void * key, int len, unsigned int seed )
return
h
;
}
#include
"math.h"
static
double
vp8_mse2psnr
(
double
Samples
,
double
Peak
,
double
Mse
)
{
double
psnr
;
if
((
double
)
Mse
>
0
.
0
)
psnr
=
10
.
0
*
log10
(
Peak
*
Peak
*
Samples
/
Mse
);
else
psnr
=
60
;
// Limit to prevent / 0
if
(
psnr
>
60
)
psnr
=
60
;
return
psnr
;
}
#include
"args.h"
...
...
@@ -1049,6 +1066,10 @@ int main(int argc, const char **argv_)
int
write_webm
=
1
;
EbmlGlobal
ebml
=
{
0
};
uint32_t
hash
=
0
;
uint64_t
psnr_sse_total
=
0
;
uint64_t
psnr_samples_total
=
0
;
double
psnr_totals
[
4
]
=
{
0
,
0
,
0
,
0
};
int
psnr_count
=
0
;
exec_name
=
argv_
[
0
];
...
...
@@ -1570,8 +1591,14 @@ int main(int argc, const char **argv_)
{
int
i
;
psnr_sse_total
+=
pkt
->
data
.
psnr
.
sse
[
0
];
psnr_samples_total
+=
pkt
->
data
.
psnr
.
samples
[
0
];
for
(
i
=
0
;
i
<
4
;
i
++
)
{
fprintf
(
stderr
,
"%.3lf "
,
pkt
->
data
.
psnr
.
psnr
[
i
]);
psnr_totals
[
i
]
+=
pkt
->
data
.
psnr
.
psnr
[
i
];
}
psnr_count
++
;
}
break
;
...
...
@@ -1592,6 +1619,21 @@ int main(int argc, const char **argv_)
cx_time
>
9999999
?
"ms"
:
"us"
,
(
float
)
frames_in
*
1000000
.
0
/
(
float
)
cx_time
);
if
(
(
show_psnr
)
&&
(
psnr_count
>
0
)
)
{
int
i
;
double
ovpsnr
=
vp8_mse2psnr
(
psnr_samples_total
,
255
.
0
,
psnr_sse_total
);
fprintf
(
stderr
,
"
\n
PSNR (Overall/Avg/Y/U/V)"
);
fprintf
(
stderr
,
" %.3lf"
,
ovpsnr
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
fprintf
(
stderr
,
" %.3lf"
,
psnr_totals
[
i
]
/
psnr_count
);
}
}
vpx_codec_destroy
(
&
encoder
);
fclose
(
infile
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment