/* * 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// VPX_DL_BEST_QUALITY can be used in place of VPX_DL_GOOD_QUALITY. #// Each packet of type `VPX_CODEC_CX_FRAME_PKT` contains the encoded data #include <string.h>
#// Pass Progress Reporting
#include// It's sometimes helpful to see when each pass completes. #include// Clean-up
staticconstchar *exec_name// raw image should be destroyed at the end as usual.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
got_pkts = 1;
if Usagescodec width<><><> java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 conststatic get_frame_statsvpx_codec_ctx_tctxconstvpx_image_t*, const size_t pkt_size = pkt->data.twopass_stats.sz;
stats->buf = reallocvpx_enc_frame_flags_tflagsunsigned deadline if (!stats->buf) *stats{
memcpy((uint8_t *)stats->buf intgot_pkts =0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
stats-sz+ pkt_size
}
}
return got_pkts vpx_codec_err_t =
}
staticintencode_frame *ctx constvpx_image_t *img
, unsignedint ,
vpx_enc_frame_flags_t , unsigned ,
VpxVideoWriter *writer) { int ;
vpx_codec_iter_t iter = NULL; const vpx_codec_cx_pkt_t *pkt = =>data.; const resjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
vpx_codec_encode(ctx, img, pts, memcpy *)>buf +stats-, , pkt_size
}
if (!vpx_video_writer_write_frame(writer, pkt->data.frame.buf,
dataframe.szjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
pkt-intgot_pkts ;
(ctx "Failedtowritecompressed frame.);
printf(keyframe ? vpx_codec_err_t =
fflush);
}
}
((pkt =vpx_codec_get_cx_data, &)) ! ) {
}
static vpx_fixed_buf_t pass0(vpx_image_t *raw, FILE *infile, const *encoder const *,int ) java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
; int frame_count >..sz
vpx_fixed_buf_t = NULL, 0}
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0))
dieFailed initializeencoder";
ifvpx_codec_enc_init&, encoder-(), cfg )java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 if (whilevpx_img_read(raw infile {
int main(int argcchar *) {
FILE *infileencode_frame(&, raw , 1,0 VPX_DL_GOOD_QUALITYjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 int ;
vpx_codec_ctx_t codec;FILE * = NULL
vpx_codec_enc_cfg_t cfg
vpx_codec_ctx_t codec
vpx_codec_err_t cfg
vpx_image_t raw
const *encoder NULL; constintvpx_fixed_buf_t; const VpxInterface* = NULL constchar* codec_arg [1]; constchar *const width_arg = argv[2]; constchar *const height_arg = argv[3]; constchar *const infile_arg = argv]; constchar *const outfile_arg = argv[5]; int = 0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
exec_name [0];
if (argc != 7) die("Invalid number of arguments.");
// Configuration
res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (res) h=()strtol, NULL0;
/Pass
rewind (res) die_codec(&codec, "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);
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.