Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
aom-rav1e
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
aom-rav1e
Commits
6eaca90d
Commit
6eaca90d
authored
Feb 10, 2016
by
Yaowu Xu
Committed by
Gerrit Code Review
Feb 10, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Add a test for VPXSSIM computation for HBD inputs" into nextgenv2
parents
ed5a6bd9
988f27bf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
2 deletions
+126
-2
test/hbd_metrics_test.cc
test/hbd_metrics_test.cc
+123
-0
test/test.mk
test/test.mk
+3
-2
No files found.
test/hbd_metrics_test.cc
0 → 100644
View file @
6eaca90d
/*
* Copyright (c) 2016 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 <math.h>
#include <stdlib.h>
#include <new>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/acm_random.h"
#include "test/util.h"
#include "./vpx_config.h"
#include "vpx_dsp/ssim.h"
#include "vpx_ports/mem.h"
#include "vpx_ports/msvc.h"
#include "vpx_scale/yv12config.h"
using
libvpx_test
::
ACMRandom
;
namespace
{
typedef
double
(
*
LBDMetricFunc
)(
const
YV12_BUFFER_CONFIG
*
source
,
const
YV12_BUFFER_CONFIG
*
dest
,
double
*
weight
);
typedef
double
(
*
HBDMetricFunc
)(
const
YV12_BUFFER_CONFIG
*
source
,
const
YV12_BUFFER_CONFIG
*
dest
,
double
*
weight
,
unsigned
int
bd
);
class
HBDMetricsTestBase
{
public:
virtual
~
HBDMetricsTestBase
()
{}
protected:
void
RunAccuracyCheck
()
{
const
int
width
=
1920
;
const
int
height
=
1080
;
int
i
=
0
;
const
uint8_t
kPixFiller
=
128
;
YV12_BUFFER_CONFIG
lbd_src
,
lbd_dst
;
YV12_BUFFER_CONFIG
hbd_src
,
hbd_dst
;
ACMRandom
rnd
(
ACMRandom
::
DeterministicSeed
());
double
lbd_score
,
hbd_score
,
lbd_db
,
hbd_db
,
lbd_w
,
hbd_w
;
memset
(
&
lbd_src
,
0
,
sizeof
(
lbd_src
));
memset
(
&
lbd_dst
,
0
,
sizeof
(
lbd_dst
));
memset
(
&
hbd_src
,
0
,
sizeof
(
hbd_src
));
memset
(
&
hbd_dst
,
0
,
sizeof
(
hbd_dst
));
vpx_alloc_frame_buffer
(
&
lbd_src
,
width
,
height
,
1
,
1
,
0
,
32
,
16
);
vpx_alloc_frame_buffer
(
&
lbd_dst
,
width
,
height
,
1
,
1
,
0
,
32
,
16
);
vpx_alloc_frame_buffer
(
&
hbd_src
,
width
,
height
,
1
,
1
,
1
,
32
,
16
);
vpx_alloc_frame_buffer
(
&
hbd_dst
,
width
,
height
,
1
,
1
,
1
,
32
,
16
);
memset
(
lbd_src
.
buffer_alloc
,
kPixFiller
,
lbd_src
.
buffer_alloc_sz
);
while
(
i
<
lbd_src
.
buffer_alloc_sz
)
{
uint16_t
spel
,
dpel
;
spel
=
lbd_src
.
buffer_alloc
[
i
];
// Create some distortion for dst buffer.
lbd_dst
.
buffer_alloc
[
i
]
=
rnd
.
Rand8
();
dpel
=
lbd_dst
.
buffer_alloc
[
i
];
((
uint16_t
*
)(
hbd_src
.
buffer_alloc
))[
i
]
=
spel
<<
(
bit_depth_
-
8
);
((
uint16_t
*
)(
hbd_dst
.
buffer_alloc
))[
i
]
=
dpel
<<
(
bit_depth_
-
8
);
i
++
;
}
lbd_score
=
lbd_metric_
(
&
lbd_src
,
&
lbd_dst
,
&
lbd_w
);
hbd_score
=
hbd_metric_
(
&
hbd_src
,
&
hbd_dst
,
&
hbd_w
,
bit_depth_
);
lbd_db
=
100
*
pow
(
lbd_score
/
lbd_w
,
8.0
);
hbd_db
=
100
*
pow
(
hbd_score
/
hbd_w
,
8.0
);
vpx_free_frame_buffer
(
&
lbd_src
);
vpx_free_frame_buffer
(
&
lbd_dst
);
vpx_free_frame_buffer
(
&
hbd_src
);
vpx_free_frame_buffer
(
&
hbd_dst
);
EXPECT_LE
(
fabs
(
lbd_db
-
hbd_db
),
threshold_
);
}
int
bit_depth_
;
double
threshold_
;
LBDMetricFunc
lbd_metric_
;
HBDMetricFunc
hbd_metric_
;
};
typedef
std
::
tr1
::
tuple
<
LBDMetricFunc
,
HBDMetricFunc
,
int
,
double
>
MetricTestTParam
;
class
HBDMetricsTest
:
public
HBDMetricsTestBase
,
public
::
testing
::
TestWithParam
<
MetricTestTParam
>
{
public:
virtual
void
SetUp
()
{
lbd_metric_
=
GET_PARAM
(
0
);
hbd_metric_
=
GET_PARAM
(
1
);
bit_depth_
=
GET_PARAM
(
2
);
threshold_
=
GET_PARAM
(
3
);
}
virtual
void
TearDown
()
{}
};
TEST_P
(
HBDMetricsTest
,
RunAccuracyCheck
)
{
RunAccuracyCheck
();
}
// Allow small variation due to floating point operations.
static
const
double
kSsim_thresh
=
0.001
;
INSTANTIATE_TEST_CASE_P
(
C
,
HBDMetricsTest
,
::
testing
::
Values
(
MetricTestTParam
(
&
vpx_calc_ssim
,
&
vpx_highbd_calc_ssim
,
10
,
kSsim_thresh
),
MetricTestTParam
(
&
vpx_calc_ssim
,
&
vpx_highbd_calc_ssim
,
12
,
kSsim_thresh
)));
}
// namespace
test/test.mk
View file @
6eaca90d
...
...
@@ -171,11 +171,12 @@ LIBVPX_TEST_SRCS-$(CONFIG_ANS) += vp10_ans_test.cc
endif
# VP10
## Multi-codec / unconditional whitebox tests.
ifeq
($(findstring yes,$(CONFIG_VP9_ENCODER)$(CONFIG_VP10_ENCODER)),yes)
LIBVPX_TEST_SRCS-yes
+=
avg_test.cc
endif
ifeq
($(CONFIG_INTERNAL_STATS),yes)
LIBVPX_TEST_SRCS-$(CONFIG_VP9_HIGHBITDEPTH)
+=
hbd_metrics_test.cc
endif
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)
+=
sad_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP10)
+=
vp10_txfm_test.h
LIBVPX_TEST_SRCS-$(CONFIG_VP10)
+=
vp10_fwd_txfm1d_test.cc
...
...
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