av1/encoder/encode_strategy.c
// Check if we should encode an ARF or internal ARF.  If not, try a LAST
// Do some setup associated with the chosen source
// temporal_filtered, flush, and frame_update_type are outputs.
// Return the frame source, or NULL if we couldn't find one
Check if we should encode an ARF or internal ARF.  If not, try a LAST
Do some setup associated with the chosen source
temporal_filtered, flush, and frame_update_type are outputs.
Return the frame source, or NULL if we couldn't find one
Check if we should encode an ARF or internal ARF . If not try a LAST Do some setup associated with the chosen source temporal_filtered flush and frame_update_type are outputs . Return the frame source or NULL if we couldn ' t find one
static struct lookahead_entry *choose_frame_source(
    AV1_COMP *const cpi, int *const code_arf, int *const flush,
    struct lookahead_entry **last_source, EncodeFrameParams *const frame_params,
    int *show_existing_alt_ref) {
  AV1_COMMON *const cm = &cpi->common;
  struct lookahead_entry *source = NULL;
  *code_arf = 0;
  int arf_src_index = get_arf_src_index(&cpi->gf_group, cpi->oxcf.pass);
  if (arf_src_index &&
      (is_forced_keyframe_pending(cpi->lookahead, arf_src_index,
                                  cpi->compressor_stage) != -1) &&
      cpi->oxcf.rc_mode != AOM_Q) {
    arf_src_index = 0;
    *flush = 1;
  }
  if (arf_src_index)
    source = setup_arf_frame(cpi, arf_src_index, code_arf, frame_params,
                             show_existing_alt_ref);
  if (!source) {
    if (cm->current_frame.frame_number > 0) {
      *last_source =
          av1_lookahead_peek(cpi->lookahead, -1, cpi->compressor_stage);
    }
    source = av1_lookahead_pop(cpi->lookahead, *flush, cpi->compressor_stage);
    if (source == NULL) return NULL;
    frame_params->show_frame = 1;
    if (cpi->alt_ref_source == source) cpi->alt_ref_source = NULL;
  }
  return source;
}
static struct lookahead_entry * choose_frame_source ( AV1_COMP * const cpi , int * const code_arf , int * const flush , struct lookahead_entry * * last_source , EncodeFrameParams * const frame_params , int * show_existing_alt_ref ) { AV1_COMMON * const cm = & cpi -> common ; struct lookahead_entry * source = NULL ; * code_arf = 0 ; int arf_src_index = get_arf_src_index ( & cpi -> gf_group , cpi -> oxcf . pass ) ; if ( arf_src_index && ( is_forced_keyframe_pending ( cpi -> lookahead , arf_src_index , cpi -> compressor_stage ) != -1 ) && cpi -> oxcf . rc_mode != AOM_Q ) { arf_src_index = 0 ; * flush = 1 ; } if ( arf_src_index ) source = setup_arf_frame ( cpi , arf_src_index , code_arf , frame_params , show_existing_alt_ref ) ; if ( ! source ) { if ( cm -> current_frame . frame_number > 0 ) { * last_source = av1_lookahead_peek ( cpi -> lookahead , -1 , cpi -> compressor_stage ) ; } source = av1_lookahead_pop ( cpi -> lookahead , * flush , cpi -> compressor_stage ) ; if ( source == NULL ) return NULL ; frame_params -> show_frame = 1 ; if ( cpi -> alt_ref_source == source ) cpi -> alt_ref_source = NULL ; } return source ; }
Check if we should encode an ARF or internal ARF.
Check if we should encode an ARF or internal ARF .
// Should we encode an alt-ref frame. // TODO(Aasaipriya): Forced key frames need to be fixed when rc_mode != AOM_Q // Get last frame source. // Read in the source frame. // Check to see if the frame should be encoded as an arf overlay.