Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
980f81d9
Commit
980f81d9
authored
Jun 20, 2012
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use av_gettime() in various places
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
ae0a3016
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
35 deletions
+13
-35
dct-test.c
libavcodec/dct-test.c
+5
-12
fft-test.c
libavcodec/fft-test.c
+3
-10
motion-test.c
libavcodec/motion-test.c
+3
-9
des.c
libavutil/des.c
+2
-4
No files found.
libavcodec/dct-test.c
View file @
980f81d9
...
@@ -28,13 +28,13 @@
...
@@ -28,13 +28,13 @@
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <unistd.h>
#include <math.h>
#include <math.h>
#include "libavutil/cpu.h"
#include "libavutil/cpu.h"
#include "libavutil/common.h"
#include "libavutil/common.h"
#include "libavutil/lfg.h"
#include "libavutil/lfg.h"
#include "libavutil/time.h"
#include "simple_idct.h"
#include "simple_idct.h"
#include "aandcttab.h"
#include "aandcttab.h"
...
@@ -143,13 +143,6 @@ static const struct algo idct_tab[] = {
...
@@ -143,13 +143,6 @@ static const struct algo idct_tab[] = {
#define AANSCALE_BITS 12
#define AANSCALE_BITS 12
static
int64_t
gettime
(
void
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
(
int64_t
)
tv
.
tv_sec
*
1000000
+
tv
.
tv_usec
;
}
#define NB_ITS 20000
#define NB_ITS 20000
#define NB_ITS_SPEED 50000
#define NB_ITS_SPEED 50000
...
@@ -312,7 +305,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
...
@@ -312,7 +305,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
init_block
(
block
,
test
,
is_idct
,
&
prng
);
init_block
(
block
,
test
,
is_idct
,
&
prng
);
permute
(
block1
,
block
,
dct
->
format
);
permute
(
block1
,
block
,
dct
->
format
);
ti
=
gettime
();
ti
=
av_
gettime
();
it1
=
0
;
it1
=
0
;
do
{
do
{
for
(
it
=
0
;
it
<
NB_ITS_SPEED
;
it
++
)
{
for
(
it
=
0
;
it
<
NB_ITS_SPEED
;
it
++
)
{
...
@@ -320,7 +313,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
...
@@ -320,7 +313,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
dct
->
func
(
block
);
dct
->
func
(
block
);
}
}
it1
+=
NB_ITS_SPEED
;
it1
+=
NB_ITS_SPEED
;
ti1
=
gettime
()
-
ti
;
ti1
=
av_
gettime
()
-
ti
;
}
while
(
ti1
<
1000000
);
}
while
(
ti1
<
1000000
);
emms_c
();
emms_c
();
...
@@ -453,7 +446,7 @@ static void idct248_error(const char *name,
...
@@ -453,7 +446,7 @@ static void idct248_error(const char *name,
if
(
!
speed
)
if
(
!
speed
)
return
;
return
;
ti
=
gettime
();
ti
=
av_
gettime
();
it1
=
0
;
it1
=
0
;
do
{
do
{
for
(
it
=
0
;
it
<
NB_ITS_SPEED
;
it
++
)
{
for
(
it
=
0
;
it
<
NB_ITS_SPEED
;
it
++
)
{
...
@@ -462,7 +455,7 @@ static void idct248_error(const char *name,
...
@@ -462,7 +455,7 @@ static void idct248_error(const char *name,
idct248_put
(
img_dest
,
8
,
block
);
idct248_put
(
img_dest
,
8
,
block
);
}
}
it1
+=
NB_ITS_SPEED
;
it1
+=
NB_ITS_SPEED
;
ti1
=
gettime
()
-
ti
;
ti1
=
av_
gettime
()
-
ti
;
}
while
(
ti1
<
1000000
);
}
while
(
ti1
<
1000000
);
emms_c
();
emms_c
();
...
...
libavcodec/fft-test.c
View file @
980f81d9
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "libavutil/mathematics.h"
#include "libavutil/mathematics.h"
#include "libavutil/lfg.h"
#include "libavutil/lfg.h"
#include "libavutil/log.h"
#include "libavutil/log.h"
#include "libavutil/time.h"
#include "fft.h"
#include "fft.h"
#if CONFIG_FFT_FLOAT
#if CONFIG_FFT_FLOAT
#include "dct.h"
#include "dct.h"
...
@@ -34,7 +35,6 @@
...
@@ -34,7 +35,6 @@
#endif
#endif
#include <math.h>
#include <math.h>
#include <unistd.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
...
@@ -186,13 +186,6 @@ static FFTSample frandom(AVLFG *prng)
...
@@ -186,13 +186,6 @@ static FFTSample frandom(AVLFG *prng)
return
(
int16_t
)
av_lfg_get
(
prng
)
/
32768
.
0
*
RANGE
;
return
(
int16_t
)
av_lfg_get
(
prng
)
/
32768
.
0
*
RANGE
;
}
}
static
int64_t
gettime
(
void
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
(
int64_t
)
tv
.
tv_sec
*
1000000
+
tv
.
tv_usec
;
}
static
int
check_diff
(
FFTSample
*
tab1
,
FFTSample
*
tab2
,
int
n
,
double
scale
)
static
int
check_diff
(
FFTSample
*
tab1
,
FFTSample
*
tab2
,
int
n
,
double
scale
)
{
{
int
i
;
int
i
;
...
@@ -430,7 +423,7 @@ int main(int argc, char **argv)
...
@@ -430,7 +423,7 @@ int main(int argc, char **argv)
/* we measure during about 1 seconds */
/* we measure during about 1 seconds */
nb_its
=
1
;
nb_its
=
1
;
for
(;;)
{
for
(;;)
{
time_start
=
gettime
();
time_start
=
av_
gettime
();
for
(
it
=
0
;
it
<
nb_its
;
it
++
)
{
for
(
it
=
0
;
it
<
nb_its
;
it
++
)
{
switch
(
transform
)
{
switch
(
transform
)
{
case
TRANSFORM_MDCT
:
case
TRANSFORM_MDCT
:
...
@@ -456,7 +449,7 @@ int main(int argc, char **argv)
...
@@ -456,7 +449,7 @@ int main(int argc, char **argv)
#endif
#endif
}
}
}
}
duration
=
gettime
()
-
time_start
;
duration
=
av_
gettime
()
-
time_start
;
if
(
duration
>=
1000000
)
if
(
duration
>=
1000000
)
break
;
break
;
nb_its
*=
2
;
nb_its
*=
2
;
...
...
libavcodec/motion-test.c
View file @
980f81d9
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include "config.h"
#include "config.h"
#include "dsputil.h"
#include "dsputil.h"
#include "libavutil/lfg.h"
#include "libavutil/lfg.h"
#include "libavutil/time.h"
#undef printf
#undef printf
...
@@ -58,13 +59,6 @@ static void help(void)
...
@@ -58,13 +59,6 @@ static void help(void)
"test motion implementations
\n
"
);
"test motion implementations
\n
"
);
}
}
static
int64_t
gettime
(
void
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
(
int64_t
)
tv
.
tv_sec
*
1000000
+
tv
.
tv_usec
;
}
#define NB_ITS 500
#define NB_ITS 500
int
dummy
;
int
dummy
;
...
@@ -97,7 +91,7 @@ static void test_motion(const char *name,
...
@@ -97,7 +91,7 @@ static void test_motion(const char *name,
emms_c
();
emms_c
();
/* speed test */
/* speed test */
ti
=
gettime
();
ti
=
av_
gettime
();
d1
=
0
;
d1
=
0
;
for
(
it
=
0
;
it
<
NB_ITS
;
it
++
)
{
for
(
it
=
0
;
it
<
NB_ITS
;
it
++
)
{
for
(
y
=
0
;
y
<
HEIGHT
-
17
;
y
++
)
{
for
(
y
=
0
;
y
<
HEIGHT
-
17
;
y
++
)
{
...
@@ -109,7 +103,7 @@ static void test_motion(const char *name,
...
@@ -109,7 +103,7 @@ static void test_motion(const char *name,
}
}
emms_c
();
emms_c
();
dummy
=
d1
;
/* avoid optimization */
dummy
=
d1
;
/* avoid optimization */
ti
=
gettime
()
-
ti
;
ti
=
av_
gettime
()
-
ti
;
printf
(
" %0.0f kop/s
\n
"
,
printf
(
" %0.0f kop/s
\n
"
,
(
double
)
NB_ITS
*
(
WIDTH
-
16
)
*
(
HEIGHT
-
16
)
/
(
double
)
NB_ITS
*
(
WIDTH
-
16
)
*
(
HEIGHT
-
16
)
/
...
...
libavutil/des.c
View file @
980f81d9
...
@@ -342,7 +342,7 @@ void av_des_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count) {
...
@@ -342,7 +342,7 @@ void av_des_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count) {
#undef srand
#undef srand
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include
<sys/time.h>
#include
"libavutil/time.h"
static
uint64_t
rand64
(
void
)
{
static
uint64_t
rand64
(
void
)
{
uint64_t
r
=
rand
();
uint64_t
r
=
rand
();
r
=
(
r
<<
32
)
|
rand
();
r
=
(
r
<<
32
)
|
rand
();
...
@@ -389,13 +389,11 @@ int main(void) {
...
@@ -389,13 +389,11 @@ int main(void) {
#ifdef GENTABLES
#ifdef GENTABLES
int
j
;
int
j
;
#endif
#endif
struct
timeval
tv
;
uint64_t
key
[
3
];
uint64_t
key
[
3
];
uint64_t
data
;
uint64_t
data
;
uint64_t
ct
;
uint64_t
ct
;
uint64_t
roundkeys
[
16
];
uint64_t
roundkeys
[
16
];
gettimeofday
(
&
tv
,
NULL
);
srand
(
av_gettime
());
srand
(
tv
.
tv_sec
*
1000
*
1000
+
tv
.
tv_usec
);
key
[
0
]
=
AV_RB64
(
test_key
);
key
[
0
]
=
AV_RB64
(
test_key
);
data
=
AV_RB64
(
plain
);
data
=
AV_RB64
(
plain
);
gen_roundkeys
(
roundkeys
,
key
[
0
]);
gen_roundkeys
(
roundkeys
,
key
[
0
]);
...
...
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