Exemple #1
0
int CDecoder::FFGetBuffer(AVCodecContext* avctx, AVFrame* pic, int flags)
{
  ICallbackHWAccel* cb = static_cast<ICallbackHWAccel*>(avctx->opaque);
  CDecoder* decoder = static_cast<CDecoder*>(cb->GetHWAccel());

  return decoder->GetBuffer(avctx, pic);
}
Exemple #2
0
CDecoder* CDecoder::NewL(TRect& aRect)
    {
    CDecoder* self = new(ELeave) CDecoder(aRect);
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop(self);
    return self;
    }
Exemple #3
0
void CThreadDecoder::Execute()
{
  try
  {
    #ifndef _NO_CRYPTO
      bool isEncrypted = false;
      bool passwordIsDefined = false;
    #endif

    Result = Decoder.Decode(
      EXTERNAL_CODECS_LOC_VARS
      InStream,
      StartPos,
      *Folders, FolderIndex,
      Fos,
      NULL
      _7Z_DECODER_CRYPRO_VARS
      #ifndef _7ZIP_ST
        , MtMode, NumThreads
      #endif
      );
  }
  catch(...)
  {
    Result = E_FAIL;
  }
  if (Result == S_OK)
    Result = FosSpec->CheckFinishedState();
  FosSpec->ReleaseOutStream();
}
Exemple #4
0
CDecoder * CDecoder::CreateDecoder( ECodecId eCodecId, int nBandWidth, LPCTSTR strName /* = NULL */ )
{
	CDecoder *pDec = NULL;
	switch( eCodecId )
	{
	case CODEC_H264:
		pDec = new CH264Decoder();
		break;
	case CODEC_MPEG4:
		pDec = new CMpeg4Decoder(); 
		break;	
	default:
		mcu::tlog << _T( "unknown codec! " ) << endl;
		_ASSERT( FALSE );
		return 0;
	    break;
	}

	BOOL bResult = pDec->Init( nBandWidth );
	if ( !bResult )
	{
		mcu::tlog << _T( "decoder Init Fail! bandwidth: " ) << nBandWidth << endl;
	}
	
	_ASSERT( bResult );
	if ( !bResult )
	{
		Release( pDec );
		pDec = NULL;
	}

	RegDec( strName, pDec );


	return pDec;
}
Exemple #5
0
void CDecoder::FFReleaseBuffer(void* opaque, uint8_t* data)
{
  CDecoder* decoder = static_cast<CDecoder*>(opaque);
  decoder->ReleaseBuffer(data);
}
Exemple #6
0
 ~CDecoderFlusher()
 {
   if (NeedFlush)
     m_Decoder->Flush();
   m_Decoder->ReleaseStreams();
 }
Exemple #7
0
int main(int argc, char *argv[])
{
	if (argc != 8)
	{
		cerr << "Usage: model beam input outDepTree outTreeScore reffile refnum" << endl;
		cerr << "one sentence one model" << endl;
        exit(1);
	}
    refnum = atoi(argv[7]);
	ifstream fin(argv[3]);

	if (!fin)
	{
		cerr << "Can not open file: " << argv[3] << endl;
		exit(1);
	}

	ofstream fout(argv[4]);
	if (!fout)
	{
		cerr << "Can not open file: " << argv[4] << endl;
		exit(1);
	}
    ofstream fscore(argv[5]);
    if(!fscore)
    {
        cerr << "Can not open file: " << argv[5] << endl;
    }
    ifstream refin(argv[6]);
    if(!refin)
    {
        cerr << "Can not open reference file: " << argv[6] <<endl;
        exit(1);
    }

	maxent me;
//	int tag = me.load_maxent_model(argv[1]);
//    if(tag==0)
//    {
//        fscore << -100<<endl;
//        cout<<"no reference model."<<endl;
//        return 0;
//        }

	int tag = me.load_maxent_model(argv[1]);
	int beam = atoi(argv[2]);

	beam = (beam < 1) ? 1 : beam;

	CDecoder decoder;
	string line,liner;
	int cnt = 0;

	while (getline(fin, line))
	{
		if (line.empty())
		{
			continue;
		}
        vector<string> vecref;
        for(int i=0; i<refnum; i++){
            getline(refin,liner);
            vecref.push_back(liner);
        }
		string result;
        float maxscore;
        int lenh, lenr;
		decoder.Decode(me, beam, line, result, maxscore, lenh, vecref, lenr);
//        fscore << maxscore <<endl;
        maxscore = maxscore/(float)(2*lenh-1);
        //fscore << maxscore+1 <<endl;
        //maxscore += 1;//(0,1)
        //if(maxscore>0)  ;
        //else maxscore=0;
       
        float sbp= exp(1-(float)lenr/(float)min(lenh,lenr));
        float srp= exp(1-(float)max(lenh,lenr)/(float)lenr);
        
//        fscore << sbp << endl;
//        fscore << srp << endl;
        fscore << exp(maxscore) <<endl;
//        fscore << (maxscore)*(sbp+srp)/(float)2 << endl;
//        if(BPexp<0.00001) BPexp=0;
        //fscore << maxscore << endl;
//        fscore << (maxscore)*BPexp << endl;

		++cnt;

		if (cnt % 1 == 0)
		{
			cerr << cnt << endl;
		}
	}

	cerr << "Succeed." << endl;
	fin.close();
	fout.close();
	return 0;
}