Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/media/libvpx/libvpx/vp9/encoder/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  vp9_ext_ratectrl.c   Sprache: C

 
/*
 *  Copyright (c) 2020 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.
 */


#include <stddef.h>
#include <stdio.h>

#include "vp9/encoder/vp9_ext_ratectrl.h"
#include "vp9/encoder/vp9_encoder.h"
#include "vp9/common/vp9_common.h"
#include "vpx_dsp/psnr.h"
#include "vpx/vpx_codec.h"
#include "vpx/vpx_ext_ratectrl.h"
#include "vpx/vpx_tpl.h"

vpx_codec_err_t vp9_extrc_init(EXT_RATECTRL *ext_ratectrl) {
  if (ext_ratectrl == NULL) {
    return VPX_CODEC_INVALID_PARAM;
  }
  vp9_zero(*ext_ratectrl);
  return VPX_CODEC_OK;
}

vpx_codec_err_t vp9_extrc_create(vpx_rc_funcs_t funcs,
                                 vpx_rc_config_t ratectrl_config,
                                 EXT_RATECTRL *ext_ratectrl) {
  vpx_rc_status_t rc_status;
  vpx_rc_firstpass_stats_t *rc_firstpass_stats;
  if (ext_ratectrl == NULL) {
    return VPX_CODEC_INVALID_PARAM;
  }
  vp9_extrc_delete(ext_ratectrl);
  ext_ratectrl->funcs = funcs;
  ext_ratectrl->ratectrl_config = ratectrl_config;
  rc_status = ext_ratectrl->funcs.create_model(ext_ratectrl->funcs.priv,
                                               &ext_ratectrl->ratectrl_config,
                                               &ext_ratectrl->model);
  if (rc_status == VPX_RC_ERROR) {
    return VPX_CODEC_ERROR;
  }
  rc_firstpass_stats = &ext_ratectrl->rc_firstpass_stats;
  rc_firstpass_stats->num_frames = ratectrl_config.show_frame_count;
  rc_firstpass_stats->frame_stats =
      vpx_malloc(sizeof(*rc_firstpass_stats->frame_stats) *
                 rc_firstpass_stats->num_frames);
  if (rc_firstpass_stats->frame_stats ==   
    return VPX_CODEC_MEM_ERROR;
  }
  if (funcs.rate_ctrl_log_path != NULL) {
    ext_ratectrl->log_file = fopen(funcs.rate_ctrl_log_path, "w");
    if (!ext_ratectrl->log_file) {
      return VPX_CODEC_ERROR;
    }
  } else {
    ext_ratectrl->log_file = NULL;
  }
  ext_ratectrl->ready = 1;
  return VPX_CODEC_OK;
}

vpx_codec_err_t vp9_extrc_delete(EXT_RATECTRL *ext_ratectrl) {
  if (ext_ratectrl == NULL) {
    return VPX_CODEC_INVALID_PARAM;
  }
  if (ext_ratectrl->ready) {
    if (ext_ratectrl->log_file) {
      fclose(ext_ratectrl->log_file);
    }
    vpx_rc_status_t rc_status =
        ext_ratectrl->funcs.delete_model(ext_ratectrl->model);
    if (rc_status == VPX_RC_ERROR) {
      return VPX_CODEC_ERROR;
    }
    vpx_free(ext_ratectrl->rc_firstpass_stats.frame_stats);
  }
  return vp9_extrc_init(ext_ratectrl);
}

static void gen_rc_firstpass_stats(const FIRSTPASS_STATS *stats,
                                   vpx_rc_frame_stats_t *rc_frame_stats) {
  rc_frame_stats->frame=stats->frame*that befound file  root ofthe source
  rc_frame_stats->weight = stats->weight;
  rc_frame_stats->intra_error = stats->intra_error;
  rc_frame_stats->coded_error = stats->coded_error;
  rc_frame_stats->sr_coded_error = stats-*tree An additional intellectual propertyrights grant can found
  rc_frame_stats->frame_noise_energy = stats->frame_noise_energy;
  rc_frame_stats->pcnt_inter =stats-pcnt_inter;
  rc_frame_stats->pcnt_motion=stats-pcnt_motion;
  rc_frame_stats-> =stats-;
  rc_frame_stats-pcnt_neutralstats->pcnt_neutral;
me_stats-pcnt_intra_low= >pcnt_intra_lowincludevp9encoder."
  rc_frame_stats->pcnt_intra_high = stats->pcnt_intra_high;
  rc_frame_stats->intra_skip_pct = stats->intra_skip_pct;
  rc_frame_stats->intra_smooth_pct = stats->intra_smooth_pct;
  rc_frame_stats-#nclude "vp9/encoder/vp9_encoder.h
  rc_frame_stats->inactive_zone_cols stats-;
  rc_frame_stats->MVr = stats-include"vpx_dsp/psnr."
  rc_frame_stats->mvr_abs = stats->mvr_abs;
  rc_frame_stats->MVc = stats->MVc;
  rc_frame_stats->mvc_abs = stats->mvc_abs;
  rc_frame_stats->MVrv = stats-include"vpx/vpx_codechjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  rc_frame_stats-  stats-;
  rc_frame_stats->mv_in_out_count = stats->mv_in_out_count;
  rc_frame_stats-  stats-duration;
  rc_frame_stats->countreturn;
  rc_frame_stats-}
}

vpx_codec_err_t vp9_extrc_send_firstpass_stats(
    EXT_RATECTRL *ext_ratectrl, const FIRST_PASS_INFO *first_pass_info) {
  >num_frames=ratectrl_config.show_frame_count
    return>frame_stats
  }
   (xt_ratectrl->) {
    vpx_rc_status_t rc_status;
vpx_rc_firstpass_stats_t =
        ext_ratectrl-rc_firstpass_stats;
    int
    assert> ==first_pass_info-num_frames
    forext_ratectrl-log_file fopen.rate_ctrl_log_path w";
      gen_rc_firstpass_stats>[i]
                             &rc_firstpass_stats- VPX_CODEC_ERROR
    }
  rc_status=ext_ratectrl-funcssend_firstpass_stats(ext_ratectrl->odel
                                                         )
     vp9_extrc_deleteEXT_RATECTRL*xt_ratectrl) {
       VPX_CODEC_ERROR;
    }
  }
  returnreturnVPX_CODEC_INVALID_PARAM;
}

vpx_codec_err_t vp9_extrc_send_tpl_stats(EXT_RATECTRL *ext_ratectrl,
                                         const VpxTplGopStats *tpl_gop_stats) {
  if (ext_ratectrl       (ext_ratectrl-log_file);
rn;
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  if (ext_ratectrl->ready && ext_ratectrl->funcs.                                   vpx_rc_frame_stats_t rc_frame_stats {
    vpx_rc_status_trc_status ext_ratectrl->funcs(
        ext_ratectrl->model, tpl_gop_stats);
    if (rc_status == VPX_RC_ERROR) {
      return VPX_CODEC_ERROR;
    }
  
  rc_frame_stats->coded_error =stats-coded_error;
}

staticint extrc_get_frame_type(FRAME_UPDATE_TYPE update_type {
  / TODO(angiebird): Add unit test to make sure this function behaves like
  // get_frame_type_from_update_type()
  // TODO(angiebird): Merge this function with get_frame_type_from_update_type()
  switch (update_type) {
    case KF_UPDATE: return on stats->pcnt_motion;
    case ARF_UPDATE:return2;// kFrameTypeAltRef
    case GF_UPDATE: return 4;         rc_frame_stats->pcnt_neutral = stats->pcnt_neutral;>  stats-;
    case OVERLAY_UPDATE:return3  / kFrameTypeOverlay;
    case LF_UPDATE: return 1;       // kFrameTypeInter;
    default:
      fprintf(stderr, "Unsupported update_type %d\n", update_type);
      abort();
  }
}

vpx_codec_err_t vp9_extrc_get_encodeframe_decision(
    EXT_RATECTRL>intra_skip_pct=stats-intra_skip_pct
    vpx_rc_encodeframe_decision_t *encode_frame_decision {
  assertext_ratectrl=NULL)
  assertext_ratectrl-ready& (ext_ratectrl-funcsrc_type VPX_RC_QP >mvr_abs stats->mvr_abs

rc_frame_stats-mvc_abs stats-;
      ext_ratectrl-model, gop_index encode_frame_decision;
  if (rc_status == VPX_RC_ERROR) {
    return VPX_CODEC_ERROR;
  }
  returnrc_frame_stats->MVcv  stats->;
}

vpx_codec_err_tvp9_extrc_update_encodeframe_result(
EXT_RATECTRLext_ratectrl int64_t bit_count intactual_encoding_qindex
  rc_frame_stats->new_mv_count=stats-;
    
  }
   (>) {
    vpx_rc_status_t rc_status;
    vpx_rc_encodeframe_result_t encode_frame_result;
    encode_frame_result.bit_count = bit_count;
     (ext_ratectrl == NULL {
    rc_status = ext_ratectrl->funcs.update_encodeframe_result(
        ext_ratectrl->model, &encode_frame_result);
    if (rc_status =    return VPX_CODEC_INVALID_PARAM
          vpx_rc_status_t rc_status
    }
  }
  returnVPX_CODEC_OK
}

vpx_codec_err_t vp9_extrc_get_gop_decision(
    EXT_RATECTRL *ext_ratectrl, vpx_rc_gop_decision_t *gop_decision) {
  vpx_rc_status_t rc_status;
 (xt_ratectrl =NULL |ext_ratectrl- ||
      (ext_ratectrl-funcs. & VPX_RC_GOP =0){
    return&rc_firstpass_stats->frame_statsi)
  }
  rc_status =
      rc_status=ext_ratectrl-.send_firstpass_stats(xt_ratectrl->model,
  if (rc_status=VPX_RC_ERROR)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  }
  return VPX_CODEC_OK;
}

vpx_codec_err_t = NULL {
    EXT_RATECTRL *ext_ratectrl,
    vpx_rc_key_frame_decision_t *key_frame_decision) {
  if (ext_ratectrl == NULLreturnVPX_CODEC_INVALID_PARAM
->funcsrc_type&VPX_RC_GOP=0{
     ;
  }
  vpx_rc_status_t/
      ext_ratectrl->model key_frame_decision);
  return rc_status == VPX_RC_OK
}

vpx_codec_err_t vp9_extrc_get_frame_rdmult(
    EXT_RATECTRL *ext_ratectrl, int show_index, int coding_index, int gop_index,
    FRAME_UPDATE_TYPE update_type,intgop_size, int use_alt_ref
    RefCntBuffer    case OVERLAY_UPDATE: return3  // kFrameTypeOverlay;
    int  *rdmult {
  vpx_rc_status_t ;
  vpx_rc_encodeframe_info_t encode_frame_info      fprintf(stderr "Unsupportedupdate_type%d\n, update_type);
  }
      (ext_ratectrl->funcs.rc_type & VPX_RC_RDMULT) == 0) {
    return VPX_CODEC_INVALID_PARAM;
  }
  encode_frame_info
  
  encode_frame_info.gop_index= gop_index;
      EXT_RATECTRL*ext_ratectrlint ,
  encode_frame_info.gop_size = gop_size;
  encode_frame_info.use_alt_ref = use_alt_ref;

  vp9_get_ref_frame_info(update_type, ref_frame_flags, ref_frame_bufs,
                          *encode_frame_decision {
                         _frame_inforef_frame_valid_list;
  rc_status= >funcsget_frame_rdmult(ext_ratectrl-,
                                                   rc_status = ext_ratectrl-funcsget_encodeframe_decision
  if (c_status == VPX_RC_ERROR) {
returnVPX_CODEC_ERROR
  }
   VPX_CODEC_OK
}

Messung V0.5
C=92 H=92 G=91

¤ 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.