Skip to content
GitLab
Menu
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
e4118e25
Commit
e4118e25
authored
Feb 26, 2014
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Feb 26, 2014
Browse files
Merge "Adding vpx_sse_to_psnr() function."
parents
b83b159e
7d5bffc4
Changes
11
Hide whitespace changes
Inline
Side-by-side
vp8/encoder/onyx_if.c
View file @
e4118e25
...
...
@@ -19,7 +19,7 @@
#include
"vp8/common/alloccommon.h"
#include
"mcomp.h"
#include
"firstpass.h"
#include
"psnr.h"
#include
"
vpx/internal/vpx_
psnr.h"
#include
"vpx_scale/vpx_scale.h"
#include
"vp8/common/extend.h"
#include
"ratectrl.h"
...
...
@@ -2170,10 +2170,12 @@ void vp8_remove_compressor(VP8_COMP **ptr)
8
.
0
/
1000
.
0
/
time_encoded
;
double
samples
=
3
.
0
/
2
*
cpi
->
frames_in_layer
[
i
]
*
lst_yv12
->
y_width
*
lst_yv12
->
y_height
;
double
total_psnr
=
vp8_mse2psnr
(
samples
,
255
.
0
,
cpi
->
total_error2
[
i
]);
double
total_psnr2
=
vp8_mse2psnr
(
samples
,
255
.
0
,
cpi
->
total_error2_p
[
i
]);
double
total_psnr
=
vpx_sse_to_psnr
(
samples
,
255
.
0
,
cpi
->
total_error2
[
i
]);
double
total_psnr2
=
vpx_sse_to_psnr
(
samples
,
255
.
0
,
cpi
->
total_error2_p
[
i
]);
double
total_ssim
=
100
*
pow
(
cpi
->
sum_ssim
[
i
]
/
cpi
->
sum_weights
[
i
],
8
.
0
);
...
...
@@ -2190,9 +2192,9 @@ void vp8_remove_compressor(VP8_COMP **ptr)
{
double
samples
=
3
.
0
/
2
*
cpi
->
count
*
lst_yv12
->
y_width
*
lst_yv12
->
y_height
;
double
total_psnr
=
vp
8_mse2
psnr
(
samples
,
255
.
0
,
cpi
->
total_sq_error
);
double
total_psnr2
=
vp
8_mse2
psnr
(
samples
,
255
.
0
,
double
total_psnr
=
vp
x_sse_to_
psnr
(
samples
,
255
.
0
,
cpi
->
total_sq_error
);
double
total_psnr2
=
vp
x_sse_to_
psnr
(
samples
,
255
.
0
,
cpi
->
total_sq_error2
);
double
total_ssim
=
100
*
pow
(
cpi
->
summed_quality
/
cpi
->
summed_weights
,
8
.
0
);
...
...
@@ -2522,8 +2524,8 @@ static void generate_psnr_packet(VP8_COMP *cpi)
pkt
.
data
.
psnr
.
samples
[
3
]
=
width
*
height
;
for
(
i
=
0
;
i
<
4
;
i
++
)
pkt
.
data
.
psnr
.
psnr
[
i
]
=
vp
8_mse2
psnr
(
pkt
.
data
.
psnr
.
samples
[
i
],
255
.
0
,
(
double
)(
pkt
.
data
.
psnr
.
sse
[
i
]));
pkt
.
data
.
psnr
.
psnr
[
i
]
=
vp
x_sse_to_
psnr
(
pkt
.
data
.
psnr
.
samples
[
i
],
255
.
0
,
(
double
)(
pkt
.
data
.
psnr
.
sse
[
i
]));
vpx_codec_pkt_list_add
(
cpi
->
output_pkt_list
,
&
pkt
);
}
...
...
@@ -5284,11 +5286,11 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
sq_error
=
(
double
)(
ye
+
ue
+
ve
);
frame_psnr
=
vp
8_mse2
psnr
(
t_samples
,
255
.
0
,
sq_error
);
frame_psnr
=
vp
x_sse_to_
psnr
(
t_samples
,
255
.
0
,
sq_error
);
cpi
->
total_y
+=
vp
8_mse2
psnr
(
y_samples
,
255
.
0
,
(
double
)
ye
);
cpi
->
total_u
+=
vp
8_mse2
psnr
(
uv_samples
,
255
.
0
,
(
double
)
ue
);
cpi
->
total_v
+=
vp
8_mse2
psnr
(
uv_samples
,
255
.
0
,
(
double
)
ve
);
cpi
->
total_y
+=
vp
x_sse_to_
psnr
(
y_samples
,
255
.
0
,
(
double
)
ye
);
cpi
->
total_u
+=
vp
x_sse_to_
psnr
(
uv_samples
,
255
.
0
,
(
double
)
ue
);
cpi
->
total_v
+=
vp
x_sse_to_
psnr
(
uv_samples
,
255
.
0
,
(
double
)
ve
);
cpi
->
total_sq_error
+=
sq_error
;
cpi
->
total
+=
frame_psnr
;
#if CONFIG_POSTPROC
...
...
@@ -5311,14 +5313,14 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
sq_error2
=
(
double
)(
ye
+
ue
+
ve
);
frame_psnr2
=
vp
8_mse2
psnr
(
t_samples
,
255
.
0
,
sq_error2
);
frame_psnr2
=
vp
x_sse_to_
psnr
(
t_samples
,
255
.
0
,
sq_error2
);
cpi
->
totalp_y
+=
vp
8_mse2
psnr
(
y_samples
,
255
.
0
,
(
double
)
ye
);
cpi
->
totalp_u
+=
vp
8_mse2
psnr
(
uv_samples
,
255
.
0
,
(
double
)
ue
);
cpi
->
totalp_v
+=
vp
8_mse2
psnr
(
uv_samples
,
255
.
0
,
(
double
)
ve
);
cpi
->
totalp_y
+=
vp
x_sse_to_
psnr
(
y_samples
,
255
.
0
,
(
double
)
ye
);
cpi
->
totalp_u
+=
vp
x_sse_to_
psnr
(
uv_samples
,
255
.
0
,
(
double
)
ue
);
cpi
->
totalp_v
+=
vp
x_sse_to_
psnr
(
uv_samples
,
255
.
0
,
(
double
)
ve
);
cpi
->
total_sq_error2
+=
sq_error2
;
cpi
->
totalp
+=
frame_psnr2
;
...
...
vp8/encoder/psnr.c
deleted
100644 → 0
View file @
b83b159e
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include
"vpx_scale/yv12config.h"
#include
"math.h"
#include
"vp8/common/systemdependent.h"
/* for vp8_clear_system_state() */
#define MAX_PSNR 100
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
=
MAX_PSNR
;
/* Limit to prevent / 0 */
if
(
psnr
>
MAX_PSNR
)
psnr
=
MAX_PSNR
;
return
psnr
;
}
vp8/encoder/temporal_filter.c
View file @
e4118e25
...
...
@@ -16,7 +16,6 @@
#include
"vp8/common/alloccommon.h"
#include
"mcomp.h"
#include
"firstpass.h"
#include
"psnr.h"
#include
"vpx_scale/vpx_scale.h"
#include
"vp8/common/extend.h"
#include
"ratectrl.h"
...
...
vp8/vp8cx.mk
View file @
e4118e25
...
...
@@ -50,7 +50,6 @@ VP8_CX_SRCS-yes += encoder/mcomp.h
VP8_CX_SRCS-yes
+=
encoder/modecosts.h
VP8_CX_SRCS-yes
+=
encoder/onyx_int.h
VP8_CX_SRCS-yes
+=
encoder/pickinter.h
VP8_CX_SRCS-yes
+=
encoder/psnr.h
VP8_CX_SRCS-yes
+=
encoder/quantize.h
VP8_CX_SRCS-yes
+=
encoder/ratectrl.h
VP8_CX_SRCS-yes
+=
encoder/rdopt.h
...
...
@@ -61,7 +60,6 @@ VP8_CX_SRCS-yes += encoder/modecosts.c
VP8_CX_SRCS-yes
+=
encoder/onyx_if.c
VP8_CX_SRCS-yes
+=
encoder/pickinter.c
VP8_CX_SRCS-yes
+=
encoder/picklpf.c
VP8_CX_SRCS-yes
+=
encoder/psnr.c
VP8_CX_SRCS-yes
+=
encoder/quantize.c
VP8_CX_SRCS-yes
+=
encoder/ratectrl.c
VP8_CX_SRCS-yes
+=
encoder/rdopt.c
...
...
vp9/encoder/vp9_onyx_if.c
View file @
e4118e25
...
...
@@ -14,6 +14,8 @@
#include
"./vpx_config.h"
#include
"./vpx_scale_rtcd.h"
#include
"vpx/internal/vpx_psnr.h"
#include
"vpx_ports/vpx_timer.h"
#include
"vp9/common/vp9_alloccommon.h"
#include
"vp9/common/vp9_filter.h"
...
...
@@ -30,7 +32,6 @@
#include
"vp9/encoder/vp9_mbgraph.h"
#include
"vp9/encoder/vp9_onyx_int.h"
#include
"vp9/encoder/vp9_picklpf.h"
#include
"vp9/encoder/vp9_psnr.h"
#include
"vp9/encoder/vp9_ratectrl.h"
#include
"vp9/encoder/vp9_rdopt.h"
#include
"vp9/encoder/vp9_segmentation.h"
...
...
@@ -38,8 +39,6 @@
#include
"vp9/encoder/vp9_vaq.h"
#include
"vp9/encoder/vp9_resize.h"
#include
"vpx_ports/vpx_timer.h"
void
vp9_entropy_mode_init
();
void
vp9_coef_tree_initialize
();
...
...
@@ -2045,11 +2044,11 @@ void vp9_remove_compressor(VP9_PTR *ptr) {
if
(
cpi
->
b_calculate_psnr
)
{
const
double
total_psnr
=
vp
9_mse2
psnr
((
double
)
cpi
->
total_samples
,
255
.
0
,
(
double
)
cpi
->
total_sq_error
);
vp
x_sse_to_
psnr
((
double
)
cpi
->
total_samples
,
255
.
0
,
(
double
)
cpi
->
total_sq_error
);
const
double
totalp_psnr
=
vp
9_mse2
psnr
((
double
)
cpi
->
totalp_samples
,
255
.
0
,
(
double
)
cpi
->
totalp_sq_error
);
vp
x_sse_to_
psnr
((
double
)
cpi
->
totalp_samples
,
255
.
0
,
(
double
)
cpi
->
totalp_sq_error
);
const
double
total_ssim
=
100
*
pow
(
cpi
->
summed_quality
/
cpi
->
summed_weights
,
8
.
0
);
const
double
totalp_ssim
=
100
*
pow
(
cpi
->
summedp_quality
/
...
...
@@ -2230,7 +2229,7 @@ static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
w
,
h
);
psnr
->
sse
[
1
+
i
]
=
sse
;
psnr
->
samples
[
1
+
i
]
=
samples
;
psnr
->
psnr
[
1
+
i
]
=
vp
9_mse2
psnr
(
samples
,
255
.
0
,
(
double
)
sse
);
psnr
->
psnr
[
1
+
i
]
=
vp
x_sse_to_
psnr
(
samples
,
255
.
0
,
(
double
)
sse
);
total_sse
+=
sse
;
total_samples
+=
samples
;
...
...
@@ -2238,7 +2237,8 @@ static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
psnr
->
sse
[
0
]
=
total_sse
;
psnr
->
samples
[
0
]
=
total_samples
;
psnr
->
psnr
[
0
]
=
vp9_mse2psnr
((
double
)
total_samples
,
255
.
0
,
(
double
)
total_sse
);
psnr
->
psnr
[
0
]
=
vpx_sse_to_psnr
((
double
)
total_samples
,
255
.
0
,
(
double
)
total_sse
);
}
static
void
generate_psnr_packet
(
VP9_COMP
*
cpi
)
{
...
...
vp9/encoder/vp9_psnr.h
deleted
100644 → 0
View file @
b83b159e
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VP9_ENCODER_VP9_PSNR_H_
#define VP9_ENCODER_VP9_PSNR_H_
#ifdef __cplusplus
extern
"C"
{
#endif
double
vp9_mse2psnr
(
double
samples
,
double
peak
,
double
mse
);
#ifdef __cplusplus
}
// extern "C"
#endif
#endif // VP9_ENCODER_VP9_PSNR_H_
vp9/encoder/vp9_temporal_filter.c
View file @
e4118e25
...
...
@@ -20,7 +20,6 @@
#include
"vp9/encoder/vp9_firstpass.h"
#include
"vp9/encoder/vp9_mcomp.h"
#include
"vp9/encoder/vp9_onyx_int.h"
#include
"vp9/encoder/vp9_psnr.h"
#include
"vp9/encoder/vp9_quantize.h"
#include
"vp9/encoder/vp9_ratectrl.h"
#include
"vp9/encoder/vp9_segmentation.h"
...
...
vp9/vp9cx.mk
View file @
e4118e25
...
...
@@ -38,7 +38,6 @@ VP9_CX_SRCS-yes += encoder/vp9_lookahead.c
VP9_CX_SRCS-yes
+=
encoder/vp9_lookahead.h
VP9_CX_SRCS-yes
+=
encoder/vp9_mcomp.h
VP9_CX_SRCS-yes
+=
encoder/vp9_onyx_int.h
VP9_CX_SRCS-yes
+=
encoder/vp9_psnr.h
VP9_CX_SRCS-yes
+=
encoder/vp9_quantize.h
VP9_CX_SRCS-yes
+=
encoder/vp9_ratectrl.h
VP9_CX_SRCS-yes
+=
encoder/vp9_rdopt.h
...
...
@@ -50,7 +49,6 @@ VP9_CX_SRCS-yes += encoder/vp9_mcomp.c
VP9_CX_SRCS-yes
+=
encoder/vp9_onyx_if.c
VP9_CX_SRCS-yes
+=
encoder/vp9_picklpf.c
VP9_CX_SRCS-yes
+=
encoder/vp9_picklpf.h
VP9_CX_SRCS-yes
+=
encoder/vp9_psnr.c
VP9_CX_SRCS-yes
+=
encoder/vp9_quantize.c
VP9_CX_SRCS-yes
+=
encoder/vp9_ratectrl.c
VP9_CX_SRCS-yes
+=
encoder/vp9_rdopt.c
...
...
vp
8/encoder/
psnr.h
→
vp
x/internal/vpx_
psnr.h
View file @
e4118e25
/*
* Copyright (c) 201
0
The WebM project authors. All Rights Reserved.
* Copyright (c) 201
4
The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
...
...
@@ -8,18 +8,27 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VP8_ENCODER_PSNR_H_
#define VP8_ENCODER_PSNR_H_
#ifndef VPX_INTERNAL_VPX_PSNR_H_
#define VPX_INTERNAL_VPX_PSNR_H_
#ifdef __cplusplus
extern
"C"
{
#endif
extern
double
vp8_mse2psnr
(
double
Samples
,
double
Peak
,
double
Mse
);
// TODO(dkovalev) change vpx_sse_to_psnr signature: double -> int64_t
/*!\brief Converts SSE to PSNR
*
* Converts sum of squared errros (SSE) to peak signal-to-noise ratio (PNSR).
*
* \param[in] samples Number of samples
* \param[in] peak Max sample value
* \param[in] sse Sum of squared errors
*/
double
vpx_sse_to_psnr
(
double
samples
,
double
peak
,
double
sse
);
#ifdef __cplusplus
}
// extern "C"
#endif
#endif // VP
8_ENCODER
_PSNR_H_
#endif // VP
X_INTERNAL_VPX
_PSNR_H_
vp
9/encoder
/vp
9
_psnr.c
→
vp
x/src
/vp
x
_psnr.c
View file @
e4118e25
/*
* Copyright (c) 201
0
The WebM project authors. All Rights Reserved.
* Copyright (c) 201
4
The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
...
...
@@ -10,20 +10,15 @@
#include
<math.h>
#include
"vpx
_scale/yv12config
.h"
#include
"vpx
/internal/vpx_psnr
.h"
#define MAX_PSNR 100
#define MAX_PSNR 100
.0
double
vp9_mse2psnr
(
double
samples
,
double
peak
,
double
mse
)
{
double
psnr
;
if
(
mse
>
0
.
0
)
psnr
=
10
.
0
*
log10
(
peak
*
peak
*
samples
/
mse
);
else
psnr
=
MAX_PSNR
;
// Limit to prevent / 0
if
(
psnr
>
MAX_PSNR
)
psnr
=
MAX_PSNR
;
return
psnr
;
double
vpx_sse_to_psnr
(
double
samples
,
double
peak
,
double
sse
)
{
if
(
sse
>
0
.
0
)
{
const
double
psnr
=
10
.
0
*
log10
(
samples
*
peak
*
peak
/
sse
);
return
psnr
>
MAX_PSNR
?
MAX_PSNR
:
psnr
;
}
else
{
return
MAX_PSNR
;
}
}
vpx/vpx_codec.mk
View file @
e4118e25
...
...
@@ -34,8 +34,10 @@ API_SRCS-yes += vpx_decoder.h
API_SRCS-yes
+=
src/vpx_encoder.c
API_SRCS-yes
+=
vpx_encoder.h
API_SRCS-yes
+=
internal/vpx_codec_internal.h
API_SRCS-yes
+=
internal/vpx_psnr.h
API_SRCS-yes
+=
src/vpx_codec.c
API_SRCS-yes
+=
src/vpx_image.c
API_SRCS-yes
+=
src/vpx_psnr.c
API_SRCS-yes
+=
vpx_codec.h
API_SRCS-yes
+=
vpx_codec.mk
API_SRCS-yes
+=
vpx_frame_buffer.h
...
...
Write
Preview
Supports
Markdown
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