vp8: multi-res-encoder: Fix timer around encoder in sample encoder.
Change-Id: I0131ab4767e2eb72838ab6e58dd77a85fbf508e0
This commit is contained in:
Родитель
55a09f7f45
Коммит
729c997642
|
@ -347,8 +347,7 @@ int main(int argc, char **argv)
|
|||
double psnr_totals[NUM_ENCODERS][4] = {{0,0}};
|
||||
int psnr_count[NUM_ENCODERS] = {0};
|
||||
|
||||
double cx_time = 0;
|
||||
struct timeval tv1, tv2, difftv;
|
||||
int64_t cx_time = 0;
|
||||
|
||||
/* Set the required target bitrates for each resolution level.
|
||||
* If target bitrate for highest-resolution level is set to 0,
|
||||
|
@ -582,6 +581,7 @@ int main(int argc, char **argv)
|
|||
|
||||
while(frame_avail || got_data)
|
||||
{
|
||||
struct vpx_usec_timer timer;
|
||||
vpx_codec_iter_t iter[NUM_ENCODERS]={NULL};
|
||||
const vpx_codec_cx_pkt_t *pkt[NUM_ENCODERS];
|
||||
|
||||
|
@ -636,18 +636,18 @@ int main(int argc, char **argv)
|
|||
vpx_codec_control(&codec[i], VP8E_SET_TEMPORAL_LAYER_ID, layer_id);
|
||||
}
|
||||
|
||||
gettimeofday(&tv1, NULL);
|
||||
/* Encode each frame at multi-levels */
|
||||
/* Note the flags must be set to 0 in the encode call if they are set
|
||||
for each frame with the vpx_codec_control(), as done above. */
|
||||
vpx_usec_timer_start(&timer);
|
||||
if(vpx_codec_encode(&codec[0], frame_avail? &raw[0] : NULL,
|
||||
frame_cnt, 1, 0, arg_deadline))
|
||||
{
|
||||
die_codec(&codec[0], "Failed to encode frame");
|
||||
}
|
||||
gettimeofday(&tv2, NULL);
|
||||
timersub(&tv2, &tv1, &difftv);
|
||||
cx_time += (double)(difftv.tv_sec * 1000000 + difftv.tv_usec);
|
||||
vpx_usec_timer_mark(&timer);
|
||||
cx_time += vpx_usec_timer_elapsed(&timer);
|
||||
|
||||
for (i=NUM_ENCODERS-1; i>=0 ; i--)
|
||||
{
|
||||
got_data = 0;
|
||||
|
@ -686,8 +686,10 @@ int main(int argc, char **argv)
|
|||
frame_cnt++;
|
||||
}
|
||||
printf("\n");
|
||||
printf("FPS for encoding %d %f %f \n", frame_cnt, (float)cx_time / 1000000,
|
||||
1000000 * (double)frame_cnt / (double)cx_time);
|
||||
printf("Frame cnt and encoding time/FPS stats for encoding: %d %f %f \n",
|
||||
frame_cnt,
|
||||
1000 * (float)cx_time / (double)(frame_cnt * 1000000),
|
||||
1000000 * (double)frame_cnt / (double)cx_time);
|
||||
|
||||
fclose(infile);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче