Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
a3cff082
Commit
a3cff082
authored
Aug 03, 2016
by
Yaowu Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more cleanup of vp8 and vp9
Change-Id: Ic90ebe6136f4b75645ba699d49c0bcb3764ddccf
parent
b06147de
Changes
58
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
58 changed files
with
222 additions
and
3183 deletions
+222
-3183
configure
configure
+1
-1
examples.mk
examples.mk
+2
-16
examples/lossless_encoder.c
examples/lossless_encoder.c
+1
-1
examples/postproc.c
examples/postproc.c
+0
-138
examples/vpxcx_set_ref.c
examples/vpxcx_set_ref.c
+3
-3
test/altref_test.cc
test/altref_test.cc
+0
-5
test/blockiness_test.cc
test/blockiness_test.cc
+0
-227
test/consistency_test.cc
test/consistency_test.cc
+0
-143
test/datarate_test.cc
test/datarate_test.cc
+0
-53
test/decode_api_test.cc
test/decode_api_test.cc
+0
-87
test/encode_test_driver.cc
test/encode_test_driver.cc
+0
-15
test/postproc.sh
test/postproc.sh
+0
-63
test/test-data.mk
test/test-data.mk
+10
-757
test/test-data.sha1
test/test-data.sha1
+0
-769
test/test.mk
test/test.mk
+1
-6
test/test_vector_test.cc
test/test_vector_test.cc
+0
-192
test/test_vectors.cc
test/test_vectors.cc
+0
-251
test/test_vectors.h
test/test_vectors.h
+0
-32
test/tools_common.sh
test/tools_common.sh
+6
-18
usage.dox
usage.dox
+0
-1
vp10/common/alloccommon.h
vp10/common/alloccommon.h
+0
-1
vp10/common/frame_buffers.c
vp10/common/frame_buffers.c
+1
-1
vp10/common/mips/msa/idct4x4_msa.c
vp10/common/mips/msa/idct4x4_msa.c
+4
-4
vp10/common/mips/msa/idct8x8_msa.c
vp10/common/mips/msa/idct8x8_msa.c
+6
-6
vp10/common/onyxc_int.h
vp10/common/onyxc_int.h
+3
-3
vp10/common/textblit.c
vp10/common/textblit.c
+0
-120
vp10/common/textblit.h
vp10/common/textblit.h
+0
-27
vp10/common/vp10_inv_txfm.h
vp10/common/vp10_inv_txfm.h
+1
-1
vp10/encoder/bitstream.c
vp10/encoder/bitstream.c
+0
-1
vp10/encoder/mips/msa/fdct4x4_msa.c
vp10/encoder/mips/msa/fdct4x4_msa.c
+4
-4
vp10/encoder/mips/msa/fdct_msa.h
vp10/encoder/mips/msa/fdct_msa.h
+3
-3
vp10/vp10_common.mk
vp10/vp10_common.mk
+0
-2
vp10/vp10_dx_iface.c
vp10/vp10_dx_iface.c
+1
-1
vpx/internal/vpx_codec_internal.h
vpx/internal/vpx_codec_internal.h
+1
-1
vpx/vpx_codec.mk
vpx/vpx_codec.mk
+0
-4
vpx/vpx_decoder.h
vpx/vpx_decoder.h
+1
-1
vpx/vpx_frame_buffer.h
vpx/vpx_frame_buffer.h
+1
-1
vpx_dsp/deblock.c
vpx_dsp/deblock.c
+0
-10
vpx_dsp/inv_txfm.h
vpx_dsp/inv_txfm.h
+1
-1
vpx_dsp/mips/fwd_txfm_msa.c
vpx_dsp/mips/fwd_txfm_msa.c
+2
-2
vpx_dsp/mips/fwd_txfm_msa.h
vpx_dsp/mips/fwd_txfm_msa.h
+1
-1
vpx_dsp/mips/idct16x16_msa.c
vpx_dsp/mips/idct16x16_msa.c
+33
-33
vpx_dsp/mips/idct32x32_msa.c
vpx_dsp/mips/idct32x32_msa.c
+8
-8
vpx_dsp/mips/idct4x4_msa.c
vpx_dsp/mips/idct4x4_msa.c
+2
-2
vpx_dsp/mips/idct8x8_msa.c
vpx_dsp/mips/idct8x8_msa.c
+18
-18
vpx_dsp/mips/inv_txfm_msa.h
vpx_dsp/mips/inv_txfm_msa.h
+39
-39
vpx_dsp/mips/loopfilter_16_msa.c
vpx_dsp/mips/loopfilter_16_msa.c
+18
-18
vpx_dsp/mips/loopfilter_4_msa.c
vpx_dsp/mips/loopfilter_4_msa.c
+4
-4
vpx_dsp/mips/loopfilter_8_msa.c
vpx_dsp/mips/loopfilter_8_msa.c
+14
-14
vpx_dsp/mips/loopfilter_filters_dspr2.h
vpx_dsp/mips/loopfilter_filters_dspr2.h
+3
-3
vpx_dsp/mips/loopfilter_macros_dspr2.h
vpx_dsp/mips/loopfilter_macros_dspr2.h
+3
-3
vpx_dsp/mips/loopfilter_masks_dspr2.h
vpx_dsp/mips/loopfilter_masks_dspr2.h
+3
-3
vpx_dsp/mips/loopfilter_msa.h
vpx_dsp/mips/loopfilter_msa.h
+5
-5
vpx_dsp/vpx_dsp.mk
vpx_dsp/vpx_dsp.mk
+5
-15
vpx_dsp/vpx_dsp_rtcd_defs.pl
vpx_dsp/vpx_dsp_rtcd_defs.pl
+8
-28
vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c
vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c
+1
-1
vpx_ports/x86_abi_support.asm
vpx_ports/x86_abi_support.asm
+0
-12
vpx_scale/generic/yv12config.c
vpx_scale/generic/yv12config.c
+4
-4
No files found.
configure
View file @
a3cff082
...
...
@@ -34,7 +34,7 @@ Advanced options:
${
toggle_codec_srcs
}
in/exclude codec library source code
${
toggle_debug_libs
}
in/exclude debug version of libraries
${
toggle_static_msvcrt
}
use static MSVCRT (VS builds only)
${
toggle_vp9_highbitdepth
}
use
VP9
high bit depth (10/12) profiles
${
toggle_vp9_highbitdepth
}
use high bit depth (10/12) profiles
${
toggle_better_hw_compatibility
}
enable encoder to produce streams with better
hardware decoder compatibility
...
...
examples.mk
View file @
a3cff082
...
...
@@ -109,10 +109,6 @@ endif
vpxenc.GUID
=
548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
vpxenc.DESCRIPTION
=
Full featured encoder
ifneq
($(CONFIG_SHARED),yes)
EXAMPLES-$(CONFIG_VP9_ENCODER)
+=
resize_util.c
endif
EXAMPLES-$(CONFIG_ENCODERS)
+=
vpx_temporal_svc_encoder.c
vpx_temporal_svc_encoder.SRCS
+=
ivfenc.c ivfenc.h
vpx_temporal_svc_encoder.SRCS
+=
tools_common.c tools_common.h
...
...
@@ -131,16 +127,6 @@ simple_decoder.SRCS += vpx_ports/mem_ops.h
simple_decoder.SRCS
+=
vpx_ports/mem_ops_aligned.h
simple_decoder.SRCS
+=
vpx_ports/msvc.h
simple_decoder.DESCRIPTION
=
Simplified decoder loop
EXAMPLES-$(CONFIG_DECODERS)
+=
postproc.c
postproc.SRCS
+=
ivfdec.h ivfdec.c
postproc.SRCS
+=
tools_common.h tools_common.c
postproc.SRCS
+=
video_common.h
postproc.SRCS
+=
video_reader.h video_reader.c
postproc.SRCS
+=
vpx_ports/mem_ops.h
postproc.SRCS
+=
vpx_ports/mem_ops_aligned.h
postproc.SRCS
+=
vpx_ports/msvc.h
postproc.GUID
=
65E33355-F35E-4088-884D-3FD4905881D7
postproc.DESCRIPTION
=
Decoder postprocessor control
EXAMPLES-$(CONFIG_DECODERS)
+=
decode_to_md5.c
decode_to_md5.SRCS
+=
md5_utils.h md5_utils.c
decode_to_md5.SRCS
+=
ivfdec.h ivfdec.c
...
...
@@ -167,7 +153,7 @@ lossless_encoder.SRCS += video_common.h
lossless_encoder.SRCS
+=
video_writer.h video_writer.c
lossless_encoder.SRCS
+=
vpx_ports/msvc.h
lossless_encoder.GUID
=
B63C7C88-5348-46DC-A5A6-CC151EF93366
lossless_encoder.DESCRIPTION
=
Simplified lossless
VP9
encoder
lossless_encoder.DESCRIPTION
=
Simplified lossless encoder
EXAMPLES-$(CONFIG_ENCODERS)
+=
twopass_encoder.c
twopass_encoder.SRCS
+=
ivfenc.h ivfenc.c
twopass_encoder.SRCS
+=
tools_common.h tools_common.c
...
...
@@ -204,7 +190,7 @@ vpxcx_set_ref.SRCS += tools_common.h tools_common.c
vpxcx_set_ref.SRCS
+=
video_common.h
vpxcx_set_ref.SRCS
+=
video_writer.h video_writer.c
vpxcx_set_ref.GUID
=
65D7F14A-2EE6-4293-B958-AB5107A03B55
vpxcx_set_ref.DESCRIPTION
=
VP9/
VP10
set
encoder reference frame
vpxcx_set_ref.DESCRIPTION
=
VP10
set
encoder reference frame
endif
endif
...
...
examples/lossless_encoder.c
View file @
a3cff082
...
...
@@ -21,7 +21,7 @@
static
const
char
*
exec_name
;
void
usage_exit
(
void
)
{
fprintf
(
stderr
,
"
vp9_
lossless_encoder: Example demonstrating
VP9
lossless "
fprintf
(
stderr
,
"lossless_encoder: Example demonstrating lossless "
"encoding feature. Supports raw input only.
\n
"
);
fprintf
(
stderr
,
"Usage: %s <width> <height> <infile> <outfile>
\n
"
,
exec_name
);
exit
(
EXIT_FAILURE
);
...
...
examples/postproc.c
deleted
100644 → 0
View file @
b06147de
/*
* 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.
*/
// Postprocessing Decoder
// ======================
//
// This example adds postprocessing to the simple decoder loop.
//
// Initializing Postprocessing
// ---------------------------
// You must inform the codec that you might request postprocessing at
// initialization time. This is done by passing the VPX_CODEC_USE_POSTPROC
// flag to `vpx_codec_dec_init`. If the codec does not support
// postprocessing, this call will return VPX_CODEC_INCAPABLE. For
// demonstration purposes, we also fall back to default initialization if
// the codec does not provide support.
//
// Using Adaptive Postprocessing
// -----------------------------
// VP6 provides "adaptive postprocessing." It will automatically select the
// best postprocessing filter on a frame by frame basis based on the amount
// of time remaining before the user's specified deadline expires. The
// special value 0 indicates that the codec should take as long as
// necessary to provide the best quality frame. This example gives the
// codec 15ms (15000us) to return a frame. Remember that this is a soft
// deadline, and the codec may exceed it doing its regular processing. In
// these cases, no additional postprocessing will be done.
//
// Codec Specific Postprocessing Controls
// --------------------------------------
// Some codecs provide fine grained controls over their built-in
// postprocessors. VP8 is one example. The following sample code toggles
// postprocessing on and off every 15 frames.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vpx/vp8dx.h"
#include "vpx/vpx_decoder.h"
#include "../tools_common.h"
#include "../video_reader.h"
#include "./vpx_config.h"
static
const
char
*
exec_name
;
void
usage_exit
(
void
)
{
fprintf
(
stderr
,
"Usage: %s <infile> <outfile>
\n
"
,
exec_name
);
exit
(
EXIT_FAILURE
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
frame_cnt
=
0
;
FILE
*
outfile
=
NULL
;
vpx_codec_ctx_t
codec
;
vpx_codec_err_t
res
;
VpxVideoReader
*
reader
=
NULL
;
const
VpxInterface
*
decoder
=
NULL
;
const
VpxVideoInfo
*
info
=
NULL
;
exec_name
=
argv
[
0
];
if
(
argc
!=
3
)
die
(
"Invalid number of arguments."
);
reader
=
vpx_video_reader_open
(
argv
[
1
]);
if
(
!
reader
)
die
(
"Failed to open %s for reading."
,
argv
[
1
]);
if
(
!
(
outfile
=
fopen
(
argv
[
2
],
"wb"
)))
die
(
"Failed to open %s for writing"
,
argv
[
2
]);
info
=
vpx_video_reader_get_info
(
reader
);
decoder
=
get_vpx_decoder_by_fourcc
(
info
->
codec_fourcc
);
if
(
!
decoder
)
die
(
"Unknown input codec."
);
printf
(
"Using %s
\n
"
,
vpx_codec_iface_name
(
decoder
->
codec_interface
()));
res
=
vpx_codec_dec_init
(
&
codec
,
decoder
->
codec_interface
(),
NULL
,
VPX_CODEC_USE_POSTPROC
);
if
(
res
==
VPX_CODEC_INCAPABLE
)
die_codec
(
&
codec
,
"Postproc not supported by this decoder."
);
if
(
res
)
die_codec
(
&
codec
,
"Failed to initialize decoder."
);
while
(
vpx_video_reader_read_frame
(
reader
))
{
vpx_codec_iter_t
iter
=
NULL
;
vpx_image_t
*
img
=
NULL
;
size_t
frame_size
=
0
;
const
unsigned
char
*
frame
=
vpx_video_reader_get_frame
(
reader
,
&
frame_size
);
++
frame_cnt
;
if
(
frame_cnt
%
30
==
1
)
{
vp8_postproc_cfg_t
pp
=
{
0
,
0
,
0
};
if
(
vpx_codec_control
(
&
codec
,
VP8_SET_POSTPROC
,
&
pp
))
die_codec
(
&
codec
,
"Failed to turn off postproc."
);
}
else
if
(
frame_cnt
%
30
==
16
)
{
vp8_postproc_cfg_t
pp
=
{
VP8_DEBLOCK
|
VP8_DEMACROBLOCK
|
VP8_MFQE
,
4
,
0
};
if
(
vpx_codec_control
(
&
codec
,
VP8_SET_POSTPROC
,
&
pp
))
die_codec
(
&
codec
,
"Failed to turn on postproc."
);
};
// Decode the frame with 15ms deadline
if
(
vpx_codec_decode
(
&
codec
,
frame
,
(
unsigned
int
)
frame_size
,
NULL
,
15000
))
die_codec
(
&
codec
,
"Failed to decode frame"
);
while
((
img
=
vpx_codec_get_frame
(
&
codec
,
&
iter
))
!=
NULL
)
{
vpx_img_write
(
img
,
outfile
);
}
}
printf
(
"Processed %d frames.
\n
"
,
frame_cnt
);
if
(
vpx_codec_destroy
(
&
codec
))
die_codec
(
&
codec
,
"Failed to destroy codec"
);
printf
(
"Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s
\n
"
,
info
->
frame_width
,
info
->
frame_height
,
argv
[
2
]);
vpx_video_reader_close
(
reader
);
fclose
(
outfile
);
return
EXIT_SUCCESS
;
}
examples/vpxcx_set_ref.c
View file @
a3cff082
...
...
@@ -9,10 +9,10 @@
*/
//
VP9/
VP10 Set Reference Frame
// VP10 Set Reference Frame
// ============================
//
// This is an example demonstrating how to overwrite the
VP9/
VP10 encoder's
// This is an example demonstrating how to overwrite the VP10 encoder's
// internal reference frame. In the sample we set the last frame to the
// current frame. This technique could be used to bounce between two cameras.
//
...
...
@@ -334,7 +334,7 @@ int main(int argc, char **argv) {
die
(
"Unsupported codec."
);
update_frame_num
=
atoi
(
argv
[
6
]);
// In VP
9
, the reference buffers (cm->buffer_pool->frame_bufs[i].buf) are
// In VP
10
, the reference buffers (cm->buffer_pool->frame_bufs[i].buf) are
// allocated while calling vpx_codec_encode(), thus, setting reference for
// 1st frame isn't supported.
if
(
update_frame_num
<=
1
)
...
...
test/altref_test.cc
View file @
a3cff082
...
...
@@ -39,11 +39,6 @@ class AltRefForcedKeyTestLarge
encoder
->
Control
(
VP8E_SET_CPUUSED
,
cpu_used_
);
encoder
->
Control
(
VP8E_SET_ENABLEAUTOALTREF
,
1
);
// override test default for tile columns if necessary.
#if CONFIG_VP9_ENCODER
if
(
GET_PARAM
(
0
)
==
&
libvpx_test
::
kVP9
)
{
encoder
->
Control
(
VP9E_SET_TILE_COLUMNS
,
6
);
}
#endif
#if CONFIG_VP10_ENCODER
if
(
GET_PARAM
(
0
)
==
&
libvpx_test
::
kVP10
)
{
encoder
->
Control
(
VP9E_SET_TILE_COLUMNS
,
6
);
...
...
test/blockiness_test.cc
deleted
100644 → 0
View file @
b06147de
/*
* Copyright (c) 2012 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 <limits.h>
#include <stdio.h>
#include <string.h>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "./vpx_config.h"
#include "test/acm_random.h"
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
#include "test/util.h"
#include "vpx_mem/vpx_mem.h"
extern
"C"
double
vp9_get_blockiness
(
const
unsigned
char
*
img1
,
int
img1_pitch
,
const
unsigned
char
*
img2
,
int
img2_pitch
,
int
width
,
int
height
);
using
libvpx_test
::
ACMRandom
;
namespace
{
class
BlockinessTestBase
:
public
::
testing
::
Test
{
public:
BlockinessTestBase
(
int
width
,
int
height
)
:
width_
(
width
),
height_
(
height
)
{}
static
void
SetUpTestCase
()
{
source_data_
=
reinterpret_cast
<
uint8_t
*>
(
vpx_memalign
(
kDataAlignment
,
kDataBufferSize
));
reference_data_
=
reinterpret_cast
<
uint8_t
*>
(
vpx_memalign
(
kDataAlignment
,
kDataBufferSize
));
}
static
void
TearDownTestCase
()
{
vpx_free
(
source_data_
);
source_data_
=
NULL
;
vpx_free
(
reference_data_
);
reference_data_
=
NULL
;
}
virtual
void
TearDown
()
{
libvpx_test
::
ClearSystemState
();
}
protected:
// Handle frames up to 640x480
static
const
int
kDataAlignment
=
16
;
static
const
int
kDataBufferSize
=
640
*
480
;
virtual
void
SetUp
()
{
source_stride_
=
(
width_
+
31
)
&
~
31
;
reference_stride_
=
width_
*
2
;
rnd_
.
Reset
(
ACMRandom
::
DeterministicSeed
());
}
void
FillConstant
(
uint8_t
*
data
,
int
stride
,
uint8_t
fill_constant
,
int
width
,
int
height
)
{
for
(
int
h
=
0
;
h
<
height
;
++
h
)
{
for
(
int
w
=
0
;
w
<
width
;
++
w
)
{
data
[
h
*
stride
+
w
]
=
fill_constant
;
}
}
}
void
FillConstant
(
uint8_t
*
data
,
int
stride
,
uint8_t
fill_constant
)
{
FillConstant
(
data
,
stride
,
fill_constant
,
width_
,
height_
);
}
void
FillRandom
(
uint8_t
*
data
,
int
stride
,
int
width
,
int
height
)
{
for
(
int
h
=
0
;
h
<
height
;
++
h
)
{
for
(
int
w
=
0
;
w
<
width
;
++
w
)
{
data
[
h
*
stride
+
w
]
=
rnd_
.
Rand8
();
}
}
}
void
FillRandom
(
uint8_t
*
data
,
int
stride
)
{
FillRandom
(
data
,
stride
,
width_
,
height_
);
}
void
FillRandomBlocky
(
uint8_t
*
data
,
int
stride
)
{
for
(
int
h
=
0
;
h
<
height_
;
h
+=
4
)
{
for
(
int
w
=
0
;
w
<
width_
;
w
+=
4
)
{
FillRandom
(
data
+
h
*
stride
+
w
,
stride
,
4
,
4
);
}
}
}
void
FillCheckerboard
(
uint8_t
*
data
,
int
stride
)
{
for
(
int
h
=
0
;
h
<
height_
;
h
+=
4
)
{
for
(
int
w
=
0
;
w
<
width_
;
w
+=
4
)
{
if
(((
h
/
4
)
^
(
w
/
4
))
&
1
)
FillConstant
(
data
+
h
*
stride
+
w
,
stride
,
255
,
4
,
4
);
else
FillConstant
(
data
+
h
*
stride
+
w
,
stride
,
0
,
4
,
4
);
}
}
}
void
Blur
(
uint8_t
*
data
,
int
stride
,
int
taps
)
{
int
sum
=
0
;
int
half_taps
=
taps
/
2
;
for
(
int
h
=
0
;
h
<
height_
;
++
h
)
{
for
(
int
w
=
0
;
w
<
taps
;
++
w
)
{
sum
+=
data
[
w
+
h
*
stride
];
}
for
(
int
w
=
taps
;
w
<
width_
;
++
w
)
{
sum
+=
data
[
w
+
h
*
stride
]
-
data
[
w
-
taps
+
h
*
stride
];
data
[
w
-
half_taps
+
h
*
stride
]
=
(
sum
+
half_taps
)
/
taps
;
}
}
for
(
int
w
=
0
;
w
<
width_
;
++
w
)
{
for
(
int
h
=
0
;
h
<
taps
;
++
h
)
{
sum
+=
data
[
h
+
w
*
stride
];
}
for
(
int
h
=
taps
;
h
<
height_
;
++
h
)
{
sum
+=
data
[
w
+
h
*
stride
]
-
data
[(
h
-
taps
)
*
stride
+
w
];
data
[(
h
-
half_taps
)
*
stride
+
w
]
=
(
sum
+
half_taps
)
/
taps
;
}
}
}
int
width_
,
height_
;
static
uint8_t
*
source_data_
;
int
source_stride_
;
static
uint8_t
*
reference_data_
;
int
reference_stride_
;
ACMRandom
rnd_
;
};
#if CONFIG_VP9_ENCODER
typedef
std
::
tr1
::
tuple
<
int
,
int
>
BlockinessParam
;
class
BlockinessVP9Test
:
public
BlockinessTestBase
,
public
::
testing
::
WithParamInterface
<
BlockinessParam
>
{
public:
BlockinessVP9Test
()
:
BlockinessTestBase
(
GET_PARAM
(
0
),
GET_PARAM
(
1
))
{}
protected:
double
GetBlockiness
()
const
{
return
vp9_get_blockiness
(
source_data_
,
source_stride_
,
reference_data_
,
reference_stride_
,
width_
,
height_
);
}
};
#endif // CONFIG_VP9_ENCODER
uint8_t
*
BlockinessTestBase
::
source_data_
=
NULL
;
uint8_t
*
BlockinessTestBase
::
reference_data_
=
NULL
;
#if CONFIG_VP9_ENCODER
TEST_P
(
BlockinessVP9Test
,
SourceBlockierThanReference
)
{
// Source is blockier than reference.
FillRandomBlocky
(
source_data_
,
source_stride_
);
FillConstant
(
reference_data_
,
reference_stride_
,
128
);
const
double
super_blocky
=
GetBlockiness
();
EXPECT_DOUBLE_EQ
(
0.0
,
super_blocky
)
<<
"Blocky source should produce 0 blockiness."
;
}
TEST_P
(
BlockinessVP9Test
,
ReferenceBlockierThanSource
)
{
// Source is blockier than reference.
FillConstant
(
source_data_
,
source_stride_
,
128
);
FillRandomBlocky
(
reference_data_
,
reference_stride_
);
const
double
super_blocky
=
GetBlockiness
();
EXPECT_GT
(
super_blocky
,
0.0
)
<<
"Blocky reference should score high for blockiness."
;
}
TEST_P
(
BlockinessVP9Test
,
BlurringDecreasesBlockiness
)
{
// Source is blockier than reference.
FillConstant
(
source_data_
,
source_stride_
,
128
);
FillRandomBlocky
(
reference_data_
,
reference_stride_
);
const
double
super_blocky
=
GetBlockiness
();
Blur
(
reference_data_
,
reference_stride_
,
4
);
const
double
less_blocky
=
GetBlockiness
();
EXPECT_GT
(
super_blocky
,
less_blocky
)
<<
"A straight blur should decrease blockiness."
;
}
TEST_P
(
BlockinessVP9Test
,
WorstCaseBlockiness
)
{
// Source is blockier than reference.
FillConstant
(
source_data_
,
source_stride_
,
128
);
FillCheckerboard
(
reference_data_
,
reference_stride_
);
const
double
super_blocky
=
GetBlockiness
();
Blur
(
reference_data_
,
reference_stride_
,
4
);
const
double
less_blocky
=
GetBlockiness
();
EXPECT_GT
(
super_blocky
,
less_blocky
)
<<
"A straight blur should decrease blockiness."
;
}
#endif // CONFIG_VP9_ENCODER
using
std
::
tr1
::
make_tuple
;
//------------------------------------------------------------------------------
// C functions
#if CONFIG_VP9_ENCODER
const
BlockinessParam
c_vp9_tests
[]
=
{
make_tuple
(
320
,
240
),
make_tuple
(
318
,
242
),
make_tuple
(
318
,
238
),
};
INSTANTIATE_TEST_CASE_P
(
C
,
BlockinessVP9Test
,
::
testing
::
ValuesIn
(
c_vp9_tests
));
#endif
}
// namespace
test/consistency_test.cc
deleted
100644 → 0
View file @
b06147de
/*
* Copyright (c) 2012 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 <limits.h>
#include <stdio.h>
#include <string.h>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "./vpx_config.h"
#include "test/acm_random.h"
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
#include "test/util.h"
#include "vpx_dsp/ssim.h"
#include "vpx_mem/vpx_mem.h"
extern
"C"
double
vpx_get_ssim_metrics
(
uint8_t
*
img1
,
int
img1_pitch
,
uint8_t
*
img2
,
int
img2_pitch
,
int
width
,
int
height
,
Ssimv
*
sv2
,
Metrics
*
m
,
int
do_inconsistency
);
using
libvpx_test
::
ACMRandom
;
namespace
{
class
ConsistencyTestBase
:
public
::
testing
::
Test
{
public:
ConsistencyTestBase
(
int
width
,
int
height
)
:
width_
(
width
),
height_
(
height
)
{}
static
void
SetUpTestCase
()
{
source_data_
[
0
]
=
reinterpret_cast
<
uint8_t
*>
(
vpx_memalign
(
kDataAlignment
,
kDataBufferSize
));
reference_data_
[
0
]
=
reinterpret_cast
<
uint8_t
*>
(
vpx_memalign
(
kDataAlignment
,
kDataBufferSize
));
source_data_
[
1
]
=
reinterpret_cast
<
uint8_t
*>
(
vpx_memalign
(
kDataAlignment
,
kDataBufferSize
));
reference_data_
[
1
]
=
reinterpret_cast
<
uint8_t
*>
(
vpx_memalign
(
kDataAlignment
,
kDataBufferSize
));
ssim_array_
=
new
Ssimv
[
kDataBufferSize
/
16
];
}
static
void
ClearSsim
()
{
memset
(
ssim_array_
,
0
,
kDataBufferSize
/
16
);
}
static
void
TearDownTestCase
()
{
vpx_free
(
source_data_
[
0
]);
source_data_
[
0
]
=
NULL
;
vpx_free
(
reference_data_
[
0
]);
reference_data_
[
0
]
=
NULL
;
vpx_free
(
source_data_
[
1
]);
source_data_
[
1
]
=
NULL
;
vpx_free
(
reference_data_
[
1
]);
reference_data_
[
1
]
=
NULL
;
delete
[]
ssim_array_
;
}
virtual
void
TearDown
()
{
libvpx_test
::
ClearSystemState
();
}
protected:
// Handle frames up to 640x480
static
const
int
kDataAlignment
=
16
;
static
const
int
kDataBufferSize
=
640
*
480
;
virtual
void
SetUp
()
{
source_stride_
=
(
width_
+
31
)
&
~
31
;
reference_stride_
=
width_
*
2
;
rnd_
.
Reset
(
ACMRandom
::
DeterministicSeed
());
}
void
FillRandom
(
uint8_t
*
data
,
int
stride
,
int
width
,
int
height
)
{
for
(
int
h
=
0
;
h
<
height
;
++
h
)
{
for
(
int
w
=
0
;
w
<
width
;
++
w
)
{
data
[
h
*
stride
+
w
]
=
rnd_
.
Rand8
();
}
}
}
void
FillRandom
(
uint8_t
*
data
,
int
stride
)
{
FillRandom
(
data
,
stride
,
width_
,
height_
);
}
void
Copy
(
uint8_t
*
reference
,
uint8_t
*
source
)
{
memcpy
(
reference
,
source
,
kDataBufferSize
);
}
void
Blur
(
uint8_t
*
data
,
int
stride
,
int
taps
)
{
int
sum
=
0
;
int
half_taps
=
taps
/
2
;
for
(
int
h
=
0
;
h
<
height_
;
++
h
)
{
for
(
int
w
=
0
;
w
<
taps
;
++
w
)
{
sum
+=
data
[
w
+
h
*
stride
];
}
for
(
int
w
=
taps
;
w
<
width_
;
++
w
)
{
sum
+=
data
[
w
+
h
*
stride
]
-
data
[
w
-
taps
+
h
*
stride
];
data
[
w
-
half_taps
+
h
*
stride
]
=
(
sum
+
half_taps
)
/
taps
;
}
}
for
(
int
w
=
0
;
w
<
width_
;
++
w
)
{
for
(
int
h
=
0
;
h
<
taps
;
++
h
)
{
sum
+=
data
[
h
+
w
*
stride
];
}
for
(
int
h
=
taps
;
h
<
height_
;
++
h
)
{
sum
+=
data
[
w
+
h
*
stride
]
-
data
[(
h
-
taps
)
*
stride
+
w
];
data
[(
h
-
half_taps
)
*
stride
+
w
]
=
(
sum
+
half_taps
)
/
taps
;
}
}
}
int
width_
,
height_
;
static
uint8_t
*
source_data_
[
2
];
int
source_stride_
;
static
uint8_t
*
reference_data_
[
2
];
int
reference_stride_
;
static
Ssimv
*
ssim_array_
;
Metrics
metrics_
;
ACMRandom
rnd_
;
};