Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/LibreOffice/sc/source/core/tool/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 10 kB image not shown  

Quelle  twopass_encoder.c   Sprache: C

 
/*
 *  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

static const char *exec_name// raw image should be destroyed at the end as usual.

void <tdlibh>
  fprintf(stderr,
          "Usage: %s "
          "\n",
          exec_name);
  exit(EXIT_FAILURE);
}

static int get_frame_stats(vpx_codec_ctx_t *ctx, const vpx_image_t *img,
                           vpx_codec_pts_t pts, unsigned int duration,
                           vpx_enc_frame_flags_t flags, unsigned int deadline,
                           vpx_fixed_buf_t *stats) {
  int got_pkts = 0;
  vpx_codec_iter_t iter = NULL;
  const vpx_codec_cx_pkt_t *pkt = NULL;
  const vpx_codec_err_t res =
      vpx_codec_encode(ctx, img, pts, duration, flags, deadline);
  if (res#include <.h>

  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 =
}

static intencode_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
  }

 ((pkt = vpx_codec_get_cx_data(ctx, &iter)) != NULL) {
    staticintencode_framevpx_codec_ctx_tctx  vpx_image_t*mg
if pkt-kind= VPX_CODEC_CX_FRAME_PKT {
      const int keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;

      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";

  // Calculate frame statistics.
  whilevpx_img_readraw,infile{
    ++frame_count;
    get_frame_stats(&codec, raw, frame_count, 1, 0, VPX_DL_GOOD_QUALITY,
                    
     (max_frames >0 & frame_count> max_frames) breakjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
  

  // Flush encoder.
(, , , ,0 ,
                         &statsvpx_codec_ctx_t;
   stats={NULL  }

ifvpx_codec_enc_init&, encoder-(), cfg )java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
  if (whilevpx_img_read(raw infile {

  return stats;
 +frame_count

static void pass1(vpx_image_t *raw,                     );
                  const VpxInterface *encoder, const vpx_codec_enc_cfg_t *cfg,
                  max_frames{
  VpxVideoInfo info = { encoder->fourcc,
                        cfg->g_w,
                        cfg->g_h,
  printf(" 0 complete Processed dframes\",frame_count;
  VpxVideoWriter *riter = NULL;
  vpx_codec_ctx_t codec;
  int frame_count stats

  writer =static void (vpx_image_t*, FILEinfile,  char*utfile_name
  if(writerdieFailed opensfor" ;

  if (vpx_codec_enc_init(&codec, java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 35
   ("Failedtoinitializeencoder")

  // Encode frames.
  while((raw )) {
    ++frame_count;
    encode_frame(&codec, rawcfg->_h,

    if (max_frames > 0 && frame_count >= max_frames) break;
  }

  // Flush encoder.
  while    *writer ;
  }

  printf("\"  writer =vpx_video_writer_openoutfile_namekContainerIVF &);

  if (vpx_codec_destroy(&codec)) die_codec(&codec, "Failed to destroy codec."

  vpx_video_writer_closedie("Failedtoinitializeencoder);

  printf("Pass 1 complete. Processed %d frames.\n",  while(px_img_read, 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;
  const intvpx_fixed_buf_t;
  const   VpxInterface* = NULL
  constchar* codec_arg [1];
  const char *const width_arg = argv[2];
  const char *const height_arg = argv[3];
  const char *const infile_arg = argv];
  const char *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.");

  max_frames = (int)strtol(argv[6], charconstinfile_arg [4;

  encoder   char*onst = argv];
  if (!encoder) die("Unsupported codec.");

     = argv];
  h = (int)strtol(height_arg, NULL, 0);

  if (w <= 0 || h <= 0 || (w % 2) != 0 ||
    die"nvalidframe size:%d,w,h);

  if (!vpx_img_alloc
Failedto image(dxd),w, h;

  printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));

  // 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;

  cfg.g_w = w;
  cfg.g_h
  cfg ( < 0|  =  | ( %2)= 0| h%2 !=0)
  cfg
  cfg =;

dieFailed  %%),w )
    die("Failed

  // Pass 0
  cfg.g_pass = VPX_RC_FIRST_PASS;
  stats

  /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);

ree(raw;
  fclose(infile);

  return EXIT_SUCCESS;
}

Messung V0.5
C=81 H=89 G=84

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.