70 #if HAVE_SYS_RESOURCE_H
72 #include <sys/types.h>
73 #include <sys/resource.h>
74 #elif HAVE_GETPROCESSTIMES
77 #if HAVE_GETPROCESSMEMORYINFO
83 #include <sys/select.h>
88 #include <sys/ioctl.h>
134 #define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
183 uint32_t *pal, *dst2;
191 if (r->
x < 0 || r->
x + r->
w > w || r->
y < 0 || r->
y + r->
h > h) {
196 dst += r->
y * dst_linesize + r->
x * 4;
199 for (y = 0; y < r->
h; y++) {
200 dst2 = (uint32_t *)dst;
202 for (x = 0; x < r->
w; x++)
203 *(dst2++) = pal[*(src2++)];
229 int64_t
pts, end_pts;
246 "Impossible to get a blank canvas.\n");
249 dst = frame->
data [0];
251 for (i = 0; i < num_rects; i++)
275 if (pts2 <= ist2->sub2video.last_pts)
279 for (j = 0, nb_reqs = 0; j < ist2->
nb_filters; j++)
302 tcsetattr (0, TCSANOW, &
oldtty);
334 istty = isatty(0) && isatty(2);
336 if (istty && tcgetattr (0, &tty) == 0) {
340 tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
341 |INLCR|IGNCR|ICRNL|IXON);
342 tty.c_oflag |= OPOST;
343 tty.c_lflag &= ~(
ECHO|ECHONL|ICANON|IEXTEN);
344 tty.c_cflag &= ~(CSIZE|PARENB);
349 tcsetattr (0, TCSANOW, &tty);
375 n = select(1, &rfds,
NULL,
NULL, &tv);
384 # if HAVE_PEEKNAMEDPIPE
386 static HANDLE input_handle;
389 input_handle = GetStdHandle(STD_INPUT_HANDLE);
390 is_pipe = !GetConsoleMode(input_handle, &dw);
393 if (stdin->_cnt > 0) {
399 if (!PeekNamedPipe(input_handle,
NULL, 0,
NULL, &nchars,
NULL)) {
431 printf(
"bench: maxrss=%ikB\n", maxrss);
579 printf(
"bench: %8"PRIu64
" %s \n", t -
current_time, buf);
590 ost2->
finished |= ost == ost2 ? this_stream : others;
643 memcpy(t, new_pkt.
data, new_pkt.
size);
661 av_log(NULL,
AV_LOG_ERROR,
"Failed to open bitstream filter %s for stream %d with codec %s",
677 av_log(s,
AV_LOG_WARNING,
"Invalid DTS: %"PRId64
" PTS: %"PRId64
" in output stream %d:%d, replacing by guess\n",
690 if (pkt->
dts < max) {
692 av_log(s, loglevel,
"Non-monotonous DTS in output stream "
693 "%d:%d; previous: %"PRId64
", current: %"PRId64
"; ",
699 av_log(s, loglevel,
"changing to %"PRId64
". This may result "
700 "in incorrect timestamps in the output file.\n",
717 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n",
782 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
798 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
812 int subtitle_out_max_size = 1024 * 1024;
813 int subtitle_out_size, nb, i;
847 for (i = 0; i < nb; i++) {
848 unsigned save_num_rects = sub->
num_rects;
865 subtitle_out_max_size, sub);
868 if (subtitle_out_size < 0) {
875 pkt.
size = subtitle_out_size;
882 pkt.
pts += 90 * sub->start_display_time;
884 pkt.
pts += 90 * sub->end_display_time;
896 int ret, format_video_sync;
900 int nb_frames, nb0_frames, i;
901 double delta, delta0;
953 double cor =
FFMIN(-delta0, duration);
963 switch (format_video_sync) {
965 if (ost->
frame_number == 0 && delta - duration >= 0.5) {
975 }
else if (delta < -1.1)
977 else if (delta > 1.1) {
978 nb_frames =
lrintf(delta);
980 nb0_frames =
lrintf(delta0 - 0.6);
986 else if (delta > 0.6)
998 nb0_frames =
FFMIN(nb0_frames, nb_frames);
1002 "*** dropping frame %d from stream %d at ts %"PRId64
"\n",
1005 if (nb_frames > (nb0_frames && ost->
last_droped) + (nb_frames > nb0_frames)) {
1017 for (i = 0; i < nb_frames; i++) {
1023 if (i < nb0_frames && ost->last_frame) {
1026 in_picture = next_picture;
1053 int got_packet, forced_keyframe = 0;
1076 forced_keyframe = 1;
1082 av_dlog(
NULL,
"force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n",
1090 forced_keyframe = 1;
1101 if (forced_keyframe) {
1109 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
1126 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
1138 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
1143 frame_size = pkt.
size;
1175 return -10.0 * log(d) / log(10.0);
1182 double ti1, bitrate, avg_bitrate;
1207 avg_bitrate = (double)(ost->
data_size * 8) / ti1 / 1000.0;
1208 fprintf(
vstats_file,
"s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
1209 (
double)ost->
data_size / 1024, ti1, bitrate, avg_bitrate);
1262 "Error in av_buffersink_get_frame_flags(): %s\n",
av_err2str(ret));
1281 float_pts +=
FFSIGN(float_pts) * 1.0 / (1<<17);
1283 filtered_frame->
pts =
1308 "Audio filter graph output is not normalized and encoder does not support parameter changes\n");
1327 uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0;
1328 uint64_t subtitle_size = 0;
1329 uint64_t data_size = 0;
1330 float percent = -1.0;
1339 default: other_size += ost->
data_size;
break;
1345 if (data_size && total_size>0 && total_size >= data_size)
1346 percent = 100.0 * (total_size - data_size) / data_size;
1348 av_log(
NULL,
AV_LOG_INFO,
"video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ",
1349 video_size / 1024.0,
1350 audio_size / 1024.0,
1351 subtitle_size / 1024.0,
1352 other_size / 1024.0,
1353 extra_size / 1024.0);
1363 uint64_t total_packets = 0, total_size = 0;
1392 total_packets, total_size);
1397 uint64_t total_packets = 0, total_size = 0;
1426 total_packets, total_size);
1428 if(video_size + data_size + audio_size + subtitle_size + extra_size == 0){
1429 av_log(
NULL,
AV_LOG_WARNING,
"Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)\n");
1436 AVBPrint buf_script;
1441 int frame_number, vid, i;
1443 int64_t
pts = INT64_MIN;
1444 static int64_t last_time = -1;
1445 static int qp_histogram[52];
1446 int hours, mins, secs, us;
1448 if (!
print_stats && !is_last_report && !progress_avio)
1451 if (!is_last_report) {
1452 if (last_time == -1) {
1456 if ((cur_time - last_time) < 500000)
1462 oc = output_files[0]->
ctx;
1465 if (total_size <= 0)
1473 ost = output_streams[i];
1478 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"q=%2.1f ", q);
1479 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1483 float fps, t = (cur_time-timer_start) / 1000000.0;
1486 fps = t > 1 ? frame_number / t : 0;
1487 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"frame=%5d fps=%3.*f q=%3.1f ",
1488 frame_number, fps < 9.95, fps, q);
1489 av_bprintf(&buf_script,
"frame=%d\n", frame_number);
1491 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1494 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"L");
1500 for (j = 0; j < 32; j++)
1501 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"%X", (
int)
lrintf(
log2(qp_histogram[j] + 1)));
1505 double error, error_sum = 0;
1506 double scale, scale_sum = 0;
1508 char type[3] = {
'Y',
'U',
'V' };
1509 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"PSNR=");
1510 for (j = 0; j < 3; j++) {
1511 if (is_last_report) {
1512 error = enc->
error[j];
1513 scale = enc->
width * enc->
height * 255.0 * 255.0 * frame_number;
1522 p =
psnr(error / scale);
1523 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"%c:%2.2f ", type[j], p);
1524 av_bprintf(&buf_script,
"stream_%d_%d_psnr_%c=%2.2f\n",
1527 p =
psnr(error_sum / scale_sum);
1528 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"*:%2.2f ",
psnr(error_sum / scale_sum));
1529 av_bprintf(&buf_script,
"stream_%d_%d_psnr_all=%2.2f\n",
1549 bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1;
1551 if (total_size < 0)
snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1553 else snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1554 "size=%8.0fkB time=", total_size / 1024.0);
1556 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"-");
1557 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1558 "%02d:%02d:%02d.%02d ", hours, mins, secs,
1562 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"bitrate=N/A");
1565 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"bitrate=%6.1fkbits/s", bitrate);
1566 av_bprintf(&buf_script,
"bitrate=%6.1fkbits/s\n", bitrate);
1569 if (total_size < 0)
av_bprintf(&buf_script,
"total_size=N/A\n");
1570 else av_bprintf(&buf_script,
"total_size=%"PRId64
"\n", total_size);
1571 av_bprintf(&buf_script,
"out_time_ms=%"PRId64
"\n", pts);
1572 av_bprintf(&buf_script,
"out_time=%02d:%02d:%02d.%06d\n",
1573 hours, mins, secs, us);
1576 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
" dup=%d drop=%d",
1582 const char end = is_last_report ?
'\n' :
'\r';
1584 fprintf(stderr,
"%s %c", buf, end);
1591 if (progress_avio) {
1593 is_last_report ?
"end" :
"continue");
1595 FFMIN(buf_script.len, buf_script.size - 1));
1598 if (is_last_report) {
1615 int stop_encoding = 0;
1651 ret = encode(enc, &pkt,
NULL, &got_packet);
1669 pkt_size = pkt.
size;
1757 opkt.
dts -= ost_tb_start_time;
1777 &opkt.data, &opkt.size,
1799 int ret =
avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height);
1817 char layout_name[256];
1836 int i,
ret, err = 0, resample_changed;
1854 if (*got_output || ret<0)
1860 if (!*got_output || ret < 0) {
1888 if (resample_changed) {
1889 char layout1[64], layout2[64];
1893 "layout for Input Stream #%d.%d\n", ist->
file_index,
1905 "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d chl:%s to rate:%d fmt:%s ch:%d chl:%s\n",
1936 decoded_frame->
pts = pkt->
pts;
1939 decoded_frame->
pts = ist->
dts;
1947 for (i = 0; i < ist->nb_filters; i++) {
1948 if (i < ist->nb_filters - 1) {
1949 f = ist->filter_frame;
1966 return err < 0 ? err :
ret;
1972 int i, ret = 0, err = 0, resample_changed;
1973 int64_t best_effort_timestamp;
1985 decoded_frame, got_output, pkt);
1996 "has_b_frames is larger in decoder than demuxer %d > %d ",
2002 if (*got_output || ret<0)
2008 if (*got_output && ret >= 0) {
2013 decoded_frame->
width,
2022 if (!*got_output || ret < 0) {
2052 "frame_pts:%s frame_pts_time:%s best_effort_ts:%"PRId64
" best_effort_ts_time:%s keyframe:%d frame_type:%d time_base:%d/%d\n",
2055 best_effort_timestamp,
2069 if (resample_changed) {
2071 "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
2091 if (!frame_sample_aspect->
num)
2094 if (i < ist->nb_filters - 1) {
2104 }
else if (ret < 0) {
2106 "Failed to inject frame into filter network: %s\n",
av_err2str(ret));
2114 return err < 0 ? err :
ret;
2121 &subtitle, got_output, pkt);
2123 if (*got_output || ret<0)
2129 if (ret < 0 || !*got_output) {
2140 if (end < ist->prev_sub.subtitle.end_display_time) {
2142 "Subtitle duration reduced from %d to %d%s\n",
2144 end <= 0 ?
", dropping it" :
"");
2229 "Multiple frames in a packet from stream %d\n", pkt->
stream_index);
2280 if (got_output && !pkt)
2334 if (!strcmp(output_files[i]->ctx->oformat->name,
"rtp")) {
2335 avc[j] = output_files[i]->
ctx;
2346 printf(
"SDP:\n%s\n", sdp);
2366 if (
hwaccels[i].pix_fmt == pix_fmt)
2377 for (p = pix_fmts; *p != -1; p++) {
2390 ret = hwaccel->
init(s);
2394 "%s hwaccel requested for input stream #%d:%d, "
2395 "but cannot be initialized.\n", hwaccel->
name,
2427 snprintf(error, error_len,
"Decoder (codec %s) not found for input stream #%d:%d",
2442 av_log(
NULL,
AV_LOG_WARNING,
"Warning using DVB subtitles for filtering and output at the same time is not fully supported, also see -compute_edt [0|1]\n");
2452 "Error while opening decoder for input stream "
2475 int64_t va = *(int64_t *)a, vb = *(int64_t *)
b;
2476 return va < vb ? -1 : va > vb ? +1 : 0;
2486 for (p = kf; *p; p++)
2497 for (i = 0; i <
n; i++) {
2498 char *next = strchr(p,
',');
2503 if (!memcmp(p,
"chapters", 8)) {
2512 "Could not allocate forced key frames array.\n");
2544 InputFile *file = input_files[input_index];
2550 "New %s stream %d:%d at pos:%"PRId64
" and DTS:%ss\n",
2562 int encoder_string_len;
2563 int format_flags = 0;
2585 encoder_string =
av_mallocz(encoder_string_len);
2586 if (!encoder_string)
2592 av_strlcpy(encoder_string,
"Lavc ", encoder_string_len);
2600 int ret = 0, i, j, k;
2604 char error[1024] = {0};
2616 if (fg->
inputs[0]->
ist == input_streams[k])
2632 oc = output_files[i]->
ctx;
2649 ost = output_streams[i];
2677 uint64_t extra_size;
2683 if (extra_size > INT_MAX) {
2692 unsigned int codec_tag;
2741 if( copy_tb<0 && dec_ctx->time_base.den
2799 #if FF_API_AUDIOENC_DELAY
2817 "with stream copy may produce invalid files\n");
2842 snprintf(error,
sizeof(error),
"Encoder (codec %s) not found for output stream #%d:%d",
2876 "about the input framerate is available. Falling "
2877 "back to a default value of 25fps for output stream #%d:%d. Use the -r option "
2878 "if you want a different framerate.\n",
2893 switch (enc_ctx->codec_type) {
2899 enc_ctx->time_base = (
AVRational){ 1, enc_ctx->sample_rate };
2903 if (ost->
filter && !(enc_ctx->time_base.num && enc_ctx->time_base.den))
2908 "Please consider specifying a lower framerate, a different muxer or -vsync 2\n");
2913 enc_ctx->time_base);
2921 if (!strncmp(ost->
enc->
name,
"libx264", 7) &&
2925 "No pixel format specified, %s for H.264 encoding chosen.\n"
2926 "Use -pix_fmt yuv420p for compatibility with outdated media players.\n",
2928 if (!strncmp(ost->
enc->
name,
"mpeg2video", 10) &&
2932 "No pixel format specified, %s for MPEG-2 encoding chosen.\n"
2933 "Use -pix_fmt yuv420p for compatibility with outdated media players.\n",
2966 if (!enc_ctx->width) {
2979 char logfilename[1024];
2982 snprintf(logfilename,
sizeof(logfilename),
"%s-%d.log",
2986 if (!strcmp(ost->
enc->
name,
"libx264")) {
2991 size_t logbuffer_size;
2997 enc_ctx->stats_in = logbuffer;
3003 logfilename, strerror(errno));
3012 if (ost->disposition) {
3014 {
"disposition" ,
NULL, 0,
AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit =
"flags" },
3030 static const AVClass class = {
3036 const AVClass *pclass = &
class;
3038 ret =
av_opt_eval_flags(&pclass, &opts[0], ost->disposition, &ost->st->disposition);
3046 ost = output_streams[i];
3047 if (ost->encoding_needed) {
3056 if (!ost->enc_ctx->subtitle_header) {
3064 av_dict_set(&ost->encoder_opts,
"threads",
"auto", 0);
3065 av_dict_set(&ost->encoder_opts,
"side_data_only_packets",
"1", 0);
3067 if ((ret =
avcodec_open2(ost->enc_ctx, codec, &ost->encoder_opts)) < 0) {
3070 snprintf(error,
sizeof(error),
"Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height",
3071 ost->file_index, ost->index);
3077 ost->enc_ctx->frame_size);
3079 if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000)
3081 " It takes bits/s as argument, not kbits/s\n");
3086 "Error setting up codec context options.\n");
3094 "Error initializing the output stream codec context.\n");
3097 ost->st->codec->codec= ost->enc_ctx->codec;
3107 ost = output_streams[i];
3131 oc = output_files[i]->
ctx;
3135 "Could not write header for output file #%d "
3136 "(incorrect codec parameters ?): %s",
3142 if (strcmp(oc->oformat->name,
"rtp")) {
3151 av_dump_format(output_files[i]->ctx, i, output_files[i]->ctx->filename, 1);
3157 ist = input_streams[i];
3159 for (j = 0; j < ist->nb_filters; j++) {
3160 if (ist->filters[j]->graph->graph_desc) {
3162 ist->file_index, ist->st->index, ist->dec ? ist->dec->name :
"?",
3163 ist->filters[j]->name);
3172 ost = output_streams[i];
3174 if (ost->attachment_filename) {
3177 ost->attachment_filename, ost->file_index, ost->index);
3181 if (ost->filter && ost->filter->graph->graph_desc) {
3188 ost->index, ost->enc ? ost->enc->name :
"?");
3193 input_streams[ost->source_index]->
file_index,
3194 input_streams[ost->source_index]->
st->
index,
3197 if (ost->sync_ist != input_streams[ost->source_index])
3199 ost->sync_ist->file_index,
3200 ost->sync_ist->st->index);
3201 if (ost->stream_copy)
3204 const AVCodec *in_codec = input_streams[ost->source_index]->
dec;
3205 const AVCodec *out_codec = ost->enc;
3206 const char *decoder_name =
"?";
3207 const char *in_codec_name =
"?";
3208 const char *encoder_name =
"?";
3209 const char *out_codec_name =
"?";
3212 decoder_name = in_codec->
name;
3214 if (!strcmp(decoder_name, in_codec_name))
3215 decoder_name =
"native";
3219 encoder_name = out_codec->
name;
3221 if (!strcmp(encoder_name, out_codec_name))
3222 encoder_name =
"native";
3226 in_codec_name, decoder_name,
3227 out_codec_name, encoder_name);
3280 int64_t opts_min = INT64_MAX;
3287 if (!ost->
finished && opts < opts_min) {
3298 static int64_t last_time;
3321 if (key ==
'c' || key ==
'C'){
3325 fprintf(stderr,
"\nEnter command: <target>|all <time>|-1 <command>[ <argument>]\n");
3327 while ((k =
read_key()) !=
'\n' && k !=
'\r' && i <
sizeof(buf)-1)
3332 (n = sscanf(buf,
"%63[^ ] %lf %255[^ ] %255[^\n]", target, &time, command, arg)) >= 3) {
3334 target, time, command, arg);
3341 fprintf(stderr,
"Command reply for stream %d: ret:%d res:\n%s", i, ret, buf);
3342 }
else if (key ==
'c') {
3343 fprintf(stderr,
"Queing commands only on filters supporting the specific command is unsupported\n");
3352 "Parse error, at least 3 arguments were expected, "
3353 "only %d given in string '%s'\n", n, buf);
3356 if (key ==
'd' || key ==
'D'){
3360 if(!debug) debug = 1;
3364 if(scanf(
"%d", &debug)!=1)
3365 fprintf(stderr,
"error parsing debug value\n");
3374 fprintf(stderr,
"debug=%d\n", debug);
3377 fprintf(stderr,
"key function\n"
3378 "? show this help\n"
3379 "+ increase verbosity\n"
3380 "- decrease verbosity\n"
3381 "c Send command to first matching filter supporting it\n"
3382 "C Send/Que command to all matching filters\n"
3383 "D cycle through available debug modes\n"
3384 "h dump packets/hex press to cycle through the 3 states\n"
3386 "s Show QP histogram\n"
3413 if (flags && ret ==
AVERROR(EAGAIN)) {
3417 "Thread message queue blocking; consider raising the "
3418 "thread_queue_size option (current value: %d)\n",
3424 "Unable to send packet to main thread: %s\n",
3459 if (nb_input_files == 1)
3474 av_log(
NULL,
AV_LOG_ERROR,
"pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(ret));
3504 if (nb_input_files > 1)
3514 if (output_streams[i]->unavailable)
3523 input_files[i]->eagain = 0;
3525 output_streams[i]->unavailable = 0;
3537 InputFile *ifile = input_files[file_index];
3558 ist = input_streams[ifile->
ist_index + i];
3589 goto discard_packet;
3598 goto discard_packet;
3602 "next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
3613 int64_t stime, stime2;
3620 int64_t new_start_time = INT64_MAX;
3662 memcpy(dst_data, src_sd->
data, src_sd->
size);
3686 "Inter stream timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
3706 "timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
3734 av_log(
NULL,
AV_LOG_INFO,
"demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
3768 int nb_requests, nb_requests_max = 0;
3786 for (i = 0; i < graph->
nb_inputs; i++) {
3787 ifilter = graph->
inputs[i];
3793 if (nb_requests > nb_requests_max) {
3794 nb_requests_max = nb_requests;
3859 int64_t timer_start;
3908 ist = input_streams[i];
3919 os = output_files[i]->
ctx;
3928 ost = output_streams[i];
3936 ist = input_streams[i];
3952 if (output_streams) {
3954 ost = output_streams[i];
3977 struct rusage rusage;
3979 getrusage(RUSAGE_SELF, &rusage);
3980 return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
3981 #elif HAVE_GETPROCESSTIMES
3983 FILETIME
c, e, k,
u;
3984 proc = GetCurrentProcess();
3985 GetProcessTimes(proc, &c, &e, &k, &u);
3986 return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
3994 #if HAVE_GETRUSAGE && HAVE_STRUCT_RUSAGE_RU_MAXRSS
3995 struct rusage rusage;
3996 getrusage(RUSAGE_SELF, &rusage);
3997 return (int64_t)rusage.ru_maxrss * 1024;
3998 #elif HAVE_GETPROCESSMEMORYINFO
4000 PROCESS_MEMORY_COUNTERS memcounters;
4001 proc = GetCurrentProcess();
4002 memcounters.cb =
sizeof(memcounters);
4003 GetProcessMemoryInfo(proc, &memcounters,
sizeof(memcounters));
4004 return memcounters.PeakPagefileUsage;
4021 setvbuf(stderr,
NULL,_IONBF,0);
4026 if(argc>1 && !strcmp(argv[1],
"-d")){
4050 if (nb_output_files <= 0 && nb_input_files == 0) {
4057 if (nb_output_files <= 0) {
4072 printf(
"bench: utime=%0.3fs\n", ti / 1000000.0);