Пример #1
0
int FMO::getLastMBInSliceGroup (int SliceGroup)
{
  for (int i=img_.PicSizeInMbs-1; i>=0; i--)
    if (getSliceGroupId (i) == SliceGroup)
      return i;
  return -1;

};
Пример #2
0
/*!
 ************************************************************************
 * \brief
 *    FmoGetLastCodedMBOfSlice: Returns the MB-Nr (in scan order) of
 *    the last MB of the slice group
 *
 * \par Input:
 *    SliceGroupID
 * \par Return
 *    MB Nr in case of success (is always >= 0)
 *    -1 if the SliceGroup doesn't exist
 ************************************************************************
 */
int FMO::getLastCodedMBOfSliceGroup (int SliceGroupID)
{
  int i;
  int LastMB = -1;

  for (i=0; i<(int)img_.PicSizeInMbs; i++)
    if (getSliceGroupId (i) == SliceGroupID)
      LastMB = i;
  return LastMB;
}
Пример #3
0
Void FMO::setLastMacroblockInSlice ( int mb)
{
  // called by terminate_slice(), writes the last processed MB into the
  // FirstMBInSlice[MAXnum_slice_groups_minus1] array.  FmoGetFirstMacroblockInSlice()
  // uses this info to identify the first uncoded MB in each slice group

  int currSliceGroup = getSliceGroupId (mb);
  assert (mb >= 0);
  mb = getNextMBNr (mb);   // The next (still uncoded) MB, or -1 if SG is finished
  FirstMBInSlice[currSliceGroup] = mb;
}
Пример #4
0
/*!
 ************************************************************************
 * \brief
 *    FmoGetFirstMBOfSliceGroup: Returns the MB-Nr (in scan order) of the
 *    next first MB of the Slice group, -1 if no such MB exists
 *
 * \par Input:
 *    SliceGroupID: Id of SliceGroup
 ************************************************************************
 */
int FMO::getFirstMBOfSliceGroup (int SliceGroupID)
{
  int i = 0;
  while ((i<(int)img_.PicSizeInMbs) && (getSliceGroupId (i) != SliceGroupID))
    i++;

  if (i < (int)img_.PicSizeInMbs)
    return i;
  else
    return -1;
}
Пример #5
0
/*!
 ************************************************************************
 * \brief
 *    FmoGetNextMBBr: Returns the MB-Nr (in scan order) of the next
 *    MB in the (scattered) Slice, -1 if the slice is finished
 *
 * \param CurrentMbNr
 *    number of the current macroblock
 ************************************************************************
 */
int FMO::getNextMBNr (int CurrentMbNr)
{
  int SliceGroup = getSliceGroupId (CurrentMbNr);

  while (++CurrentMbNr<(int)img_.PicSizeInMbs && MbToSliceGroupMap_ [CurrentMbNr] != SliceGroup)
    ;

  if (CurrentMbNr >= (int)img_.PicSizeInMbs)
    return -1;    // No further MB in this slice (could be end of picture)
  else
    return CurrentMbNr;
}
Пример #6
0
/*!
 ************************************************************************
 * \brief
 *    FmoGetNextMBBr: Returns the MB-Nr (in scan order) of the next
 *    MB in the (FMO) Slice, -1 if the SliceGroup is finished
 *
 * \par Input:
 *    CurrentMbNr
 ************************************************************************
 */
int FMO::getPreviousMBNr (int CurrentMbNr)
{

  int  SliceGroupID = getSliceGroupId (CurrentMbNr);
  CurrentMbNr--;
  while (CurrentMbNr>=0 &&  MbToSliceGroupMap_[CurrentMbNr] != SliceGroupID)
    CurrentMbNr--;

  if (CurrentMbNr < 0)
    return -1;    // No previous MB in this slice
  else
    return CurrentMbNr;
}
Пример #7
0
Void FMO::calcMbNumInSliceGroup()
{
  if( numMbInSliceGroup_ != NULL)
    delete[] numMbInSliceGroup_;

  numMbInSliceGroup_ = new int[NumberOfSliceGroups_];

  int i;
  for( i=0; i<NumberOfSliceGroups_; i++)
    numMbInSliceGroup_[i] = 0;

  for( i=0; i<(Int)PicSizeInMapUnits_; i++)
    numMbInSliceGroup_[getSliceGroupId(i)]++;
}
Пример #8
0
ErrVal
PictureParameterSet::write( HeaderSymbolWriteIf* pcWriteIf ) const
{
  //===== NAL unit header =====
  ETRACE_DECLARE( Bool m_bTraceEnable = true );
  ETRACE_LAYER  ( 0 );
  ETRACE_HEADER ( "PICTURE PARAMETER SET" );
  RNOK  ( pcWriteIf->writeFlag( 0,                                        "NAL unit header: forbidden_zero_bit" ) );
  RNOK  ( pcWriteIf->writeCode( 3, 2,                                     "NAL unit header: nal_ref_idc" ) );
  RNOK  ( pcWriteIf->writeCode( m_eNalUnitType, 5,                        "NAL unit header: nal_unit_type" ) );

  //===== NAL unit payload =====
  RNOK( pcWriteIf->writeUvlc( getPicParameterSetId(),                     "PPS: pic_parameter_set_id" ) );
  RNOK( pcWriteIf->writeUvlc( getSeqParameterSetId(),                     "PPS: seq_parameter_set_id" ) );
  RNOK( pcWriteIf->writeFlag( getEntropyCodingModeFlag(),                 "PPS: entropy_coding_mode_flag" ) );
  RNOK( pcWriteIf->writeFlag( getPicOrderPresentFlag(),                   "PPS: pic_order_present_flag" ) );

  //--ICU/ETRI FMO Implementation : FMO stuff start
  Int iNumberBitsPerSliceGroupId;
  RNOK( pcWriteIf->writeUvlc( getNumSliceGroupsMinus1(),                         "PPS: num_slice_groups_minus1" ) );

  if(getNumSliceGroupsMinus1() > 0)
  {
    RNOK( pcWriteIf->writeUvlc( getSliceGroupMapType(),                             "PPS: slice_group_map_type" ) );
    if(getSliceGroupMapType() ==0)
    {
      for(UInt iSliceGroup=0;iSliceGroup<=getNumSliceGroupsMinus1();iSliceGroup++)
      {
        RNOK( pcWriteIf->writeUvlc( getRunLengthMinus1(iSliceGroup),                             "PPS: run_length_minus1 [iSliceGroup]" ) );
      }
    }
    else if (getSliceGroupMapType() ==2)
    {
      for(UInt iSliceGroup=0;iSliceGroup<getNumSliceGroupsMinus1();iSliceGroup++)
      {
        RNOK( pcWriteIf->writeUvlc( getTopLeft(iSliceGroup),                             "PPS: top_left [iSliceGroup]" ) );
        RNOK( pcWriteIf->writeUvlc( getBottomRight(iSliceGroup),                             "PPS: bottom_right [iSliceGroup]" ) );
      }
    }
    else if(getSliceGroupMapType() ==3 ||
      getSliceGroupMapType() ==4 ||
      getSliceGroupMapType() ==5)
    {
      RNOK( pcWriteIf->writeFlag( getSliceGroupChangeDirection_flag(),                      "PPS: slice_group_change_direction_flag" ) );
      RNOK( pcWriteIf->writeUvlc( getSliceGroupChangeRateMinus1(),                             "PPS: slice_group_change_rate_minus1" ) );
    }
    else if (getSliceGroupMapType() ==6)
    {
      if (getNumSliceGroupsMinus1()+1 >4)
        iNumberBitsPerSliceGroupId = 3;
      else if (getNumSliceGroupsMinus1()+1 > 2)
        iNumberBitsPerSliceGroupId = 2;
      else
        iNumberBitsPerSliceGroupId = 1;
      //! JVT-F078, exlicitly signal number of MBs in the map
      RNOK( pcWriteIf->writeUvlc( getNumSliceGroupMapUnitsMinus1(),                             "PPS: num_slice_group_map_units_minus1" ) );
      ROF ( getNumSliceGroupMapUnitsMinus1() < m_uiSliceGroupIdArraySize );
      for (UInt iSliceGroup=0; iSliceGroup<=getNumSliceGroupMapUnitsMinus1(); iSliceGroup++)
        RNOK( pcWriteIf->writeCode( getSliceGroupId(iSliceGroup), iNumberBitsPerSliceGroupId ,                                    "PPS: slice_group_id[iSliceGroup]" ) );
    }

  }
  //--ICU/ETRI FMO Implementation : FMO stuff end

  RNOK( pcWriteIf->writeUvlc( getNumRefIdxActive(LIST_0)-1,               "PPS: num_ref_idx_l0_active_minus1" ) );
  RNOK( pcWriteIf->writeUvlc( getNumRefIdxActive(LIST_1)-1,               "PPS: num_ref_idx_l1_active_minus1" ) );
  RNOK( pcWriteIf->writeFlag( m_bWeightedPredFlag,                        "PPS: weighted_pred_flag" ) );
  RNOK( pcWriteIf->writeCode( m_uiWeightedBiPredIdc, 2,                   "PPS: weighted_bipred_idc" ) );
  RNOK( pcWriteIf->writeSvlc( (Int)getPicInitQp() - 26,                   "PPS: pic_init_qp_minus26" ) );
  RNOK( pcWriteIf->writeSvlc( 0,                                          "PPS: pic_init_qs_minus26" ) );
  RNOK( pcWriteIf->writeSvlc( getChromaQpIndexOffset(),                   "PPS: chroma_qp_index_offset" ) );
  RNOK( pcWriteIf->writeFlag( getDeblockingFilterParametersPresentFlag(), "PPS: deblocking_filter_control_present_flag" ) ); //VB-JV 04/08
  RNOK( pcWriteIf->writeFlag( getConstrainedIntraPredFlag(),              "PPS: constrained_intra_pred_flag" ) );
  RNOK( pcWriteIf->writeFlag( getRedundantPicCntPresentFlag(),            "PPS: redundant_pic_cnt_present_flag" ) );  // JVT-Q054 Red. Picture

  if( getTransform8x8ModeFlag() || m_bPicScalingMatrixPresentFlag || m_iSecondChromaQpIndexOffset != m_iChromaQpIndexOffset )
  {
    RNOK( xWriteFrext( pcWriteIf ) );
  }

  return Err::m_nOK;
}