Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
3bb2ae5c
Commit
3bb2ae5c
authored
11 years ago
by
Dmitry Kovalev
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Download
Plain Diff
Merge "Adding sse_to_psnr function to tools_common.{h, c}."
parents
acefe86e
2dad0e12
v1.14.0-linphone
1.4.X
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
nextgen
nextgenv2
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
examples/vp8_multi_resolution_encoder.c
+4
-18
examples/vp8_multi_resolution_encoder.c
tools_common.c
+14
-2
tools_common.c
tools_common.h
+2
-0
tools_common.h
vpxenc.c
+2
-2
vpxenc.c
vpxstats.c
+0
-13
vpxstats.c
vpxstats.h
+0
-2
vpxstats.h
with
22 additions
and
37 deletions
examples/vp8_multi_resolution_encoder.c
+
4
−
18
View file @
3bb2ae5c
...
@@ -18,11 +18,12 @@
...
@@ -18,11 +18,12 @@
#include
<stdlib.h>
#include
<stdlib.h>
#include
<stdarg.h>
#include
<stdarg.h>
#include
<string.h>
#include
<string.h>
#include
"
math.h
"
#include
<
math.h
>
#define VPX_CODEC_DISABLE_COMPAT 1
#define VPX_CODEC_DISABLE_COMPAT 1
#include
"vpx/vpx_encoder.h"
#include
"vpx/vpx_encoder.h"
#include
"vpx/vp8cx.h"
#include
"vpx/vp8cx.h"
#include
"vpx_ports/mem_ops.h"
#include
"vpx_ports/mem_ops.h"
#include
"./tools_common.h"
#define interface (vpx_codec_vp8_cx())
#define interface (vpx_codec_vp8_cx())
#define fourcc 0x30385056
#define fourcc 0x30385056
...
@@ -44,21 +45,6 @@
...
@@ -44,21 +45,6 @@
#include
"third_party/libyuv/include/libyuv/scale.h"
#include
"third_party/libyuv/include/libyuv/scale.h"
#include
"third_party/libyuv/include/libyuv/cpu_id.h"
#include
"third_party/libyuv/include/libyuv/cpu_id.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
;
}
static
void
die
(
const
char
*
fmt
,
...)
{
static
void
die
(
const
char
*
fmt
,
...)
{
va_list
ap
;
va_list
ap
;
...
@@ -454,8 +440,8 @@ int main(int argc, char **argv)
...
@@ -454,8 +440,8 @@ int main(int argc, char **argv)
if
(
(
show_psnr
)
&&
(
psnr_count
[
i
]
>
0
)
)
if
(
(
show_psnr
)
&&
(
psnr_count
[
i
]
>
0
)
)
{
{
int
j
;
int
j
;
double
ovpsnr
=
vp8_mse2
psnr
(
psnr_samples_total
[
i
],
255
.
0
,
double
ovpsnr
=
sse_to_
psnr
(
psnr_samples_total
[
i
],
255
.
0
,
psnr_sse_total
[
i
]);
psnr_sse_total
[
i
]);
fprintf
(
stderr
,
"
\n
ENC%d PSNR (Overall/Avg/Y/U/V)"
,
i
);
fprintf
(
stderr
,
"
\n
ENC%d PSNR (Overall/Avg/Y/U/V)"
,
i
);
...
...
This diff is collapsed.
Click to expand it.
tools_common.c
+
14
−
2
View file @
3bb2ae5c
...
@@ -8,13 +8,14 @@
...
@@ -8,13 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
* be found in the AUTHORS file in the root of the source tree.
*/
*/
#include
"tools_common.h"
#include
<math.h>
#include
<stdarg.h>
#include
<stdarg.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
#include
"./tools_common.h"
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
#include
"vpx/vp8cx.h"
#include
"vpx/vp8cx.h"
#endif
#endif
...
@@ -253,3 +254,14 @@ int vpx_img_read(vpx_image_t *img, FILE *file) {
...
@@ -253,3 +254,14 @@ int vpx_img_read(vpx_image_t *img, FILE *file) {
return
1
;
return
1
;
}
}
// TODO(dkovalev) change sse_to_psnr signature: double -> int64_t
double
sse_to_psnr
(
double
samples
,
double
peak
,
double
sse
)
{
static
const
double
kMaxPSNR
=
100
.
0
;
if
(
sse
>
0
.
0
)
{
const
double
psnr
=
10
.
0
*
log10
(
samples
*
peak
*
peak
/
sse
);
return
psnr
>
kMaxPSNR
?
kMaxPSNR
:
psnr
;
}
else
{
return
kMaxPSNR
;
}
}
This diff is collapsed.
Click to expand it.
tools_common.h
+
2
−
0
View file @
3bb2ae5c
...
@@ -142,6 +142,8 @@ int vpx_img_plane_height(const vpx_image_t *img, int plane);
...
@@ -142,6 +142,8 @@ int vpx_img_plane_height(const vpx_image_t *img, int plane);
void
vpx_img_write
(
const
vpx_image_t
*
img
,
FILE
*
file
);
void
vpx_img_write
(
const
vpx_image_t
*
img
,
FILE
*
file
);
int
vpx_img_read
(
vpx_image_t
*
img
,
FILE
*
file
);
int
vpx_img_read
(
vpx_image_t
*
img
,
FILE
*
file
);
double
sse_to_psnr
(
double
samples
,
double
peak
,
double
mse
);
#ifdef __cplusplus
#ifdef __cplusplus
}
/* extern "C" */
}
/* extern "C" */
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
vpxenc.c
+
2
−
2
View file @
3bb2ae5c
...
@@ -1399,8 +1399,8 @@ static void show_psnr(struct stream_state *stream) {
...
@@ -1399,8 +1399,8 @@ static void show_psnr(struct stream_state *stream) {
return
;
return
;
fprintf
(
stderr
,
"Stream %d PSNR (Overall/Avg/Y/U/V)"
,
stream
->
index
);
fprintf
(
stderr
,
"Stream %d PSNR (Overall/Avg/Y/U/V)"
,
stream
->
index
);
ovpsnr
=
vp8_mse2
psnr
((
double
)
stream
->
psnr_samples_total
,
255
.
0
,
ovpsnr
=
sse_to_
psnr
((
double
)
stream
->
psnr_samples_total
,
255
.
0
,
(
double
)
stream
->
psnr_sse_total
);
(
double
)
stream
->
psnr_sse_total
);
fprintf
(
stderr
,
" %.3f"
,
ovpsnr
);
fprintf
(
stderr
,
" %.3f"
,
ovpsnr
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
vpxstats.c
+
0
−
13
View file @
3bb2ae5c
...
@@ -120,16 +120,3 @@ void stats_write(stats_io_t *stats, const void *pkt, size_t len) {
...
@@ -120,16 +120,3 @@ void stats_write(stats_io_t *stats, const void *pkt, size_t len) {
vpx_fixed_buf_t
stats_get
(
stats_io_t
*
stats
)
{
vpx_fixed_buf_t
stats_get
(
stats_io_t
*
stats
)
{
return
stats
->
buf
;
return
stats
->
buf
;
}
}
double
vp8_mse2psnr
(
double
samples
,
double
peak
,
double
mse
)
{
const
int
kMaxPSNR
=
100
;
double
psnr
=
kMaxPSNR
;
if
(
mse
>
0
.
0
)
psnr
=
10
.
0
*
log10
(
peak
*
peak
*
samples
/
mse
);
if
(
psnr
>
kMaxPSNR
)
psnr
=
kMaxPSNR
;
return
psnr
;
}
This diff is collapsed.
Click to expand it.
vpxstats.h
+
0
−
2
View file @
3bb2ae5c
...
@@ -36,8 +36,6 @@ void stats_close(stats_io_t *stats, int last_pass);
...
@@ -36,8 +36,6 @@ void stats_close(stats_io_t *stats, int last_pass);
void
stats_write
(
stats_io_t
*
stats
,
const
void
*
pkt
,
size_t
len
);
void
stats_write
(
stats_io_t
*
stats
,
const
void
*
pkt
,
size_t
len
);
vpx_fixed_buf_t
stats_get
(
stats_io_t
*
stats
);
vpx_fixed_buf_t
stats_get
(
stats_io_t
*
stats
);
double
vp8_mse2psnr
(
double
samples
,
double
peak
,
double
mse
);
#ifdef __cplusplus
#ifdef __cplusplus
}
// extern "C"
}
// extern "C"
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
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!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets