vp9/simple_encode.cc
// After finishing coding a frame, this function will update the coded frame
// into the ref_frame_info based on the frame_type and the coding_index.
After finishing coding a frame, this function will update the coded frame
into the ref_frame_info based on the frame_type and the coding_index.
After finishing coding a frame this function will update the coded frame into the ref_frame_info based on the frame_type and the coding_index .
static void PostUpdateRefFrameInfo(FrameType frame_type, int frame_coding_index,
                                   RefFrameInfo *ref_frame_info) {
  int *ref_frame_coding_indexes = ref_frame_info->coding_indexes;
  switch (frame_type) {
    case kFrameTypeKey:
      ref_frame_coding_indexes[kRefFrameTypeLast] = frame_coding_index;
      ref_frame_coding_indexes[kRefFrameTypePast] = frame_coding_index;
      ref_frame_coding_indexes[kRefFrameTypeFuture] = frame_coding_index;
      break;
    case kFrameTypeInter:
      ref_frame_coding_indexes[kRefFrameTypeLast] = frame_coding_index;
      break;
    case kFrameTypeAltRef:
      ref_frame_coding_indexes[kRefFrameTypeFuture] = frame_coding_index;
      break;
    case kFrameTypeOverlay:
      ref_frame_coding_indexes[kRefFrameTypeFuture] =
          ref_frame_coding_indexes[kRefFrameTypePast];
      ref_frame_coding_indexes[kRefFrameTypePast] = frame_coding_index;
      break;
    case kFrameTypeGolden:
      ref_frame_coding_indexes[kRefFrameTypePast] = frame_coding_index;
      ref_frame_coding_indexes[kRefFrameTypeLast] = frame_coding_index;
      break;
  }
  const int last_index = ref_frame_coding_indexes[kRefFrameTypeLast];
  const int past_index = ref_frame_coding_indexes[kRefFrameTypePast];
  const int future_index = ref_frame_coding_indexes[kRefFrameTypeFuture];
  int *ref_frame_valid_list = ref_frame_info->valid_list;
  for (int ref_frame_idx = 0; ref_frame_idx < kRefFrameTypeMax;
       ++ref_frame_idx) {
    ref_frame_valid_list[ref_frame_idx] = 1;
  }
  if (past_index == last_index) {
    ref_frame_valid_list[kRefFrameTypePast] = 0;
  }
  if (future_index == last_index) {
    ref_frame_valid_list[kRefFrameTypeFuture] = 0;
  }
  if (future_index == past_index) {
    ref_frame_valid_list[kRefFrameTypeFuture] = 0;
  }
}
static void PostUpdateRefFrameInfo ( FrameType frame_type , int frame_coding_index , RefFrameInfo * ref_frame_info ) { int * ref_frame_coding_indexes = ref_frame_info -> coding_indexes ; switch ( frame_type ) { case kFrameTypeKey : ref_frame_coding_indexes [ kRefFrameTypeLast ] = frame_coding_index ; ref_frame_coding_indexes [ kRefFrameTypePast ] = frame_coding_index ; ref_frame_coding_indexes [ kRefFrameTypeFuture ] = frame_coding_index ; break ; case kFrameTypeInter : ref_frame_coding_indexes [ kRefFrameTypeLast ] = frame_coding_index ; break ; case kFrameTypeAltRef : ref_frame_coding_indexes [ kRefFrameTypeFuture ] = frame_coding_index ; break ; case kFrameTypeOverlay : ref_frame_coding_indexes [ kRefFrameTypeFuture ] = ref_frame_coding_indexes [ kRefFrameTypePast ] ; ref_frame_coding_indexes [ kRefFrameTypePast ] = frame_coding_index ; break ; case kFrameTypeGolden : ref_frame_coding_indexes [ kRefFrameTypePast ] = frame_coding_index ; ref_frame_coding_indexes [ kRefFrameTypeLast ] = frame_coding_index ; break ; } const int last_index = ref_frame_coding_indexes [ kRefFrameTypeLast ] ; const int past_index = ref_frame_coding_indexes [ kRefFrameTypePast ] ; const int future_index = ref_frame_coding_indexes [ kRefFrameTypeFuture ] ; int * ref_frame_valid_list = ref_frame_info -> valid_list ; for ( int ref_frame_idx = 0 ; ref_frame_idx < kRefFrameTypeMax ; ++ ref_frame_idx ) { ref_frame_valid_list [ ref_frame_idx ] = 1 ; } if ( past_index == last_index ) { ref_frame_valid_list [ kRefFrameTypePast ] = 0 ; } if ( future_index == last_index ) { ref_frame_valid_list [ kRefFrameTypeFuture ] = 0 ; } if ( future_index == past_index ) { ref_frame_valid_list [ kRefFrameTypeFuture ] = 0 ; } }
After finishing coding a frame, this function will update the coded frame
into the ref_frame_info based on the frame_type and the coding_index.
After finishing coding a frame this function will update the coded frame into the ref_frame_info based on the frame_type and the coding_index .
// This part is written based on the logics in vp9_configure_buffer_updates() // and update_ref_frames() // Reserve the past coding_index in the future slot. This logic is from // update_ref_frames() with condition vp9_preserve_existing_gf() == 1 // TODO(angiebird): Invetegate why we need this. //  This part is written based on the logics in get_ref_frame_flags() but we //  rename the flags alt, golden to future, past respectively. Mark //  non-duplicated reference frames as valid. The priorities are //  kRefFrameTypeLast > kRefFrameTypePast > kRefFrameTypeFuture.