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
ed9e0d0b
Commit
ed9e0d0b
authored
Jul 13, 2017
by
Sebastien Alaiwan
Browse files
Unify the many definitions of NELEMENTS
Change-Id: Ie52ce24ca9eca272dfacfb17483ec7b7f2c126d4
parent
49bb8f8c
Changes
9
Hide whitespace changes
Inline
Side-by-side
aom/aom_integer.h
View file @
ed9e0d0b
...
...
@@ -61,4 +61,6 @@ typedef size_t uintptr_t;
#include
<inttypes.h>
#endif
#define NELEMENTS(x) (int)(sizeof(x) / sizeof(x[0]))
#endif // AOM_AOM_INTEGER_H_
aom_dsp/aom_dsp_common.h
View file @
ed9e0d0b
...
...
@@ -31,8 +31,6 @@ extern "C" {
#define AOMMIN(x, y) (((x) < (y)) ? (x) : (y))
#define AOMMAX(x, y) (((x) > (y)) ? (x) : (y))
#define NELEMENTS(x) (sizeof((x)) / sizeof((x)[0]))
#define IMPLIES(a, b) (!(a) || (b)) // Logical 'a implies b' (or 'a -> b')
#define IS_POWER_OF_TWO(x) (((x) & ((x)-1)) == 0)
...
...
test/av1_convolve_test.cc
View file @
ed9e0d0b
...
...
@@ -145,7 +145,7 @@ class Av1ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
};
int
bsize_ls
[]
=
{
1
,
2
,
4
,
8
,
16
,
32
,
64
,
3
,
7
,
15
,
31
,
63
};
int
bsize_num
=
sizeof
(
bsize_ls
)
/
sizeof
(
bsize_ls
[
0
]
);
int
bsize_num
=
NELEMENTS
(
bsize_ls
);
TEST_P
(
Av1ConvolveTest
,
av1_convolve_vert
)
{
const
int
y_step_q4
=
16
;
...
...
test/av1_inv_txfm1d_test.cc
View file @
ed9e0d0b
...
...
@@ -47,7 +47,7 @@ const int8_t range_bit[12] = { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
TEST
(
av1_inv_txfm1d
,
round_trip
)
{
ACMRandom
rnd
(
ACMRandom
::
DeterministicSeed
());
for
(
int
si
=
0
;
si
<
ARRAY_SIZE
(
fwd_txfm_func_ls
);
++
si
)
{
for
(
int
si
=
0
;
si
<
NELEMENTS
(
fwd_txfm_func_ls
);
++
si
)
{
int
txfm_size
=
txfm_size_ls
[
si
];
for
(
int
ti
=
0
;
ti
<
txfm_type_num
;
++
ti
)
{
...
...
@@ -63,7 +63,7 @@ TEST(av1_inv_txfm1d, round_trip) {
int32_t
output
[
64
];
int32_t
round_trip_output
[
64
];
assert
(
txfm_size
<=
ARRAY_SIZE
(
input
));
assert
(
txfm_size
<=
NELEMENTS
(
input
));
for
(
int
ni
=
0
;
ni
<
txfm_size
;
++
ni
)
{
input
[
ni
]
=
rnd
.
Rand16
()
%
input_base
-
rnd
.
Rand16
()
%
input_base
;
...
...
test/av1_inv_txfm2d_test.cc
View file @
ed9e0d0b
...
...
@@ -56,7 +56,7 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
for
(
int
ci
=
0
;
ci
<
count
;
ci
++
)
{
int16_t
expected
[
64
*
64
]
=
{
0
};
assert
(
txfm2d_size_
<
ARRAY_SIZE
(
expected
));
assert
(
txfm2d_size_
<
NELEMENTS
(
expected
));
for
(
int
ni
=
0
;
ni
<
txfm2d_size_
;
++
ni
)
{
if
(
ci
==
0
)
{
...
...
@@ -68,11 +68,11 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
}
int32_t
coeffs
[
64
*
64
]
=
{
0
};
assert
(
txfm2d_size_
<
ARRAY_SIZE
(
coeffs
));
assert
(
txfm2d_size_
<
NELEMENTS
(
coeffs
));
fwd_txfm_func
(
expected
,
coeffs
,
txfm1d_size_
,
tx_type_
,
bd
);
uint16_t
actual
[
64
*
64
]
=
{
0
};
assert
(
txfm2d_size_
<
ARRAY_SIZE
(
actual
));
assert
(
txfm2d_size_
<
NELEMENTS
(
actual
));
inv_txfm_func
(
coeffs
,
actual
,
txfm1d_size_
,
tx_type_
,
bd
);
for
(
int
ni
=
0
;
ni
<
txfm2d_size_
;
++
ni
)
{
...
...
test/decode_api_test.cc
View file @
ed9e0d0b
...
...
@@ -13,13 +13,12 @@
#include
"./aom_config.h"
#include
"test/ivf_video_source.h"
#include
"test/util.h"
#include
"aom/aomdx.h"
#include
"aom/aom_decoder.h"
namespace
{
#define NELEMENTS(x) static_cast<int>(sizeof(x) / sizeof(x[0]))
TEST
(
DecodeAPI
,
InvalidParams
)
{
static
const
aom_codec_iface_t
*
kCodecs
[]
=
{
#if CONFIG_AV1_DECODER
...
...
test/encode_api_test.cc
View file @
ed9e0d0b
...
...
@@ -12,13 +12,12 @@
#include
"third_party/googletest/src/googletest/include/gtest/gtest.h"
#include
"./aom_config.h"
#include
"test/util.h"
#include
"aom/aomcx.h"
#include
"aom/aom_encoder.h"
namespace
{
#define NELEMENTS(x) static_cast<int>(sizeof(x) / sizeof(x[0]))
TEST
(
EncodeAPI
,
InvalidParams
)
{
static
const
aom_codec_iface_t
*
kCodecs
[]
=
{
#if CONFIG_AV1_ENCODER
...
...
test/encode_perf_test.cc
View file @
ed9e0d0b
...
...
@@ -53,8 +53,6 @@ const EncodePerfTestVideo kAV1EncodePerfTestVectors[] = {
const
int
kEncodePerfTestSpeeds
[]
=
{
5
,
6
,
7
,
8
};
const
int
kEncodePerfTestThreads
[]
=
{
1
,
2
,
4
};
#define NELEMENTS(x) (sizeof((x)) / sizeof((x)[0]))
class
AV1EncodePerfTest
:
public
::
libaom_test
::
CodecTestWithParam
<
libaom_test
::
TestMode
>
,
public
::
libaom_test
::
EncoderTest
{
...
...
test/util.h
View file @
ed9e0d0b
...
...
@@ -15,10 +15,9 @@
#include
<stdio.h>
#include
<math.h>
#include
"third_party/googletest/src/googletest/include/gtest/gtest.h"
#include
"aom/aom_integer.h"
#include
"aom/aom_image.h"
#define ARRAY_SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
// Macros
#define GET_PARAM(k) std::tr1::get<k>(GetParam())
...
...
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