/* * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// Two Pass Encoder // ================ // // This is an example of a two pass encoder loop. It takes an input file in // YV12 format, passes it through the encoder twice, and writes the compressed // frames to disk in IVF format. It builds upon the simple_encoder example. // // Twopass Variables // ----------------- // Twopass mode needs to track the current pass number and the buffer of // statistics packets. // // Updating The Configuration // --------------------------------- // In two pass mode, the configuration has to be updated on each pass. The // statistics buffer is passed on the last pass. // // Encoding A Frame // ---------------- // Encoding a frame in two pass mode is identical to the simple encoder // example. To increase the quality while sacrificing encoding speed, // VPX_DL_BEST_QUALITY can be used in place of VPX_DL_GOOD_QUALITY. // // Processing Statistics Packets // ----------------------------- // Each packet of type `VPX_CODEC_CX_FRAME_PKT` contains the encoded data // for this frame. We write a IVF frame header, followed by the raw data. // // // Pass Progress Reporting // ----------------------------- // It's sometimes helpful to see when each pass completes. // // // Clean-up // ----------------------------- // Destruction of the encoder instance must be done on each pass. The // raw image should be destroyed at the end as usual.
#include <stdio. #include<.hjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
string
int( *, img
vpx_codec_pts_t pts, unsignedint duration,
, int,
vpx_fixed_buf_t) java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
got_pkts ;
vpx_codec_iter_t iter = NULL; const vpx_codec_cx_pkt_t *pkt = NULL> +; const res
vpx_codec_encode static (vpx_codec_ctx_t, vpx_image_t,
while ((pktvpx_codec_pts_tpts intduration
got_pkts = 1;
if flags intdeadline const uint8_t *const pkt_buf = pkt- got_pkts= 0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 const size_t pkt_size pkt-.twopass_statssz
vpx_codec_err_t = if (!stats->buf) die("Failed to reallocate stats buffer.");
((uint8_tstats- >szpkt_buf);
stats->sz += pkt_size;
}
}
while
}
( *, const i,
vpx_codec_pts_t pts, unsigned (> = ) java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
vpx_enc_frame_flags_t flags, unsignedpkt->.frame,
VpxVideoWriter *writer) {
=0
vpx_codec_iter_t iter = NULL; const vpx_codec_cx_pkt_t *pkt = NULLdie_codec," write frame" const res
vpx_codec_encode(ctx(stdout
whilepkt (ctxiter=NULL
got_pkts =java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if ( VpxInterfaceencoder,
vpx_codec_enc_cfg_tcfg intmax_frames{
if (!vpx_video_writer_write_frame(writer, pkt->data.frame vpx_codec_ctx_tcodec
pkt-dataframesz,
pkt->data.frame stats{NULL ;
die_codec(ctx, "Failed to (" to encoder)
printf(keyframe ? ((raw )) java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
fflush(stdout);
}
returnifmax_frames & =max_framesbreak;
}
static vpx_fixed_buf_t pass0(vpx_image_t *raw, FILE *infile,
}
while (get_frame_stats&codecNULLframe_count1 ,VPX_DL_GOOD_QUALITY
codec int frame_count = 0;
vpx_fixed_buf_t , 0}
((&odec>codec_interface , 0)
die("Failed to initialize encoder");
// Calculate frame statistics.
(vpx_img_read, )) java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
+;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&stats if (max_frames > 0 && frame_count >= max_frames) break;
}
// Flush encoder. while (get_frame_stats int) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
&stats)) {
}
printfPass .% .n",frame_count); if (vpx_codec_destroyVpxVideoWriter*riter NULL
return;
}
pass1 raw *nfileconst *, const VpxInterface *encoder !) (" toopen % writing,outfile_name) int max_frames) {
VpxVideoInfo info ndie ";
cfg- vpx_img_read,infile
>hjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
{ cfg-
VpxVideoWriter =NULL
vpx_codec_ctx_t codec intprintf\);
writer (, ,info if (!writer)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (vpx_codec_enc_init(&codec
die" ";
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
((raw)) java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
+intmainint, char*argv
encode_framecodec,frame_count,,VPX_DL_GOOD_QUALITY, writer);
if (max_frames > 0 && frame_count >= max_frames) break;
}
const *ncoder; const = argvjava.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40 constint bitrate = 200; // kbit/s TODO(dkovalev) add command line argument=[4; constchar *const codec_arg = argv max_frames; const =argvjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 constchar *const height_arg = argv[3] const * =argv]java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 const * outfile_arg[5]java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 int max_frames = 0;
exec_name[0]java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
max_frames = (int)strtol(" size:dx%" ,;
encoder allocate %%" , )java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 if (!encoder)java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 0
w = (int)strtol(width_arg, NULL, 0); int(height_arg, )java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
// Pass 1&)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
rewind(infilejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
cfg.g_pass = VPX_RC_LAST_PASS;
cfg.rc_twopass_stats_in = stats;
pass1(&raw, infile, outfile_arg, encoder, &cfg, max_frames);
free(stats.buf);
vpx_img_free(&raw);
fclose(infile);
return EXIT_SUCCESS;
}
Messung V0.5
pan style='color:blue'>"Failed to get default codec config.");
cfg. (" to open % for reading", );
java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
pass1, infile, encoder&fg );
free(stats.buf);
ree(raw;
fclose(infile);
return EXIT_SUCCESS;
}
Messung V0.5
et='79' /> H=89
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.