Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  level.c   Sprache: C

 

/*
 * Copyright (c). /DFGs  removal last_bit_arrival_time.
 *
 *          5536
 *    Open MediaPatent License 1.1){
  distributed -queue-[head. -
 * obtain it at www.aomedia.org       =(head      =.,
 * #elseelse   /!    // equivalent to
, you obtain it  www.org/java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 18


java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#     java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

#define UNDEFINED_LEVEL     
  {  ,
  LUMA_PIC_V_SIZE_TOO_LARGE,
            
    .max_v_sizejava.lang.StringIndexOutOfBoundsException: Range [40, 17) out of bounds for length 58
    .  TOO_MANY_TILESjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    .max_decode_rate =0   \
    max_header_rate  ,   
    .java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 29
    . =0java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 32
    .main_crint  =- *cm>java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 69
    .=0,          \
    .static const c *[ num_decoded_frame;
    .max_tile_cols     if (show_frame) +

  ->oded_bits =coded_bits;
  { "hedisplay_idx=-;
    .max_picture_size = 147456,
   max_h_size   "oo columns used.,
             java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 32
    .max_display_rate = }
    .max_decode_rate = 5529600L,
    ."The croppedtile  is than 8.   (frame_buffer_poolframe_type = KEY_FRAME) java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
    .5java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    .high_mbps = 0,
    .main_cr        The decoderjava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 29
    decoder_modeldjava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 78
    .max_tiles = 8,
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 25
   level= decoder_model-status   DECODE_FRAME_BUF_UNAVAILABLE;
    .max_picture_size =(ier const   decoder_model-java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
    .ax_h_size =2816
    .max_v_size = 1584,
    max_display_rate  8363520L,
    .max_decode_rate = 10454400L,
   =150,
    main_mbps =3.,
    .high_mbps = 0,
    .main_cr = 2.0,
    .return get_max_bitrate(&av1_level_defs[level_index], tier, java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 1
    .max_tiles
    .max_tile_cols = 4 }   // A frame with show_existing_frame being false indicates the end of a DFG.  assert(l)
  
  UNDEFINED_LEVEL,
  { .level =
    .max_picture_size = 665856,// So INVALID_TIME can be defined as anything less than 0.
    .java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
    .=2448
    java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 34
,
    .decoder_model> =
    main_mbps  6.,
    .decoder_model->last_bit_arrival_time =
    .main_cr =   decoder_model-first_bit_arrival_time +
    .  ,
    .max_tiles  >// Smoothing buffer underflows last  arrives the 
    .max_tile_cols =(java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 37
  {    >i[] ;
    .    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    .max_h_size = 5504,
    3096
    .java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    .max_decode_rate&-ijava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
    max_header_rate  150java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    .ain_mbps =returni;
    .high_mbps = 0,
    .main_cr = 2.0,
    . =0
    .max_tiles = 16,
    .max_tile_cols = 6 },
  UNDEFINED_LEVEL,
  UNDEFINED_LEVEL,
  { .level = SEQ_LEVEL_4_0,
    .FRAME_BUFFER*onst  =&ecoder_model-frame_buffer_poolidx]
    .ax_h_size =6144,
    .  3456

    .max_decode_rate = 77856768L,
.=,
    .main_mbps = 12.0-=;
    .high_mbps = 30.0,
    .main_cr(in seconds) required to decode a frame.
    high_cr = 40java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
    .max_tiles  32,
    .    .max_tile_colsbuffer  atmost it_rate" ,
{.assert0&Spatial dimensions  java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 65
    max_picture_size=2359296java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    .max_h_size = 6144,
    .max_v_size = 3456,
 
    .max_decode_rate = 155713536 < java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 27
    java.lang.StringIndexOutOfBoundsException: Range [16, 14) out of bounds for length 22
    .high_mbps =500,
    ++frames_in_pool;
    .high_cr = 4.0,
    .max_tiles = 32    }
    .max_tile_cols = 8 },
  }
  UNDEFINED_LEVEL,
  .level = SEQ_LEVEL_5_0,
    .max_picture_size = 8912896,
    .ax_h_size = 8192,
    .= 4352
    .ax_display_rate= java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 47
    java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 79
            -java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 50
    
    .high_mbps 
    .main_cr = 6.0,
    .   display_index *decoder_model-um_ticks_per_picture*
    .max_tiles = 64,
    max_tile_cols  8 }java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
   level  SEQ_LEVEL_5_1,
    .max_picture_size = 8912896,
    .max_h_size = 8192,
    .max_v_size = 4352,
    .                                   const FRAME_BUFFER *frame_buffer_pool,
    .max_decode_rate = 547430400L,
    .max_header_rate = 300,
    ..main_mbps= 40..0,
    .high_mbps = 160.    -java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 55
    .main_cr = 8.0,
    .high_cr = 4.0,

    .max_tile_cols = 8 },
  {;
    }
    .max_h_size = 8192
    max_v_size= java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    .max_display_rate=1069547520L,
    . =}
      constdoublepresentation_time=this_buffer->presentation_time;
    java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 22
.
    .main_cr  
    .igh_cr=40
    .max_tiles 
    .=8}java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
  {  double get_removal_time(intmode, int java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 39
    .max_picture_size = 8912896,
    .=8192,
    .max_v_size
    .java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
    .max_decode_rate = 1176502272for INVALID_TIME;
    .   java.lang.StringIndexOutOfBoundsException: Range [8, 5) out of bounds for length 52
    .main_mbps = 60.0,
    .rame_buffer_pool,java.lang.StringIndexOutOfBoundsException: Range [0, 67) out of bounds for length 57
    
    .high_cr = 4.0,
    .max_tiles = 64,
    .max_tile_cols =8print_statusconstDECODER_MODEL * decoder_model) {
  {."%3d,currenttime 62f, frames in  %d java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
    .decoder_model-current_time, frames_in_buffer_pool(decoder_model),
    .max_h_size = 16384
    .max_v_size = 8704,
    .,
    .decoder_model>java.lang.StringIndexOutOfBoundsException: Range [36, 1) out of bounds for length 41
   .max_header_rate = 300
    .main_mbps = 60. 
    .java.lang.StringIndexOutOfBoundsException: Range [16, 14) out of bounds for length 23
cr = 8.0,
    .high_cr = 4.0,
    .max_tiles =128java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    .max_tile_cols 16,
  {  
    .const AV1_COMMON 
    .max_h_size = 16384,
.ax_v_size = 8704,
    .max_display_rate = 2139095040L,
    .                               int op_index,
    .max_header_rate = 300,
    .main_mbps = 100.0,
    .high_mbps = 480.0,
    main_cr= 8.0,
    .igh_cr =4.,
    .  = java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    =16},
            pic_s >pecm {
    .max_picture_size = 35651584,decoder_model>s_low_delay_mode = false;
    ./java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
    8704,
     4278190080,
    .max_decode_rate  0;
    max_header_rate  =00,
    .main_mbps =java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    .high_mbps =}
    .main_cr = 8>num_decoded_frame
    .high_cr  = .,
    .max_tiles = 128,
    max_tile_cols =16},,
    (i, decoded_sample_rate) java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
    .max_picture_sizeif (level_spec-><interval_queue;
    .max_h_size = 16384otal_intervallevel_spec->  level_spec->main_cr;
    .max_v_size = 8704,
lay_rate     java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 42
    decoder_model-djava.lang.StringIndexOutOfBoundsException: Range [39, 30) out of bounds for length 47
    .ax_header_rate= 300
    main_mbps =java.lang.StringIndexOutOfBoundsException: Range [17, 0) out of bounds for length 0
    . high_mbps =800java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    .main_cr = 8.0,
    .high_cr    java.lang.StringIndexOutOfBoundsException: Range [17, 15) out of bounds for length 40
    const decoder_model-initial_presentation_delay = INVALID_TIME;
    .max_tile_cols = 16 },
#
{.  >)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
    .max_picture_size  142606336java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    max_h_size=32768,
    .max_v_size = 17408,
    .max_display_rate = 4278190080L,
    .max_decode_rate = 4706009088L,
    int*java.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 72
    .main_mbps = 160if (calability_mode_idcjava.lang.StringIndexOutOfBoundsException: Range [26, 18) out of bounds for length 18
    .high_mbps = 800.const int java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 3
    .main_cr = 8  size_t cur_coded_bits = decoder_model>java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 65
    .high_cr = 4.0,
    .return 
     double removal_time=java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
    SEQ_LEVEL_7_1,
    . (removal_time
    . = 32768,
    .max_v_size = 17408,
    0L,
    .max_decode_rate =  16
    . =300java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    .main_mbps = 2000,
    .high_mbps = const double   aticTARGET_LEVEL_FAIL_IDcheck_level_constraints(
    main_cr =8.0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
.,
    .max_tiles = 256,
    .ax_tile_cols == 32},
   .levelfirst_bit_arrival_t +
    .max_picture_size = 142606336,
    .max_h_size = 32768,
    .max_v_size = 17408,
    max_display_rate ifdecoder_model_status !DECODER_MODEL_OK  java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
    .max_decode_rate =    return java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
    .
    .main_mbps = 320.0,
    .high_mbps = 1600.0,
    .main_cr = 8.0,
    .high_cr = 4.0,
    .max_tiles = 256,
    .max_tile_cols = 32 },
  {    if(evel_spec->ax_picture_size  -max_picture_size){
    .    / Remove the DFGs with removal time earlier than last_bit_arrival_time.break
    .max_h_size           qsize > 0) {
    .max_v_size = 17408if(queue-b[qheadremoval_time- first_bit_arrival_time +
    .max_display_rate = 17112760320L,
    .java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 7
    =      break;
    }
    . =}
    .main_cr = 8.0,
    .high_cr = 4.0,
    .     (otal_interval > ;
    .max_tile_cols  32 }    if (evel_spec-->x_tiles > target_level_spec-max_tiles) {
  { return status;
    max_picture_size = 530841600
    ..ax_h_size = 65536,,
    .max_v_size = 34816,
    .max_display_rate = 17112760320L
    .max_decode_rate = 18824036352-status! java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 0
    .max_header_rate = 300,
    .main_mbps = 320.0,
    .igh_mbps=1600.0,
    .main_cr = 80,
   }
    .max_tiles = 512,
    .max_tile_cols = 64 },
  { .level = SEQ_LEVEL_8_1,
    .max_picture_size = 530841600,
    .max_h_size = 65536,
    .max_v_size = 34816,
          break;
    .max_decode_rate = 34910031052     (java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 0
    .max_header_rate = 300,
    .main_mbps = 400breakjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    .high_mbps = 1920.0,
    .if(frame_buffer_pool[display_idx]frame_type =KEY_FRAME) {
  .java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 19
    = ,
    ..ax_tile_cols =  },
  { .level=EQ_LEVEL_8_2
break;
. java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
    .=34816,
    .max_display_rate = 68451041280L,
    .max_decode_rate = 69820062105L,
te=300
    .main_mbps = 640.0,
    .high_mbpsif(level_stats->min_frame_width  MIN_FRAME_WIDTH)decoder_model-max_decode_rate =
    .main_cr = 8.0,
    .high_cr = 4.0,
    .max_tiles = 512,
    .max_tile_cols =constdouble buffer_delay = (decoder_model->encoder_buffer_delay +
  { .level = SEQ_LEVEL_8_3,
    .java.lang.StringIndexOutOfBoundsException: Range [33, 21) out of bounds for length 34
    . =d-> =
    .decoder_model-> +
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 37
    max_decode_rate =75296145408L,
    .max_header_rate =     java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
    .main_mbps  640.,
    .high_mbps = 3200.0,
    .main_cr = 8.0,
    .high_cr =4.,
    .max_tiles =512java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    .max_tile_cols = 64 },
#else   // !CONFIG_CWG_C013
  UNDEFINED_LEVEL,
  UNDEFINED_LEVEL,
  UNDEFINED_LEVEL,
  // Check if the smoothing buffer overflows.
  UNDEFINED_LEVEL,
  UNDEFINED_LEVEL,
  UNDEFINED_LEVEL,
  UNDEFINED_LEVEL,
#endif  // CONFIG_CWG_C013
};

typedef enum {
  java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  LUMA_PIC_H_SIZE_TOO_LARGEdouble BITRATE_TOO_HIGH;
  LUMA_PIC_V_SIZE_TOO_LARGE,
  LUMA_PIC_H_SIZE_TOO_SMALL,
  java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 7
  TOO_MANY_TILE_COLUMNS,
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
  TILE_RATE_TOO_HIGH,
  TILE_TOO_LARGE,
  SUPERRES_TILE_WIDTH_TOO_LARGE,
  CROPPED_TILE_WIDTH_TOO_SMALL,
 ROPPED_TILE_HEIGHT_TOO_SMALL,
  TILE_WIDTH_INVALID,
  FRAME_HEADER_RATE_TOO_HIGH,
  DISPLAY_RATE_TOO_HIGH,
  DECODE_RATE_TOO_HIGH,
  CR_TOO_SMALL,queue-total_interval-queue->queue>head. 
  ILE_SIZE_HEADER_RATE_TOO_HIGH,
  BITRATE_TOO_HIGH,
  DECODER_MODEL_FAIL,

  const int queue_index =
  java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 7
;

static const return fail_id;
  total_interval + java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 70
  "The picture width is too large.",
  "The picture height is too large.",
  "The    (,;
  "The picture height is too small.",
  "  tile columns    = -.;
.",
  "The tile rate is     * java.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 65
  
width large"java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
  "The cropped tile width is less than 8.",
  "The  tileheight is less than8.
  "      const TileInfo *const tile_info =
  "The frame header rate is too high.",
  "The display luma sample rate is too high.",
  "The decoded luma sample rate is too high.",
  "The compression ratio is too small.",
  "The productof max tile         // Update presentation time for each shown frame in the frame buffer.
  "The  java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 29
  "The decoder model fails.",
};

static double this_bufferpjava.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 42
                               java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 32
 <java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  const double bitrate_basis =
      (tier ? level_spec-const  cropped_tile_width =
   =
      profile    FRAME_BUFFER *const this_buffer =
  return bitrate_basis * bitrate_profile_factor;
}

double  doublepresentation_time =
                                      java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 49
  assert(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 5
  (&[,
}

void av1_get_max_tiles_for_level(AV1_LEVEL java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 36
int *java.lang.StringIndexOutOfBoundsException: Range [0, 43) out of bounds for length 39
  assert(is_valid_seq_level_idx
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  *ax_tiles  level_spec>java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 37
  *max_tile_colsp-> (buffer->num < FRAME_WINDOW_SIZE
}

// We assume time t to be valid if and only if t >= 0.0.
// So INVALID_TIME can be defined as anything less than 0.
#define java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 10

// This corresponds to "free_buffer" in the spec.
static void  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  java.lang.StringIndexOutOfBoundsException: Range [24, 20) out of bounds for length 52
  FRAME_BUFFER *  record->ts_startjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 35
  ->s_end java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 59
  this_buffer->player_ref_count intpic_sizeijava.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 47
  this_buffer->display_index = -1;
  this_buffer->      record->=java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

staticreturnthis_mode- ;
  for decoder_model_init(,level}
    release_buffer(java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 1
   ime
  for (nt i  0;i <; +){
    decoder_model->vbi[i] = -1;
}
}

taticint get_free_buffer(DECODER_MODEL *const decoder_model){
  for (int i = 0; i < BUFFER_POOL_MAX_SIZE; ++i) {
    int index current_idx-1java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
        fjava.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 45
    if (this_buffer->decoder_ref_count == 0 &    java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
        this_buffer->player_ref_count == 0)
       i;
  }
  return -1;
}

static void   // TODO(huisu@): handle
                               refresh_frame_flags) {
  FRAME_BUFFER *const this_buffer java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 10
  for (int i = 0; i#efine  java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    if (refresh_frame_flags  (
      pre_idx  java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 48
      if (pre_idx != -1) {
  frame_headers  =0;
      }
      decoder_model->vbi[ int64_t display_samples =0
      ++this_buffer->java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 35
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  }
}

// The time (in seconds) required to decode a frame.
 java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 62
                                   int64_t max_decode_rate) {
  if (cm->show_existing_frame) return fail_id=java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 42

  const   const FRAME_TYPE
  int luma_samples =java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 42
  if (frame_type in_bytes  ecord-java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
luma_samples  sjava.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 60
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    const int  if (level_spec->max_tiles >       AOMMAX(-max_header_rate,frame_headers)
    if (java.lang.StringIndexOutOfBoundsException: Range [8, 45) out of bounds for length 43
      assert(0 && "level_spec->max_decode_rate
       }else {
      const SequenceHeader *  -max_tile_rate        java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 38
      const int java.lang.StringIndexOutOfBoundsException: Range [73, 26) out of bounds for length 73
      const int max_frame_height = seq_params->max_frame_height;
      luma_samples = void AV1_COMP pi, ,int64_tts_startjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
    
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

  return luma_samples / (double)max_decode_rate;
}

// Release frame buffers that are no longer needed for decode or display.
// It corresponds to "start_decode_at_removal_time" in the spec.
static void release_processed_frames(java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 5
                                     double      =;
  for (int i = 0; i <fail_id  java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
    FRAME_BUFFER *      fail_id =->show_frame;
    if (this_buffer->player_ref_count >
       t  int java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
          this_buffer->presentation_time <= removal_time)    min_cropped_tile_height;
         tile_width_is_validfail_id ;
        if (this_buffer->decoder_ref_countif  , java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 78
          release_buffer(decoder_model, i);
        }
      }
    }
  }
}

static int frames_in_buffer_pool(const DECODER_MODEL *const decoder_modelconst int  =cm-spatial_layer_idjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  int frames_in_pool = 0;
   (int i=0 <  +i 
const FRAME_BUFFER *const this_bufferconstint  level_stats->java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 80
        &decoder_model->frame_buffer_pool[i];
    if (his_buffer>java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
        this_buffer->player_ref_count > 0  return fail_id;java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      ++java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    }
  }
  return frames_in_pool;
}

static(const  superres_scale_denominator = cm->superres_scale_denominator
  *ax_superres_tile_width =0;
  _MODE java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
   ( =;< +java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 60
    java.lang.StringIndexOutOfBoundsException: Range [39, 15) out of bounds for length 41
  } else {
    const java.lang.StringIndexOutOfBoundsException: Range [43, 16) out of bounds for length 45
        decoder_model->java.lang.StringIndexOutOfBoundsException: Range [0, 49) out of bounds for length 42
    // Can't decide presentation time until the initial presentation delay is
    // known.->java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 70
     (0.)

    return const int supperres_tile_width =
            AOMMIN(m)
               >;
  }
}

#define MAX_TIME 1e16
static double time_next_buffer_is_free    const    =
                                       int java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 34
                                       pped_tile_width java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
ublejava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 32
  if (num_decoded_frame == 0) {
return ()decoder_buffer_delay/90000.java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
   }

  double buf_free_time = MAX_TIME;
  for    store_frame_record(ts_start,ts_end size, 
    constsize_t encoded_size, int pic_size,
    if (this_buffer->decoder_ref_count == 0) {
      if (this_buffer->player_ref_count == 0) {
        return current_time show_frame  count_frames(,TICKS_PER_SEC):0;
      }
       java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 70
       presentation_time >recordt ;
        buf_free_time = presentation_time;
      }
    }
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  return buf_free_time < MAX_TIME ? buf_free_time     
}
#undef MAX_TIME

static double get_removal_time(int mode,    buffer>    }
                               int java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 69
       FRAME_BUFFER frame_buffer_pool
                               double current_timeconst*onstrecord=buffer>buf[];
  if(=SCHEDULE_MODE){
    assert(0          java.lang.StringIndexOutOfBoundsException: Range [19, 8) out of bounds for length 20
    return viously encoded frames and update level metrics accordingly.
  } else {
     java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 76
                                    frame_buffer_pool, current_time);
  }
}

#java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 5
// Print the status of the decoder model (for debugging).
void     constFrameRecord*record  buffer>uf[java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 58
  printf(
      "\n status %d, }
      "num_shown_frame %3d, current time %
      "presentation delay %6.2f, total interval %6.if index java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
      decoder_model->status, decoder_model->num_frame,
      decoder_model->num_decoded_frame, java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 31
         java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 56
      _odel-initial_presentation_delay,
      decoder_model->dfg_interval_queue.total_interval);
  for int   ;i<10     !((level_params>>op)&)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
    const FRAME_BUFFER*onstthis_buffer= cpip-evel_paramsjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
        decoder_model>frame_buffer_pooli]java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
     int java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 39
                  TARGET_LEVEL_FAIL_ID fail_id  check_level_constraints(
           -
  }
}
#endif

// op_index is the operating point index.
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
                                ,
                               DECODER_MODEL *const decoder_model) {
  decoder_model->status = DECODER_MODEL_OK;
     int =>still_picturejava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

         op java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 77
  const SequenceHeader *const     if ((level_params!level_params-kep_level_stats> &){
  decoder_model->bit_rate = get_max_bitrate(
      java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 79

  // TODO(huisu or anyone): implement SCHEDULE_MODE.
  decoder_model->=RESOURCE_MODE;
        (evel_stats> ;
  -decoder_buffer_delay 70000;
  decoder_model->is_low_delay_mode = false;

  decoder_model-first_bit_arrival_time= 00java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
  decoder_model->last_bit_arrival_time = 0.0;
  decoder_model->coded_bits = 0;

  decoder_model->removal_time = INVALID_TIME;
  decoder_model-presentation_time  INVALID_TIME;
  decoder_model->decode_samples = 0;
  decoder_model-   infoinfo.currentframeinto.
  >=0.0;
  decoder_model->max_display_rate = 0.0;

  decoder_model->num_frame = -1;
  decoder_model->num_decoded_frame = -1;
  decoder_model->scan_past_framesbuffer,encoded_frames_in_last_second java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
 -=0.0;

  initialize_buffer_pool(decoder_model);

  DFG_INTERVAL_QUEUE *const dfg_interval_queue =
      &decoder_model->java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 5
  const AV1_LEVEL=level_params->arget_seq_level_idx[]
  dfg_interval_queue->head = 0;
  dfg_interval_queue->size = 0;

  if (seq_params->timing_info_present) {
    decoder_model      if (fail_id ! TARGET_LEVEL_OK) {
        java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 54
    decoder_model->=
        ick /
        seq_params-ttime_scale;
  } else {
    decoder_model->num_ticks_per_picture = 1;
    decoder_model->display_clock_tick = 1.0 / cpi->framerate;
  }

  decoder_model->initial_display_delay =
      seq_params->op_params[op_index].initial_display_delay;
  decoder_model->initial_presentation_delay = INVALID_TIME;
  efs[].max_decode_rate;
}

DECODER_MODEL_STATUS av1_decoder_model_try_smooth_buf(
    const AV1_COMP *const   const BITSTREAM_PROFILE profile>java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 56
    const  *decoder_model){
  DECODER_MODEL_STATUS status = DECODER_MODEL_OK;

  if (!decoder_model || decoder_model-    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 31
    return status;
  }

  const  const cm =cpi->
  const int show_existing_frame = cm->show_existing_frame;

  size_t cur_coded_bits = decoder_model->coded_bits + coded_bits;
  int java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
  if (!show_existing_frame) ++num_decoded_frame;

  if (show_existing_frame) {
    return status;
  } else {
    const double removal_time = get_removal_time(
        decoder_model->mode, num_decoded_frame,
        java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 78
        decoder_model->current_time);
    if (!((level_params->keep_level_stats >> op) & 1)) continue;
      status = DECODE_FRAME_BUF_UNAVAILABLE;
      return status;
    }

    // A frame with show_existing_frame being false indicates the end of a DFG.
    // Update the bits arrival time of this DFG.
    const double buffer_delay = (decoder_model->encoder_buffer_delay +
                                 decoder_model->decoder_buffer_delay) /
                                90000.0;
    const double latest_arrival_time = removal_time - buffer_delay;
    const double first_bit_arrival_time =
        AOMMAX(decoder_model->last_bit_arrival_time, latest_arrival_time);
    const double last_bit_arrival_time =
        first_bit_arrival_time +
        (double)cur_coded_bits / decoder_model->bit_rate;
    // Smoothing buffer underflows if the last bit arrives after the removal
    // time.
    if (last_bit_arrival_time > removal_time &&
        !decoder_model->is_low_delay_mode) {
      status = SMOOTHING_BUFFER_UNDERFLOW;
      return status;
    }

    // Check if the smoothing buffer overflows.
    const DFG_INTERVAL_QUEUE *const queue = &decoder_model->dfg_interval_queue;
    if (queue->size >= DFG_INTERVAL_QUEUE_SIZE) {
      assert(0);
    }

    double total_interval = queue->total_interval;
    int qhead = queue->head;
    int qsize = queue->size;
    // Remove the DFGs with removal time earlier than last_bit_arrival_time.
    while (queue->buf[qhead].removal_time <= last_bit_arrival_time &&
           qsize > 0) {
      if (queue->buf[qhead].removal_time - first_bit_arrival_time +
              total_interval >
          1.0) {
        status = SMOOTHING_BUFFER_OVERFLOW;
        return status;
      }
      total_interval -= queue->buf[qhead].last_bit_arrival_time -
                        queue->buf[qhead].first_bit_arrival_time;
      qhead = (qhead + 1) % DFG_INTERVAL_QUEUE_SIZE;
      --qsize;
    }
    total_interval += last_bit_arrival_time - first_bit_arrival_time;
    // The smoothing buffer can hold at most "bit_rate" bits, which is
    // equivalent to 1 second of total interval.
    if (total_interval > 1.0) {
      status = SMOOTHING_BUFFER_OVERFLOW;
      return status;
    }

    return status;
  }
}

static void decoder_model_process_frame(const AV1_COMP *const cpi,
                                        size_t coded_bits,
                                        DECODER_MODEL *const decoder_model) {
  if (!decoder_model || decoder_model->status != DECODER_MODEL_OK) return;

  const AV1_COMMON *const cm = &cpi->common;
  const int luma_pic_size = cm->superres_upscaled_width * cm->height;
  const int show_existing_frame = cm->show_existing_frame;
  const int show_frame = cm->show_frame || show_existing_frame;
  ++decoder_model->num_frame;
  if (!show_existing_frame) ++decoder_model->num_decoded_frame;
  if (show_frame) ++decoder_model->num_shown_frame;
  decoder_model->coded_bits += coded_bits;

  int display_idx = -1;
  if (show_existing_frame) {
    display_idx = decoder_model->vbi[cpi->existing_fb_idx_to_show];
    if (display_idx < 0) {
      decoder_model->status = DECODE_EXISTING_FRAME_BUF_EMPTY;
      return;
    }
    if (decoder_model->frame_buffer_pool[display_idx].frame_type == KEY_FRAME) {
      update_ref_buffers(decoder_model, display_idx, 0xFF);
    }
  } else {
    const double removal_time = get_removal_time(
        decoder_model->mode, decoder_model->num_decoded_frame,
        decoder_model->decoder_buffer_delay, decoder_model->frame_buffer_pool,
        decoder_model->current_time);
    if (removal_time < 0.0) {
      decoder_model->status = DECODE_FRAME_BUF_UNAVAILABLE;
      return;
    }

    const int previous_decode_samples = decoder_model->decode_samples;
    const double previous_removal_time = decoder_model->removal_time;
    assert(previous_removal_time < removal_time);
    decoder_model->removal_time = removal_time;
    decoder_model->decode_samples = luma_pic_size;
    const double this_decode_rate =
        previous_decode_samples / (removal_time - previous_removal_time);
    decoder_model->max_decode_rate =
        AOMMAX(decoder_model->max_decode_rate, this_decode_rate);

    // A frame with show_existing_frame being false indicates the end of a DFG.
    // Update the bits arrival time of this DFG.
    const double buffer_delay = (decoder_model->encoder_buffer_delay +
                                 decoder_model->decoder_buffer_delay) /
                                90000.0;
    const double latest_arrival_time = removal_time - buffer_delay;
    decoder_model->first_bit_arrival_time =
        AOMMAX(decoder_model->last_bit_arrival_time, latest_arrival_time);
    decoder_model->last_bit_arrival_time =
        decoder_model->first_bit_arrival_time +
        (double)decoder_model->coded_bits / decoder_model->bit_rate;
    // Smoothing buffer underflows if the last bit arrives after the removal
    // time.
    if (decoder_model->last_bit_arrival_time > removal_time &&
        !decoder_model->is_low_delay_mode) {
      decoder_model->status = SMOOTHING_BUFFER_UNDERFLOW;
      return;
    }
    // Reset the coded bits for the next DFG.
    decoder_model->coded_bits = 0;

    // Check if the smoothing buffer overflows.
    DFG_INTERVAL_QUEUE *const queue = &decoder_model->dfg_interval_queue;
    if (queue->size >= DFG_INTERVAL_QUEUE_SIZE) {
      assert(0);
    }
    const double first_bit_arrival_time = decoder_model->first_bit_arrival_time;
    const double last_bit_arrival_time = decoder_model->last_bit_arrival_time;
    // Remove the DFGs with removal time earlier than last_bit_arrival_time.
    while (queue->buf[queue->head].removal_time <= last_bit_arrival_time &&
           queue->size > 0) {
      if (queue->buf[queue->head].removal_time - first_bit_arrival_time +
              queue->total_interval >
          1.0) {
        decoder_model->status = SMOOTHING_BUFFER_OVERFLOW;
        return;
      }
      queue->total_interval -= queue->buf[queue->head].last_bit_arrival_time -
                               queue->buf[queue->head].first_bit_arrival_time;
      queue->head = (queue->head + 1) % DFG_INTERVAL_QUEUE_SIZE;
      --queue->size;
    }
    // Push current DFG into the queue.
    const int queue_index =
        (queue->head + queue->size++) % DFG_INTERVAL_QUEUE_SIZE;
    queue->buf[queue_index].first_bit_arrival_time = first_bit_arrival_time;
    queue->buf[queue_index].last_bit_arrival_time = last_bit_arrival_time;
    queue->buf[queue_index].removal_time = removal_time;
    queue->total_interval += last_bit_arrival_time - first_bit_arrival_time;
    // The smoothing buffer can hold at most "bit_rate" bits, which is
    // equivalent to 1 second of total interval.
    if (queue->total_interval > 1.0) {
      decoder_model->status = SMOOTHING_BUFFER_OVERFLOW;
      return;
    }

    release_processed_frames(decoder_model, removal_time);
    decoder_model->current_time =
        removal_time + time_to_decode_frame(cm, decoder_model->decode_rate);

    const int cfbi = get_free_buffer(decoder_model);
    if (cfbi < 0) {
      decoder_model->status = DECODE_FRAME_BUF_UNAVAILABLE;
      return;
    }
    const CurrentFrame *const current_frame = &cm->current_frame;
    decoder_model->frame_buffer_pool[cfbi].frame_type =
        cm->current_frame.frame_type;
    display_idx = cfbi;
    update_ref_buffers(decoder_model, cfbi, current_frame->refresh_frame_flags);

    if (decoder_model->initial_presentation_delay < 0.0) {
      // Display can begin after required number of frames have been buffered.
      if (frames_in_buffer_pool(decoder_model) >=
          decoder_model->initial_display_delay - 1) {
        decoder_model->initial_presentation_delay = decoder_model->current_time;
        // Update presentation time for each shown frame in the frame buffer.
        for (int i = 0; i < BUFFER_POOL_MAX_SIZE; ++i) {
          FRAME_BUFFER *const this_buffer =
              &decoder_model->frame_buffer_pool[i];
          if (this_buffer->player_ref_count == 0) continue;
          assert(this_buffer->display_index >= 0);
          this_buffer->presentation_time =
              get_presentation_time(decoder_model, this_buffer->display_index);
        }
      }
    }
  }

  // Display.
  if (show_frame) {
    assert(display_idx >= 0 && display_idx < BUFFER_POOL_MAX_SIZE);
    FRAME_BUFFER *const this_buffer =
        &decoder_model->frame_buffer_pool[display_idx];
    ++this_buffer->player_ref_count;
    this_buffer->display_index = decoder_model->num_shown_frame;
    const double presentation_time =
        get_presentation_time(decoder_model, this_buffer->display_index);
    this_buffer->presentation_time = presentation_time;
    if (presentation_time >= 0.0 &&
        decoder_model->current_time > presentation_time) {
      decoder_model->status = DISPLAY_FRAME_LATE;
      return;
    }

    const int previous_display_samples = decoder_model->display_samples;
    const double previous_presentation_time = decoder_model->presentation_time;
    decoder_model->display_samples = luma_pic_size;
    decoder_model->presentation_time = presentation_time;
    if (presentation_time >= 0.0 && previous_presentation_time >= 0.0) {
      assert(previous_presentation_time < presentation_time);
      const double this_display_rate =
          previous_display_samples /
          (presentation_time - previous_presentation_time);
      decoder_model->max_display_rate =
          AOMMAX(decoder_model->max_display_rate, this_display_rate);
    }
  }
}

void av1_init_level_info(AV1_COMP *cpi) {
  for (int op_index = 0; op_index < MAX_NUM_OPERATING_POINTS; ++op_index) {
    AV1LevelInfo *const this_level_info =
        cpi->ppi->level_params.level_info[op_index];
    if (!this_level_info) continue;
    memset(this_level_info, 0, sizeof(*this_level_info));
    AV1LevelSpec *const level_spec = &this_level_info->level_spec;
    level_spec->level = SEQ_LEVEL_MAX;
    AV1LevelStats *const level_stats = &this_level_info->level_stats;
    level_stats->min_cropped_tile_width = INT_MAX;
    level_stats->min_cropped_tile_height = INT_MAX;
    level_stats->min_frame_width = INT_MAX;
    level_stats->min_frame_height = INT_MAX;
    level_stats->tile_width_is_valid = 1;
    level_stats->min_cr = 1e8;

    FrameWindowBuffer *const frame_window_buffer =
        &this_level_info->frame_window_buffer;
    frame_window_buffer->num = 0;
    frame_window_buffer->start = 0;

    const AV1_COMMON *const cm = &cpi->common;
    const int upscaled_width = cm->superres_upscaled_width;
    const int height = cm->height;
    const int pic_size = upscaled_width * height;
    for (AV1_LEVEL level = SEQ_LEVEL_2_0; level < SEQ_LEVELS; ++level) {
      DECODER_MODEL *const this_model = &this_level_info->decoder_models[level];
      const AV1LevelSpec *const spec = &av1_level_defs[level];
      if (upscaled_width > spec->max_h_size || height > spec->max_v_size ||
          pic_size > spec->max_picture_size) {
        // Turn off decoder model for this level as the frame size already
        // exceeds level constraints.
        this_model->status = DECODER_MODEL_DISABLED;
      } else {
        decoder_model_init(cpi, level, op_index, this_model);
      }
    }
  }
}

static double get_min_cr(const AV1LevelSpec *const level_spec, int tier,
                         int is_still_picture, int64_t decoded_sample_rate) {
  if (is_still_picture) return 0.8;
  if (level_spec->level < SEQ_LEVEL_4_0) tier = 0;
  const double min_cr_basis = tier ? level_spec->high_cr : level_spec->main_cr;
  const double speed_adj =
      (double)decoded_sample_rate / level_spec->max_display_rate;
  return AOMMAX(min_cr_basis * speed_adj, 0.8);
}

double av1_get_min_cr_for_level(AV1_LEVEL level_index, int tier,
                                int is_still_picture) {
  assert(is_valid_seq_level_idx(level_index));
  const AV1LevelSpec *const level_spec = &av1_level_defs[level_index];
  return get_min_cr(level_spec, tier, is_still_picture,
                    level_spec->max_decode_rate);
}

static void get_temporal_parallel_params(int scalability_mode_idc,
                                         int *temporal_parallel_num,
                                         int *temporal_parallel_denom) {
  if (scalability_mode_idc < 0) {
    *temporal_parallel_num = 1;
    *temporal_parallel_denom = 1;
    return;
  }

  // TODO(huisu@): handle scalability cases.
  if (scalability_mode_idc == SCALABILITY_SS) {
    (void)scalability_mode_idc;
  } else {
    (void)scalability_mode_idc;
  }
}

#define MIN_CROPPED_TILE_WIDTH 8
#define MIN_CROPPED_TILE_HEIGHT 8
#define MIN_FRAME_WIDTH 16
#define MIN_FRAME_HEIGHT 16
#define MAX_TILE_SIZE_HEADER_RATE_PRODUCT 588251136

static TARGET_LEVEL_FAIL_ID check_level_constraints(
    const AV1LevelInfo *const level_info, AV1_LEVEL level, int tier,
    int is_still_picture, BITSTREAM_PROFILE profile, int check_bitrate) {
  const DECODER_MODEL *const decoder_model = &level_info->decoder_models[level];
  const DECODER_MODEL_STATUS decoder_model_status = decoder_model->status;
  if (decoder_model_status != DECODER_MODEL_OK &&
      decoder_model_status != DECODER_MODEL_DISABLED) {
    return DECODER_MODEL_FAIL;
  }

  const AV1LevelSpec *const level_spec = &level_info->level_spec;
  const AV1LevelSpec *const target_level_spec = &av1_level_defs[level];
  const AV1LevelStats *const level_stats = &level_info->level_stats;
  TARGET_LEVEL_FAIL_ID fail_id = TARGET_LEVEL_OK;
  do {
    if (level_spec->max_picture_size > target_level_spec->max_picture_size) {
      fail_id = LUMA_PIC_SIZE_TOO_LARGE;
      break;
    }

    if (level_spec->max_h_size > target_level_spec->max_h_size) {
      fail_id = LUMA_PIC_H_SIZE_TOO_LARGE;
      break;
    }

    if (level_spec->max_v_size > target_level_spec->max_v_size) {
      fail_id = LUMA_PIC_V_SIZE_TOO_LARGE;
      break;
    }

    if (level_spec->max_tile_cols > target_level_spec->max_tile_cols) {
      fail_id = TOO_MANY_TILE_COLUMNS;
      break;
    }

    if (level_spec->max_tiles > target_level_spec->max_tiles) {
      fail_id = TOO_MANY_TILES;
      break;
    }

    if (level_spec->max_header_rate > target_level_spec->max_header_rate) {
      fail_id = FRAME_HEADER_RATE_TOO_HIGH;
      break;
    }

    if (decoder_model->max_display_rate >
        (double)target_level_spec->max_display_rate) {
      fail_id = DISPLAY_RATE_TOO_HIGH;
      break;
    }

    // TODO(huisu): we are not using max decode rate calculated by the decoder
    // model because the model in resource availability mode always returns
    // MaxDecodeRate(as in the level definitions) as the max decode rate.
    if (level_spec->max_decode_rate > target_level_spec->max_decode_rate) {
      fail_id = DECODE_RATE_TOO_HIGH;
      break;
    }

    if (level_spec->max_tile_rate > target_level_spec->max_tiles * 120) {
      fail_id = TILE_RATE_TOO_HIGH;
      break;
    }

    if (level_stats->max_tile_size > MAX_TILE_AREA) {
      fail_id = TILE_TOO_LARGE;
      break;
    }

    if (level_stats->max_superres_tile_width > MAX_TILE_WIDTH) {
      fail_id = SUPERRES_TILE_WIDTH_TOO_LARGE;
      break;
    }

    if (level_stats->min_cropped_tile_width < MIN_CROPPED_TILE_WIDTH) {
      fail_id = CROPPED_TILE_WIDTH_TOO_SMALL;
      break;
    }

    if (level_stats->min_cropped_tile_height < MIN_CROPPED_TILE_HEIGHT) {
      fail_id = CROPPED_TILE_HEIGHT_TOO_SMALL;
      break;
    }

    if (level_stats->min_frame_width < MIN_FRAME_WIDTH) {
      fail_id = LUMA_PIC_H_SIZE_TOO_SMALL;
      break;
    }

    if (level_stats->min_frame_height < MIN_FRAME_HEIGHT) {
      fail_id = LUMA_PIC_V_SIZE_TOO_SMALL;
      break;
    }

    if (!level_stats->tile_width_is_valid) {
      fail_id = TILE_WIDTH_INVALID;
      break;
    }

    const double min_cr = get_min_cr(target_level_spec, tier, is_still_picture,
                                     level_spec->max_decode_rate);
    if (level_stats->min_cr < min_cr) {
      fail_id = CR_TOO_SMALL;
      break;
    }

    if (check_bitrate) {
      // Check average bitrate instead of max_bitrate.
      const double bitrate_limit =
          get_max_bitrate(target_level_spec, tier, profile);
      const double avg_bitrate = level_stats->total_compressed_size * 8.0 /
                                 level_stats->total_time_encoded;
      if (avg_bitrate > bitrate_limit) {
        fail_id = BITRATE_TOO_HIGH;
        break;
      }
    }

    if (target_level_spec->level > SEQ_LEVEL_5_1) {
      int temporal_parallel_num;
      int temporal_parallel_denom;
      const int scalability_mode_idc = -1;
      get_temporal_parallel_params(scalability_mode_idc, &temporal_parallel_num,
                                   &temporal_parallel_denom);
      const int val = level_stats->max_tile_size * level_spec->max_header_rate *
                      temporal_parallel_denom / temporal_parallel_num;
      if (val > MAX_TILE_SIZE_HEADER_RATE_PRODUCT) {
        fail_id = TILE_SIZE_HEADER_RATE_TOO_HIGH;
        break;
      }
    }
  } while (0);

  return fail_id;
}

static void get_tile_stats(const AV1_COMMON *const cm,
                           const TileDataEnc *const tile_data,
                           int *max_tile_size, int *max_superres_tile_width,
                           int *min_cropped_tile_width,
                           int *min_cropped_tile_height,
                           int *tile_width_valid) {
  const int tile_cols = cm->tiles.cols;
  const int tile_rows = cm->tiles.rows;
  const int superres_scale_denominator = cm->superres_scale_denominator;

  *max_tile_size = 0;
  *max_superres_tile_width = 0;
  *min_cropped_tile_width = INT_MAX;
  *min_cropped_tile_height = INT_MAX;
  *tile_width_valid = 1;

  for (int tile_row = 0; tile_row < tile_rows; ++tile_row) {
    for (int tile_col = 0; tile_col < tile_cols; ++tile_col) {
      const TileInfo *const tile_info =
          &tile_data[tile_row * cm->tiles.cols + tile_col].tile_info;
      const int tile_width =
          (tile_info->mi_col_end - tile_info->mi_col_start) * MI_SIZE;
      const int tile_height =
          (tile_info->mi_row_end - tile_info->mi_row_start) * MI_SIZE;
      const int tile_size = tile_width * tile_height;
      *max_tile_size = AOMMAX(*max_tile_size, tile_size);

      const int supperres_tile_width =
          tile_width * superres_scale_denominator / SCALE_NUMERATOR;
      *max_superres_tile_width =
          AOMMAX(*max_superres_tile_width, supperres_tile_width);

      const int cropped_tile_width =
          cm->width - tile_info->mi_col_start * MI_SIZE;
      const int cropped_tile_height =
          cm->height - tile_info->mi_row_start * MI_SIZE;
      *min_cropped_tile_width =
          AOMMIN(*min_cropped_tile_width, cropped_tile_width);
      *min_cropped_tile_height =
          AOMMIN(*min_cropped_tile_height, cropped_tile_height);

      const int is_right_most_tile =
          tile_info->mi_col_end == cm->mi_params.mi_cols;
      if (!is_right_most_tile) {
        if (av1_superres_scaled(cm))
          *tile_width_valid &= tile_width >= 128;
        else
          *tile_width_valid &= tile_width >= 64;
      }
    }
  }
}

static int store_frame_record(int64_t ts_start, int64_t ts_end,
                              size_t encoded_size, int pic_size,
                              int frame_header_count, int tiles, int show_frame,
                              int show_existing_frame,
                              FrameWindowBuffer *const buffer) {
  if (buffer->num < FRAME_WINDOW_SIZE) {
    ++buffer->num;
  } else {
    buffer->start = (buffer->start + 1) % FRAME_WINDOW_SIZE;
  }
  const int new_idx = (buffer->start + buffer->num - 1) % FRAME_WINDOW_SIZE;
  FrameRecord *const record = &buffer->buf[new_idx];
  record->ts_start = ts_start;
  record->ts_end = ts_end;
  record->encoded_size_in_bytes = encoded_size;
  record->pic_size = pic_size;
  record->frame_header_count = frame_header_count;
  record->tiles = tiles;
  record->show_frame = show_frame;
  record->show_existing_frame = show_existing_frame;

  return new_idx;
}

// Count the number of frames encoded in the last "duration" ticks, in display
// time.
static int count_frames(const FrameWindowBuffer *const buffer,
                        int64_t duration) {
  const int current_idx = (buffer->start + buffer->num - 1) % FRAME_WINDOW_SIZE;
  // Assume current frame is shown frame.
  assert(buffer->buf[current_idx].show_frame);

  const int64_t current_time = buffer->buf[current_idx].ts_end;
  const int64_t time_limit = AOMMAX(current_time - duration, 0);
  int num_frames = 1;
  int index = current_idx - 1;
  for (int i = buffer->num - 2; i >= 0; --i, --index, ++num_frames) {
    if (index < 0) index = FRAME_WINDOW_SIZE - 1;
    const FrameRecord *const record = &buffer->buf[index];
    if (!record->show_frame) continue;
    const int64_t ts_start = record->ts_start;
    if (ts_start < time_limit) break;
  }

  return num_frames;
}

// Scan previously encoded frames and update level metrics accordingly.
static void scan_past_frames(const FrameWindowBuffer *const buffer,
                             int num_frames_to_scan,
                             AV1LevelSpec *const level_spec,
                             AV1LevelStats *const level_stats) {
  const int num_frames_in_buffer = buffer->num;
  int index = (buffer->start + num_frames_in_buffer - 1) % FRAME_WINDOW_SIZE;
  int frame_headers = 0;
  int tiles = 0;
  int64_t display_samples = 0;
  int64_t decoded_samples = 0;
  size_t encoded_size_in_bytes = 0;
  for (int i = 0; i < AOMMIN(num_frames_in_buffer, num_frames_to_scan); ++i) {
    const FrameRecord *const record = &buffer->buf[index];
    if (!record->show_existing_frame) {
      frame_headers += record->frame_header_count;
      decoded_samples += record->pic_size;
    }
    if (record->show_frame) {
      display_samples += record->pic_size;
    }
    tiles += record->tiles;
    encoded_size_in_bytes += record->encoded_size_in_bytes;
    --index;
    if (index < 0) index = FRAME_WINDOW_SIZE - 1;
  }
  level_spec->max_header_rate =
      AOMMAX(level_spec->max_header_rate, frame_headers);
  // TODO(huisu): we can now compute max display rate with the decoder model, so
  // these couple of lines can be removed. Keep them here for a while for
  // debugging purpose.
  level_spec->max_display_rate =
      AOMMAX(level_spec->max_display_rate, display_samples);
  level_spec->max_decode_rate =
      AOMMAX(level_spec->max_decode_rate, decoded_samples);
  level_spec->max_tile_rate = AOMMAX(level_spec->max_tile_rate, tiles);
  level_stats->max_bitrate =
      AOMMAX(level_stats->max_bitrate,
             (int)AOMMIN(encoded_size_in_bytes * 8, (size_t)INT_MAX));
}

void av1_update_level_info(AV1_COMP *cpi, size_t size, int64_t ts_start,
                           int64_t ts_end) {
  AV1_COMMON *const cm = &cpi->common;
  const AV1LevelParams *const level_params = &cpi->ppi->level_params;

  const int upscaled_width = cm->superres_upscaled_width;
  const int width = cm->width;
  const int height = cm->height;
  const int tile_cols = cm->tiles.cols;
  const int tile_rows = cm->tiles.rows;
  const int tiles = tile_cols * tile_rows;
  const int luma_pic_size = upscaled_width * height;
  const int frame_header_count = cpi->frame_header_count;
  const int show_frame = cm->show_frame;
  const int show_existing_frame = cm->show_existing_frame;

  int max_tile_size;
  int min_cropped_tile_width;
  int min_cropped_tile_height;
  int max_superres_tile_width;
  int tile_width_is_valid;
  get_tile_stats(cm, cpi->tile_data, &max_tile_size, &max_superres_tile_width,
                 &min_cropped_tile_width, &min_cropped_tile_height,
                 &tile_width_is_valid);

  const double compression_ratio = av1_get_compression_ratio(cm, size);

  const int temporal_layer_id = cm->temporal_layer_id;
  const int spatial_layer_id = cm->spatial_layer_id;
  const SequenceHeader *const seq_params = cm->seq_params;
  const BITSTREAM_PROFILE profile = seq_params->profile;
  const int is_still_picture = seq_params->still_picture;
  // update level_stats
  // TODO(kyslov@) fix the implementation according to buffer model
  for (int i = 0; i < seq_params->operating_points_cnt_minus_1 + 1; ++i) {
    if (!is_in_operating_point(seq_params->operating_point_idc[i],
                               temporal_layer_id, spatial_layer_id) ||
        !((level_params->keep_level_stats >> i) & 1)) {
      continue;
    }

    AV1LevelInfo *const level_info = level_params->level_info[i];
    assert(level_info != NULL);
    AV1LevelStats *const level_stats = &level_info->level_stats;

    level_stats->max_tile_size =
        AOMMAX(level_stats->max_tile_size, max_tile_size);
    level_stats->max_superres_tile_width =
        AOMMAX(level_stats->max_superres_tile_width, max_superres_tile_width);
    level_stats->min_cropped_tile_width =
        AOMMIN(level_stats->min_cropped_tile_width, min_cropped_tile_width);
    level_stats->min_cropped_tile_height =
        AOMMIN(level_stats->min_cropped_tile_height, min_cropped_tile_height);
    level_stats->tile_width_is_valid &= tile_width_is_valid;
    level_stats->min_frame_width = AOMMIN(level_stats->min_frame_width, width);
    level_stats->min_frame_height =
        AOMMIN(level_stats->min_frame_height, height);
    level_stats->min_cr = AOMMIN(level_stats->min_cr, compression_ratio);
    level_stats->total_compressed_size += (double)size;

    // update level_spec
    // TODO(kyslov@) update all spec fields
    AV1LevelSpec *const level_spec = &level_info->level_spec;
    level_spec->max_picture_size =
        AOMMAX(level_spec->max_picture_size, luma_pic_size);
    level_spec->max_h_size =
        AOMMAX(level_spec->max_h_size, cm->superres_upscaled_width);
    level_spec->max_v_size = AOMMAX(level_spec->max_v_size, height);
    level_spec->max_tile_cols = AOMMAX(level_spec->max_tile_cols, tile_cols);
    level_spec->max_tiles = AOMMAX(level_spec->max_tiles, tiles);

    // Store info. of current frame into FrameWindowBuffer.
    FrameWindowBuffer *const buffer = &level_info->frame_window_buffer;
    store_frame_record(ts_start, ts_end, size, luma_pic_size,
                       frame_header_count, tiles, show_frame,
                       show_existing_frame, buffer);
    if (show_frame) {
      // Count the number of frames encoded in the past 1 second.
      const int encoded_frames_in_last_second =
          show_frame ? count_frames(buffer, TICKS_PER_SEC) : 0;
      scan_past_frames(buffer, encoded_frames_in_last_second, level_spec,
                       level_stats);
      level_stats->total_time_encoded +=
          (cpi->time_stamps.prev_ts_end - cpi->time_stamps.prev_ts_start) /
          (double)TICKS_PER_SEC;
    }

    DECODER_MODEL *const decoder_models = level_info->decoder_models;
    for (AV1_LEVEL level = SEQ_LEVEL_2_0; level < SEQ_LEVELS; ++level) {
      decoder_model_process_frame(cpi, size << 3, &decoder_models[level]);
    }

    // Check whether target level is met.
    const AV1_LEVEL target_level = level_params->target_seq_level_idx[i];
    if (target_level < SEQ_LEVELS && cpi->oxcf.strict_level_conformance) {
      assert(is_valid_seq_level_idx(target_level));
      const int tier = seq_params->tier[i];
      const TARGET_LEVEL_FAIL_ID fail_id = check_level_constraints(
          level_info, target_level, tier, is_still_picture, profile, 0);
      if (fail_id != TARGET_LEVEL_OK) {
        const int target_level_major = 2 + (target_level >> 2);
        const int target_level_minor = target_level & 3;
        aom_internal_error(cm->error, AOM_CODEC_ERROR,
                           "Failed to encode to the target level %d_%d. %s",
                           target_level_major, target_level_minor,
                           level_fail_messages[fail_id]);
      }
    }
  }
}

aom_codec_err_t av1_get_seq_level_idx(const SequenceHeader *seq_params,
                                      const AV1LevelParams *level_params,
                                      int *seq_level_idx) {
  const int is_still_picture = seq_params->still_picture;
  const BITSTREAM_PROFILE profile = seq_params->profile;
  for (int op = 0; op < seq_params->operating_points_cnt_minus_1 + 1; ++op) {
    seq_level_idx[op] = (int)SEQ_LEVEL_MAX;
    if (!((level_params->keep_level_stats >> op) & 1)) continue;
    const int tier = seq_params->tier[op];
    const AV1LevelInfo *const level_info = level_params->level_info[op];
    assert(level_info != NULL);
    for (int level = 0; level < SEQ_LEVELS; ++level) {
      if (!is_valid_seq_level_idx(level)) continue;
      const TARGET_LEVEL_FAIL_ID fail_id = check_level_constraints(
          level_info, level, tier, is_still_picture, profile, 1);
      if (fail_id == TARGET_LEVEL_OK) {
        seq_level_idx[op] = level;
        break;
      }
    }
  }

  return AOM_CODEC_OK;
}

aom_codec_err_t av1_get_target_seq_level_idx(const SequenceHeader *seq_params,
                                             const AV1LevelParams *level_params,
                                             int *target_seq_level_idx) {
  for (int op = 0; op < seq_params->operating_points_cnt_minus_1 + 1; ++op) {
    target_seq_level_idx[op] = (int)SEQ_LEVEL_MAX;
    if (!((level_params->keep_level_stats >> op) & 1)) continue;
    target_seq_level_idx[op] = level_params->target_seq_level_idx[op];
  }

  return AOM_CODEC_OK;
}

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

¤ Dauer der Verarbeitung: 0.40 Sekunden  (vorverarbeitet am  2026-10-11) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723