mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
lavc: Use av_gettime_relative()
Whenever av_gettime() is used to measure relative period of time, av_gettime_relative() is prefered as it guarantee monotonic time on supported platforms. Signed-off-by: Olivier Langlois <olivier@trillion01.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
0eec06ed87
commit
b052bccbe4
@ -348,7 +348,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
|
|||||||
init_block(block, test, is_idct, &prng, vals);
|
init_block(block, test, is_idct, &prng, vals);
|
||||||
permute(block1, block, dct->format);
|
permute(block1, block, dct->format);
|
||||||
|
|
||||||
ti = av_gettime();
|
ti = av_gettime_relative();
|
||||||
it1 = 0;
|
it1 = 0;
|
||||||
do {
|
do {
|
||||||
for (it = 0; it < NB_ITS_SPEED; it++) {
|
for (it = 0; it < NB_ITS_SPEED; it++) {
|
||||||
@ -357,7 +357,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
|
|||||||
}
|
}
|
||||||
emms_c();
|
emms_c();
|
||||||
it1 += NB_ITS_SPEED;
|
it1 += NB_ITS_SPEED;
|
||||||
ti1 = av_gettime() - ti;
|
ti1 = av_gettime_relative() - ti;
|
||||||
} while (ti1 < 1000000);
|
} while (ti1 < 1000000);
|
||||||
|
|
||||||
printf("%s %s: %0.1f kdct/s\n", is_idct ? "IDCT" : "DCT", dct->name,
|
printf("%s %s: %0.1f kdct/s\n", is_idct ? "IDCT" : "DCT", dct->name,
|
||||||
@ -508,7 +508,7 @@ static void idct248_error(const char *name,
|
|||||||
if (!speed)
|
if (!speed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ti = av_gettime();
|
ti = av_gettime_relative();
|
||||||
it1 = 0;
|
it1 = 0;
|
||||||
do {
|
do {
|
||||||
for (it = 0; it < NB_ITS_SPEED; it++) {
|
for (it = 0; it < NB_ITS_SPEED; it++) {
|
||||||
@ -518,7 +518,7 @@ static void idct248_error(const char *name,
|
|||||||
}
|
}
|
||||||
emms_c();
|
emms_c();
|
||||||
it1 += NB_ITS_SPEED;
|
it1 += NB_ITS_SPEED;
|
||||||
ti1 = av_gettime() - ti;
|
ti1 = av_gettime_relative() - ti;
|
||||||
} while (ti1 < 1000000);
|
} while (ti1 < 1000000);
|
||||||
|
|
||||||
printf("%s %s: %0.1f kdct/s\n", 1 ? "IDCT248" : "DCT248", name,
|
printf("%s %s: %0.1f kdct/s\n", 1 ? "IDCT248" : "DCT248", name,
|
||||||
|
@ -438,7 +438,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 = av_gettime();
|
time_start = av_gettime_relative();
|
||||||
for (it = 0; it < nb_its; it++) {
|
for (it = 0; it < nb_its; it++) {
|
||||||
switch (transform) {
|
switch (transform) {
|
||||||
case TRANSFORM_MDCT:
|
case TRANSFORM_MDCT:
|
||||||
@ -464,7 +464,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
duration = av_gettime() - time_start;
|
duration = av_gettime_relative() - time_start;
|
||||||
if (duration >= 1000000)
|
if (duration >= 1000000)
|
||||||
break;
|
break;
|
||||||
nb_its *= 2;
|
nb_its *= 2;
|
||||||
|
@ -91,7 +91,7 @@ static void test_motion(const char *name,
|
|||||||
emms_c();
|
emms_c();
|
||||||
|
|
||||||
/* speed test */
|
/* speed test */
|
||||||
ti = av_gettime();
|
ti = av_gettime_relative();
|
||||||
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++) {
|
||||||
@ -103,7 +103,7 @@ static void test_motion(const char *name,
|
|||||||
}
|
}
|
||||||
emms_c();
|
emms_c();
|
||||||
dummy = d1; /* avoid optimization */
|
dummy = d1; /* avoid optimization */
|
||||||
ti = av_gettime() - ti;
|
ti = av_gettime_relative() - 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) /
|
||||||
|
Loading…
x
Reference in New Issue
Block a user