コード例 #1
0
ファイル: util.cpp プロジェクト: gh2o/FRCIR2012
vector<cv::Point2f> roundedRectToPoints (cv::RotatedRect rr)
{
    typedef cv::Point2f P;

    vector<P> ret;
    float px = rr.center.x;
    float py = rr.center.y;
    float ox = rr.size.width / 2;
    float oy = rr.size.height / 2;

    double rads = rr.angle * M_PI / 180;
    double vsin = sin (rads);
    double vcos = cos (rads);

#define ROT(sx,sy) (P ( \
		px + (sx) * ox * vcos - (sy) * oy * vsin, \
		py + (sy) * oy * vcos + (sx) * ox * vsin  \
	))
    ret.push_back (ROT (-1, -1));
    ret.push_back (ROT (+1, -1));
    ret.push_back (ROT (+1, +1));
    ret.push_back (ROT (-1, +1));
#undef ROT

    return ret;
}
コード例 #2
0
ファイル: NalUnitParser.cpp プロジェクト: dewn49/thialgou
ErrVal
NalUnitParser::destroy()
{
  ROT( m_bInitialized );
  ROT( m_bNalUnitInitialized );
  delete this;
  return Err::m_nOK;
}
コード例 #3
0
Int H264AVCEncoderTest::padBuf(UChar *output, Int iStrideOut, Int width, Int height, Int width_out, Int height_out, Int fillMode)
{
  int j;
  UChar *pDst;
  enum FillMode
  {
    FILL_CLEAR = 0,
    FILL_FRAME,
    FILL_FIELD
  };
  //horizontal;
  if(width < width_out)
  {
    pDst = output;
    for(j=0; j<height; j++)
    {
      memset(pDst+width, 0, (width_out-width)*sizeof(UChar));
      pDst += iStrideOut;
    }
  }
  if(height < height_out)
  {
    if(FILL_CLEAR == fillMode)
    {
      pDst = output +height*iStrideOut;
      for(j=height; j<height_out; j++)
      {
        memset(pDst, 0, width_out*sizeof(UChar));
        pDst += iStrideOut;
      }
    }
    else if(FILL_FRAME == fillMode )
    {
      pDst = output +height*iStrideOut;
      for(j=height; j<height_out; j++)
      {
        memcpy(pDst, pDst-iStrideOut, iStrideOut*sizeof(UChar));
        pDst += iStrideOut;
      }
    }
    else if(FILL_FIELD == fillMode)
    {
      ROT( (height_out - height) & 1 );
      pDst = output +height*iStrideOut;
      for(j=height; j<height_out; j+=2)
      {
        memcpy(pDst, pDst-2*iStrideOut, 2*iStrideOut*sizeof(UChar));
        pDst += iStrideOut*2;
      }
    }
    else
      ROT(!"Not supported yet!\n");
  }

  return Err::m_nOK;
}
コード例 #4
0
uint32_t rand_prng_get(prng_t* p_prng)
{
    /* Bob Jenkins' small PRNG
        http://burtleburtle.net/bob/rand/smallprng.html */
    uint32_t e = p_prng->a - ROT(p_prng->b, 27);
    p_prng->a = p_prng->b ^ ROT(p_prng->c, 17);
    p_prng->b = p_prng->c + p_prng->d;
    p_prng->c = p_prng->d + e;
    p_prng->d = e + p_prng->a;
    return p_prng->d;
}
コード例 #5
0
ファイル: MbDataCtrl.cpp プロジェクト: Moutarde/3DWebcam
ErrVal
ControlData::initFGSData( UInt uiNumMb )
{
  ROT( m_pacFGSMbQP );
  ROT( m_pauiFGSMbCbp );
  ROT( m_pabFGS8x8Trafo );
  ROFS( ( m_pacFGSMbQP      = new UChar [uiNumMb] ) );
  ROFS( ( m_pauiFGSMbCbp    = new UInt  [uiNumMb] ) );
  ROFS( ( m_pabFGS8x8Trafo  = new Bool  [uiNumMb] ) );
  return Err::m_nOK;
}
コード例 #6
0
ファイル: MbDataCtrl.cpp プロジェクト: Moutarde/3DWebcam
ErrVal
MbDataCtrl::initFgsBQData( UInt uiNumMb )
{
  ROT( m_pacFgsBQMbQP );
  ROT( m_pauiFgsBQMbCbp );
  ROT( m_pauiFgsBQBCBP );
  ROT( m_pabFgsBQ8x8Trafo );
  ROFS( ( m_pacFgsBQMbQP      = new UChar [uiNumMb] ) );
  ROFS( ( m_pauiFgsBQMbCbp    = new UInt  [uiNumMb] ) );
  ROFS( ( m_pauiFgsBQBCBP     = new UInt  [uiNumMb] ) );
  ROFS( ( m_pabFgsBQ8x8Trafo  = new Bool  [uiNumMb] ) );
  return Err::m_nOK;
}
コード例 #7
0
ファイル: NalUnitParser.cpp プロジェクト: dewn49/thialgou
ErrVal
NalUnitParser::init( BitReadBuffer*       pcBitReadBuffer,
                     HeaderSymbolReadIf*  pcHeaderSymbolReadIf )
{
  ROT( m_bInitialized );
  ROT( m_bNalUnitInitialized );
  ROF( pcBitReadBuffer );
  ROF( pcHeaderSymbolReadIf );
  m_bInitialized          = true;
  m_bNalUnitInitialized   = false;
  m_pcBitReadBuffer       = pcBitReadBuffer;
  m_pcHeaderSymbolReadIf  = pcHeaderSymbolReadIf;
  return Err::m_nOK;
}
コード例 #8
0
ファイル: MbDataCtrl.cpp プロジェクト: Moutarde/3DWebcam
ErrVal MbDataCtrl::xCreateData( UInt uiSize )
{
  uiSize++;

  ROT( NULL == ( m_pcMbTCoeffs         = new MbTransformCoeffs [ uiSize ] ) );
  ROT( NULL == ( m_apcMbMotionData[0]  = new MbMotionData      [ uiSize ] ) );
  ROT( NULL == ( m_apcMbMotionData[1]  = new MbMotionData      [ uiSize ] ) );
  ROT( NULL == ( m_apcMbMotionDataBase[0]  = new MbMotionData      [ uiSize ] ) );
  ROT( NULL == ( m_apcMbMotionDataBase[1]  = new MbMotionData      [ uiSize ] ) );
  ROT( NULL == ( m_apcMbMvdData[0]     = new MbMvData          [ uiSize ] ) );
  ROT( NULL == ( m_apcMbMvdData[1]     = new MbMvData          [ uiSize ] ) );
  ROT( NULL == ( m_pcMbData            = new MbData            [ uiSize ] ) );


  for( UInt uiIdx = 0; uiIdx < uiSize; uiIdx++ )
  {
    m_pcMbData[ uiIdx ].init( m_pcMbTCoeffs        + uiIdx,
                              m_apcMbMvdData   [0] + uiIdx,
                              m_apcMbMvdData   [1] + uiIdx,
                              m_apcMbMotionData[0] + uiIdx,
                              m_apcMbMotionData[1] + uiIdx,
                              m_apcMbMotionDataBase[0] + uiIdx,
                              m_apcMbMotionDataBase[1] + uiIdx );
  }

  // clear outside mb data
  m_pcMbData[uiSize-1].getMbTCoeffs().setAllCoeffCount( 0 );
  m_pcMbData[uiSize-1].initMbData( 0, MSYS_UINT_MAX );

  return Err::m_nOK;
}
コード例 #9
0
static void splice(edge_ref a, edge_ref b)
{
    edge_ref ta, tb;
    edge_ref alpha = ROT(ONEXT(a));
    edge_ref beta = ROT(ONEXT(b));

    ta = ONEXT(a);
    tb = ONEXT(b);
    ONEXT(a) = tb;
    ONEXT(b) = ta;
    ta = ONEXT(alpha);
    tb = ONEXT(beta);
    ONEXT(alpha) = tb;
    ONEXT(beta) = ta;
}
コード例 #10
0
ファイル: MbDataCtrl.cpp プロジェクト: Moutarde/3DWebcam
ErrVal
ControlData::initBQData( UInt uiNumMb )
{
  ROT( m_pacBQMbQP );
  ROT( m_pauiBQMbCbp );
  ROT( m_pabBQ8x8Trafo );
  ROFS( ( m_pacBQMbQP      = new UChar [uiNumMb] ) );
  ROFS( ( m_pauiBQMbCbp    = new UInt  [uiNumMb] ) );
  ROFS( ( m_pabBQ8x8Trafo  = new Bool  [uiNumMb] ) );
  ROFS( ( m_paeBQMbMode    = new MbMode[uiNumMb] ) );
  ROFS( ( m_pusBQFwdBwd    = new UShort[uiNumMb] ) );
  ROFS( ( m_paacBQMotionData[0] = new MbMotionData[uiNumMb] ) );
  ROFS( ( m_paacBQMotionData[1] = new MbMotionData[uiNumMb] ) );
  return Err::m_nOK;
}
コード例 #11
0
ErrVal MotionEstimationCost::xInitRateDistortionModel( Int iSubPelSearchLimit, RateDistortionIf* pcRateDistortionIf )
{
  ROT( NULL == pcRateDistortionIf )
  m_pcRateDistortionIf = pcRateDistortionIf;

  // make it larger
  iSubPelSearchLimit += 4;
  iSubPelSearchLimit *= 8;

  if( m_iSearchLimit != iSubPelSearchLimit )
  {
    RNOK( xUninit() )

    m_iSearchLimit = iSubPelSearchLimit;

    m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ];
    iSubPelSearchLimit *= 2;

    m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit;

    for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++)
    {
      m_puiComponentCost[n] = getComponentBits( n );
    }
  }

  return Err::m_nOK;
}
コード例 #12
0
ファイル: NalUnitParser.cpp プロジェクト: dewn49/thialgou
ErrVal
NalUnitParser::create( NalUnitParser*& rpcNalUnitParser )
{
  rpcNalUnitParser = new NalUnitParser;
  ROT( NULL == rpcNalUnitParser );
  return Err::m_nOK;
}
コード例 #13
0
ファイル: MbDataCtrl.cpp プロジェクト: Moutarde/3DWebcam
ErrVal MbDataCtrl::init( const SequenceParameterSet& rcSPS )
{
  AOT_DBG( m_bInitDone );

  UInt uiSize = rcSPS.getMbInFrame();

  ROT( 0 == uiSize );
  if( m_uiSize == uiSize )
  {
    RNOK( xResetData() );
  }
  else
  {
    RNOK( xDeleteData() );
    RNOK( xCreateData( uiSize ) );
    m_uiSize = uiSize;
  }

  m_iMbPerLine = rcSPS.getFrameWidthInMbs();

  RNOK( m_cpDFPBuffer.init( uiSize+1 ) );
  m_cpDFPBuffer.clear();

  m_bInitDone     = true;

  return Err::m_nOK;
}
コード例 #14
0
ファイル: BitReadBuffer.cpp プロジェクト: hwyhit/JSVM
ErrVal
BitReadBuffer::initPacket( UInt*   puiBits,
                           UInt    uiBitsInPacket )
{
    // invalidate all members if something is wrong
    m_pulStreamPacket    = NULL;
    m_ulCurrentBits      = 0xdeaddead;
    m_uiNextBits         = 0xdeaddead;
    m_uiBitsLeft         = 0;
    m_iValidBits         = 0;
    m_uiDWordsLeft     = 0;

    ROT( NULL == puiBits );

    // now init the Bitstream object
    m_pulStreamPacket  = puiBits;

    m_uiBitsLeft = uiBitsInPacket;

    m_uiDWordsLeft = m_uiBitsLeft >> 5;
    m_iValidBits     = -32;

    // preload first two dwords if valid
    xReadNextWord();
    xReadNextWord();

    return Err::m_nOK;
}
コード例 #15
0
ErrVal
QualityLevelParameter::create( QualityLevelParameter*& rpcQualityLevelParameter )
{
  rpcQualityLevelParameter = new QualityLevelParameter;
  ROT( NULL == rpcQualityLevelParameter );
  return Err::m_nOK;
}
コード例 #16
0
ファイル: MotionData.cpp プロジェクト: redheru/CodeChunk
//-----------------------------------------------------------------------------
// 説明: 関節回転量の設定(クォータニオン)
// 引数: 
//       frm [in] フレーム番号
//       jid [in] 関節インデクス
//       q [in] 回転クォータニオン
// 返り値:
//       true 設定成功
//       false 設定失敗
// その他: 
//-----------------------------------------------------------------------------
bool CMotionData::SetRotation(size_t frm, size_t jid, const Quaternionf &q)
{
	if (!IsRange(frm, jid))
		return false;
	ROT(frm, jid) = q;
	return true;
}
コード例 #17
0
ファイル: ReconstructionBypass.cpp プロジェクト: Aldream/jsvm
ErrVal
ReconstructionBypass::xPad8x8Blk_MbAff( YuvMbBufferExtension* pcBuffer, UInt ui8x8Blk, Bool bV0, Bool bV1, Bool bH, Bool bC0, Bool bC1 )
{
  Bool    bSwitch     = ( !bV0 && bV1 && bH ) || ( !bV0 && !bH && !bC0 && ( bV1 || bC1 ) );
  Bool    bDouble     = ( bV0 && bV1 ) || ( ( bV0 || bC0 ) && !bH && ( bV1 || bC1 ) );
  ROT( bSwitch && bDouble );
  Bool    bFromAbove  = ( ui8x8Blk < 2 );
  Bool    bFromLeft   = ( ui8x8Blk % 2 == 0 );
  B8x8Idx cIdx( (Par8x8)ui8x8Blk );

  if( bDouble )
  {
    RNOK( xPadBlock_MbAff( pcBuffer, cIdx, bV0, bH, bC0, true,   bFromAbove, bFromLeft ) );
    RNOK( xPadBlock_MbAff( pcBuffer, cIdx, bV1, bH, bC1, true,  !bFromAbove, bFromLeft ) );
  }
  else if( bSwitch )
  {
    RNOK( xPadBlock_MbAff( pcBuffer, cIdx, bV1, bH, bC1, false, !bFromAbove, bFromLeft ) );
  }
  else
  {
    RNOK( xPadBlock_MbAff( pcBuffer, cIdx, bV0, bH, bC0, false,  bFromAbove, bFromLeft ) );
  }

  return Err::m_nOK;
}
コード例 #18
0
ファイル: PreProcessorParameter.cpp プロジェクト: hwyhit/JSVM
ErrVal
PreProcessorParameter::create( PreProcessorParameter*& rpcPreProcessorParameter )
{
  rpcPreProcessorParameter = new PreProcessorParameter;
  ROT( NULL == rpcPreProcessorParameter );
  return Err::m_nOK;
}
コード例 #19
0
ErrVal ControlMngH264AVCDecoder::create( ControlMngH264AVCDecoder*& rpcControlMngH264AVCDecoder )
{
  rpcControlMngH264AVCDecoder = new ControlMngH264AVCDecoder;

  ROT( NULL == rpcControlMngH264AVCDecoder );
  return Err::m_nOK;
}
コード例 #20
0
ファイル: ReadYuvFile.cpp プロジェクト: janieltec/JMVC-Test
ErrVal ReadYuvFile::readFrame( UChar *pLum,
                               UChar *pCb,
                               UChar *pCr,
                               UInt uiBufHeight,
                               UInt uiBufWidth,
                               UInt uiBufStride)
{
 //printf("Llegirem els tres plans de l'arxiu %s\n",m_cFileName);
  ROT( uiBufHeight < m_uiLumPicHeight || uiBufWidth < m_uiLumPicWidth );
  
  UInt uiPicHeight = m_uiLumPicHeight;
  UInt uiPicWidth  = m_uiLumPicWidth;
  UInt uiClearSize = uiBufWidth - uiPicWidth;
  UInt uiStartLine = m_uiStartLine;
  UInt uiEndLine   = m_uiEndLine;

  RNOKS( xReadPlane( pLum, uiBufHeight, uiBufWidth, uiBufStride, uiPicHeight, uiPicWidth, uiStartLine, uiEndLine ) );

  uiPicHeight  >>= 1;
  uiPicWidth   >>= 1;
  uiClearSize  >>= 1;
  uiBufHeight  >>= 1;
  uiBufWidth   >>= 1;
  uiBufStride  >>= 1;
  uiStartLine  >>= 1;
  uiEndLine    >>= 1;

  RNOKS( xReadPlane( pCb, uiBufHeight, uiBufWidth, uiBufStride, uiPicHeight, uiPicWidth, uiStartLine, uiEndLine ) );
  RNOKS( xReadPlane( pCr, uiBufHeight, uiBufWidth, uiBufStride, uiPicHeight, uiPicWidth, uiStartLine, uiEndLine ) );

  return Err::m_nOK;

}
コード例 #21
0
ErrVal
PictureParameterSet::create( PictureParameterSet*& rpcPPS )
{
  rpcPPS = new PictureParameterSet;
  ROT( NULL == rpcPPS );
  return Err::m_nOK;
}
コード例 #22
0
ErrVal
PictureParameterSet::xReadFrext( HeaderSymbolReadIf* pcReadIf )
{
const CommonMainH264* pcMainH264 = CommonMain::getMainH264();
  ASSERT(pcMainH264 != NULL);
  const CommonElt* pcCurrent = pcMainH264->getEltCurrent();
  const CommonSyntax* pcSyntax;

  const CommonControl* pcControlIf0 = pcCurrent->addControl("if" , "more_rbsp_data", pcReadIf->moreRBSPData());
  ROTRS( ! pcReadIf->moreRBSPData(), Err::m_nOK );

  pcSyntax = pcCurrent->addSyntax("transform_8x8_mode_flag", "u(1)");
  RNOK  ( pcReadIf->getFlag ( m_bTransform8x8ModeFlag,                    "PPS: transform_8x8_mode_flag" ) );
  pcSyntax->setValue(m_bTransform8x8ModeFlag);
  pcSyntax = pcCurrent->addSyntax("pic_scaling_matrix_present_flag", "u(1)");
  RNOK  ( pcReadIf->getFlag ( m_bPicScalingMatrixPresentFlag,             "PPS: pic_scaling_matrix_present_flag" ) );
  pcSyntax->setValue(m_bPicScalingMatrixPresentFlag);
  
	const CommonControl* pcControlIf1 = pcCurrent->addControl("if" , "pic_scaling_matrix_present_flag", m_bPicScalingMatrixPresentFlag);
  if( m_bPicScalingMatrixPresentFlag )
  {
	  pcMainH264->setEltCurrent(pcControlIf1);
    RNOK( m_cPicScalingMatrix.read( pcReadIf, m_bTransform8x8ModeFlag ) );
	pcMainH264->setEltCurrent(pcCurrent);
  }
   pcSyntax = pcCurrent->addSyntax("second_chroma_qp_index_offset", "se(v)");
  RNOK  ( pcReadIf->getSvlc ( m_iSecondChromaQpIndexOffset,               "PPS: second_chroma_qp_index_offset" ) );
  pcSyntax->setValue(m_iSecondChromaQpIndexOffset);
  ROT   ( m_iSecondChromaQpIndexOffset < -12 || m_iSecondChromaQpIndexOffset > 12 );

  return Err::m_nOK;
}
コード例 #23
0
ErrVal ReadYuvFile::readFrame( UChar *pLum,
                               UChar *pCb,
                               UChar *pCr,
                               UInt uiBufHeight,
                               UInt uiBufWidth,
                               UInt uiBufStride)
{
  ROT( uiBufHeight < m_uiLumPicHeight || uiBufWidth < m_uiLumPicWidth );

  UInt uiPicHeight = m_uiLumPicHeight;
  UInt uiPicWidth  = m_uiLumPicWidth;
  UInt uiClearSize = uiBufWidth - uiPicWidth;
  UInt uiStartLine = m_uiStartLine;
  UInt uiEndLine   = m_uiEndLine;

  RNOKS( xReadPlane( pLum, uiBufHeight, uiBufWidth, uiBufStride, uiPicHeight, uiPicWidth, uiStartLine, uiEndLine ) );

  uiPicHeight  >>= 1;
  uiPicWidth   >>= 1;
  uiClearSize  >>= 1;
  uiBufHeight  >>= 1;
  uiBufWidth   >>= 1;
  uiBufStride  >>= 1;
  uiStartLine  >>= 1;
  uiEndLine    >>= 1;

  RNOKS( xReadPlane( pCb, uiBufHeight, uiBufWidth, uiBufStride, uiPicHeight, uiPicWidth, uiStartLine, uiEndLine ) );
  RNOKS( xReadPlane( pCr, uiBufHeight, uiBufWidth, uiBufStride, uiPicHeight, uiPicWidth, uiStartLine, uiEndLine ) );

  return Err::m_nOK;

}
コード例 #24
0
ファイル: WriteBitstreamToFile.cpp プロジェクト: Aldream/jsvm
ErrVal WriteBitstreamToFile::destroy()
{
  ROT( m_cFile.is_open() );
  RNOK( uninit() );
  delete this;
  return Err::m_nOK;
}
コード例 #25
0
ErrVal
RecPicBuffer::destroy()
{
  ROT( m_bInitDone );
  delete this;
  return Err::m_nOK;
}
コード例 #26
0
ErrVal MbCoder::create( MbCoder*& rpcMbCoder )
{
  rpcMbCoder = new MbCoder;

  ROT( NULL == rpcMbCoder );

  return Err::m_nOK;
}
コード例 #27
0
ファイル: UvlcReader.cpp プロジェクト: hwyhit/JSVM
ErrVal UvlcReader::create( UvlcReader*& rpcUvlcReader )
{
  rpcUvlcReader = new UvlcReader;

  ROT( NULL == rpcUvlcReader );

  return Err::m_nOK;
}
コード例 #28
0
ファイル: CabaEncoder.cpp プロジェクト: hwyhit/JSVM
ErrVal CabaEncoder::init( BitWriteBufferIf* pcBitWriteBufferIf )
{
  ROT( NULL == pcBitWriteBufferIf )

  m_pcBitWriteBufferIf = pcBitWriteBufferIf;

  return Err::m_nOK;
}
コード例 #29
0
ErrVal MbCoder::initSlice(  const SliceHeader& rcSH,
                            MbSymbolWriteIf*   pcMbSymbolWriteIf,
                            RateDistortionIf*  pcRateDistortionIf )
{
  ROT( NULL == pcMbSymbolWriteIf );
  ROT( NULL == pcRateDistortionIf );

  m_pcMbSymbolWriteIf = pcMbSymbolWriteIf;
  m_pcRateDistortionIf = pcRateDistortionIf;

  m_bCabac          = rcSH.getPPS().getEntropyCodingModeFlag();
  m_bPrevIsSkipped  = false;

  m_bInitDone = true;

  return Err::m_nOK;
}
コード例 #30
0
ErrVal
RecPicBufUnit::markOutputted()
{
  ROT( m_bOutputted );
  m_bOutputted  = true;
  m_pcPicBuffer = NULL;
  return Err::m_nOK;
}