modules/video_coding/qm_select.cc
int VCMQmResolution::SelectResolution(VCMResolutionScale** qm) {
  if (!init_) {
    return VCM_UNINITIALIZED;
  }
  if (content_metrics_ == NULL) {
    Reset();
    *qm = qm_;
    return VCM_OK;
  }

  // Check conditions on down-sampling state.
  assert(state_dec_factor_spatial_ >= 1.0f);
  assert(state_dec_factor_temporal_ >= 1.0f);
  assert(state_dec_factor_spatial_ <= kMaxSpatialDown);
  assert(state_dec_factor_temporal_ <= kMaxTempDown);
  assert(state_dec_factor_temporal_ * state_dec_factor_spatial_ <=
         kMaxTotalDown);

  // Compute content class for selection.
  content_class_ = ComputeContentClass();
  // Compute various rate quantities for selection.
  ComputeRatesForSelection();

  // Get the encoder state.
  ComputeEncoderState();

  // Default settings: no action.
  SetDefaultAction();
  *qm = qm_;

  // Check for going back up in resolution, if we have had some down-sampling
  // relative to native state in Initialize().
  if (down_action_history_[0].spatial != kNoChangeSpatial ||
      down_action_history_[0].temporal != kNoChangeTemporal) {
    if (GoingUpResolution()) {
      *qm = qm_;
      return VCM_OK;
    }
  }

  // Check for going down in resolution.
  if (GoingDownResolution()) {
    *qm = qm_;
    return VCM_OK;
  }
  return VCM_OK;
}
// In the current version the following constraints are imposed:
// 1) We only allow for one action, either down or up, at a given time.
// 2) The possible down-sampling actions are: spatial by 1/2x1/2, 3/4x3/4;
//    temporal/frame rate reduction by 1/2 and 2/3.
// 3) The action for going back up is the reverse of last (spatial or temporal)
//    down-sampling action. The list of down-sampling actions from the
//    Initialize() state are kept in |down_action_history_|.
// 4) The total amount of down-sampling (spatial and/or temporal) from the
//    Initialize() state (native resolution) is limited by various factors.
In the current version the following constraints are imposed:
1) We only allow for one action, either down or up, at a given time.
In the current version the following constraints are imposed : 1 ) We only allow for one action either down or up at a given time .
int VCMQmResolution::SelectResolution(VCMResolutionScale** qm) {
  if (!init_) {
    return VCM_UNINITIALIZED;
  }
  if (content_metrics_ == NULL) {
    Reset();
    *qm = qm_;
    return VCM_OK;
  }
  assert(state_dec_factor_spatial_ >= 1.0f);
  assert(state_dec_factor_temporal_ >= 1.0f);
  assert(state_dec_factor_spatial_ <= kMaxSpatialDown);
  assert(state_dec_factor_temporal_ <= kMaxTempDown);
  assert(state_dec_factor_temporal_ * state_dec_factor_spatial_ <=
         kMaxTotalDown);
  content_class_ = ComputeContentClass();
  ComputeRatesForSelection();
  ComputeEncoderState();
  SetDefaultAction();
  *qm = qm_;
  if (down_action_history_[0].spatial != kNoChangeSpatial ||
      down_action_history_[0].temporal != kNoChangeTemporal) {
    if (GoingUpResolution()) {
      *qm = qm_;
      return VCM_OK;
    }
  }
  if (GoingDownResolution()) {
    *qm = qm_;
    return VCM_OK;
  }
  return VCM_OK;
}
int VCMQmResolution :: SelectResolution ( VCMResolutionScale * * qm ) { if ( ! init_ ) { return VCM_UNINITIALIZED ; } if ( content_metrics_ == NULL ) { Reset ( ) ; * qm = qm_ ; return VCM_OK ; } assert ( state_dec_factor_spatial_ >= 1.0f ) ; assert ( state_dec_factor_temporal_ >= 1.0f ) ; assert ( state_dec_factor_spatial_ <= kMaxSpatialDown ) ; assert ( state_dec_factor_temporal_ <= kMaxTempDown ) ; assert ( state_dec_factor_temporal_ * state_dec_factor_spatial_ <= kMaxTotalDown ) ; content_class_ = ComputeContentClass ( ) ; ComputeRatesForSelection ( ) ; ComputeEncoderState ( ) ; SetDefaultAction ( ) ; * qm = qm_ ; if ( down_action_history_ [ 0 ] . spatial != kNoChangeSpatial || down_action_history_ [ 0 ] . temporal != kNoChangeTemporal ) { if ( GoingUpResolution ( ) ) { * qm = qm_ ; return VCM_OK ; } } if ( GoingDownResolution ( ) ) { * qm = qm_ ; return VCM_OK ; } return VCM_OK ; }
In the current version the following constraints are imposed:
1) We only allow for one action, either down or up, at a given time.
In the current version the following constraints are imposed : 1 ) We only allow for one action either down or up at a given time .
// Check conditions on down-sampling state. // Compute content class for selection. // Compute various rate quantities for selection. // Get the encoder state. // Default settings: no action. // Check for going back up in resolution, if we have had some down-sampling // relative to native state in Initialize(). // Check for going down in resolution.