コード例 #1
0
ファイル: video_ffmpeg.cpp プロジェクト: BluePandaLi/mpeg4ip
bool CFfmpegVideoEncoder::GetReconstructedImage(
	u_int8_t* pY, u_int8_t* pU, u_int8_t* pV)
{
  uint32_t w = Profile()->m_videoWidth;
  uint32_t uvw = w / 2;

  CopyYuv(m_avctx->coded_frame->data[0],
	  m_avctx->coded_frame->data[1],
	  m_avctx->coded_frame->data[2],
	  m_avctx->coded_frame->linesize[0],
	  m_avctx->coded_frame->linesize[1],
	  m_avctx->coded_frame->linesize[2],
	  pY, pU, pV, 
	  w, uvw, uvw, 
	  w, Profile()->m_videoHeight);
  return true;
}
コード例 #2
0
void RDCddbLookup::lookupRecord(const QString &cdda_dir,const QString &cdda_dev,
			       const QString &hostname,Q_UINT16 port,
			       const QString &username,const QString &appname,
				const QString &appver)
{
  lookup_username=username;
  lookup_appname=appname;
  lookup_appver=appver;

  Profile("starting CD-TEXT lookup");
  if(!cdda_dir.isEmpty()) {
    if(ReadCdText(cdda_dir,cdda_dev)) {
      emit done(RDCddbLookup::ExactMatch);
      Profile("CD-TEXT lookup success");
      return;
    }
  }
  Profile("CD-TEXT lookup failure");

  Profile("starting CDDB lookup");
  if(!hostname.isEmpty()) {
    //
    // Set Up Default User
    //
    if(lookup_username.isEmpty()) {
      if(getenv("USER")==NULL) {
	lookup_username=RDCDDBLOOKUP_DEFAULT_USER;
      }
      else {
	lookup_username=getenv("USER");
      }
    }
    
    //
    // Get the Hostname
    //
    if(getenv("HOSTNAME")==NULL) {
      lookup_hostname=RDCDDBLOOKUP_DEFAULT_HOSTNAME;
    }
    else {
      lookup_hostname=getenv("HOSTNAME");
    }
    lookup_socket->connectToHost(hostname,port);
  }
}
コード例 #3
0
void CreateDialog::newProfile(ProfileManager *manager)
{
    CreateDialog dialog;
    if (dialog.exec() != QDialog::Accepted)
        return;

    if (!manager->addProfile(Profile(dialog.ui->nameBox->text(), dialog.ui->versionList->currentText())))
        QMessageBox::critical(0, "Error", "A profile with the same name already exists.");
}
コード例 #4
0
void Run()
	{
	SetStartTime();
	Log("Started %s\n", GetTimeAsStr());
	for (int i = 0; i < g_argc; ++i)
		Log("%s ", g_argv[i]);
	Log("\n");

#if	TIMING
	TICKS t1 = GetClockTicks();
#endif
	if (g_bRefine)
		Refine();
	else if (g_bRefineW)
		{
		extern void DoRefineW();
		DoRefineW();
		}
	else if (g_bProfDB)
		ProfDB();
	else if (g_bSW)
		Local();
	else if (0 != g_pstrSPFileName)
		DoSP();
	else if (g_bProfile)
		Profile();
	else if (g_bPPScore)
		PPScore();
	else if (g_bPAS)
		ProgAlignSubFams();
	else
		DoMuscle();

#if	TIMING
	extern TICKS g_ticksDP;
	extern TICKS g_ticksObjScore;
	TICKS t2 = GetClockTicks();
	TICKS TotalTicks = t2 - t1;
	TICKS ticksOther = TotalTicks - g_ticksDP - g_ticksObjScore;
	double dSecs = TicksToSecs(TotalTicks);
	double PctDP = (double) g_ticksDP*100.0/(double) TotalTicks;
	double PctOS = (double) g_ticksObjScore*100.0/(double) TotalTicks;
	double PctOther = (double) ticksOther*100.0/(double) TotalTicks;
	Log("                 Ticks     Secs    Pct\n");
	Log("          ============  =======  =====\n");
	Log("DP        %12ld  %7.2f  %5.1f%%\n",
	  (long) g_ticksDP, TicksToSecs(g_ticksDP), PctDP);
	Log("OS        %12ld  %7.2f  %5.1f%%\n",
	  (long) g_ticksObjScore, TicksToSecs(g_ticksObjScore), PctOS);
	Log("Other     %12ld  %7.2f  %5.1f%%\n",
	  (long) ticksOther, TicksToSecs(ticksOther), PctOther);
	Log("Total     %12ld  %7.2f  100.0%%\n", (long) TotalTicks, dSecs);
#endif

	ListDiagSavings();
	Log("Finished %s\n", GetTimeAsStr());
	}
コード例 #5
0
bool Application::Render()
{
    if (!MainWindow || MainWindow->IsDisposed()) return false;

    if (MainWindow->IsActive())
    {
        Profile("Render Frame");

        bool res = SceneCur->Render();

        {
            Profile("Swap buffers");
            MainWindow->SwapBuffers();
        }
        return res;
    }
    return true;
}
コード例 #6
0
bool Application::Update(float T_delta)
{
    if (!MainWindow || MainWindow->IsDestroyed()) return false;

    if (MainWindow->IsActive())
    {
        Profile("Update Frame");
        return SceneCur->Update(T_delta);
    }
    return true;
}
コード例 #7
0
LinkedinerBusiness * LinkedinerBusiness::clone()
{
    Profile cloneP = Profile(
                this->getProfile()->getName(),
                this->getProfile()->getSurname(),
                this->getProfile()->getNationality(),
                list<string>(*(this->getProfile()->getContacts()))
                );
    list<Works*> cloneW;
    list<Works*>::iterator iW = this->getWorks()->begin();
    for( ; iW != this->getWorks()->end(); ++iW)
    {
        cloneW.push_back(
                    new Works(
                        (*iW)->getStart(),
                        (*iW)->getEnd(),
                        (*iW)->getSector(),
                        (*iW)->getJob(),
                        list<string>( *(*iW)->getSkills() )
                    )
        );
    }
    list<Qualifications*> cloneQ;
    list<Qualifications*>::iterator iQ = this->getQualifications()->begin();
    for( ; iQ != this->getQualifications()->end(); ++iQ)
    {
        cloneQ.push_back(
                    new Qualifications(
                        (*iQ)->getName(),
                        (*iQ)->getYear()
                    )
        );
    }
    list<Languages*> cloneL;
    list<Languages*>::iterator iL = this->getLanguages()->begin();
    for( ; iL != this->getLanguages()->end(); ++iL)
    {
        cloneL.push_back(
                    new Languages(
                        (*iL)->getName(),
                        (*iL)->getWritten(),
                        (*iL)->getSpoken(),
                        (*iL)->getHeard()
                    )
        );
    }
    list<Linkediner*> cloneN;
    list<Linkediner*>::iterator iN = this->getNet()->begin();
    for( ; iN != this->getNet()->end(); ++iN)
    {
        cloneN.push_back(*iN);
    }
    return new LinkedinerBusiness(string(this->getEmail()),"","",cloneP,cloneW,cloneL,cloneN,cloneQ);
}
コード例 #8
0
void EditorBase::OnTick()
{
    mTime = SystemInfo::Instance()->GetSeconds();
    Double elapsedTime = mTime - mLastTime;

    elapsedTime *= SoundSubsystem::Instance()->GetSpeedRatio();

    {
    Profile("Tick");

	// Update the input system.
    {
    Profile("Input");
    InputSubsystem::Instance()->Update();
    }

    // Update the physic subsystem.
    //{
    //Profile("Physic");
    //PhysicSubsystem::Instance()->Update(elapsedTime);
    //}

	// Update the world manager.
    {
    Profile("World");
	mWorldManager->Update(elapsedTime);
    }

    // Update the sound subsystem.
    {
    Profile("Sound");
    Camera* camera = mWorldManager->GetCurrentCamera();
    SoundSubsystem::Instance()->Update( elapsedTime, 
                                        camera->GetPosition(),
                                        camera->GetView(),
                                        camera->GetUp() );
    }
    }

    mLastTime = mTime;
}
コード例 #9
0
ファイル: World.cpp プロジェクト: SebastienLussier/Gamedesk
Entity* World::SpawnEntity( Class* pEntityClass, const Vector3f& pPosition, const Quaternionf& pOrientation, const String& pName )
{
    GD_ASSERT( pEntityClass && pEntityClass->IsDerivedFrom(Entity::StaticClass()) );

    {Profile("Spawn");
    {Profile(pEntityClass->GetName());
    Entity* spawnedObject = Cast<Entity>( pEntityClass->AllocateNew() );

    spawnedObject->SetOwner(this);
    spawnedObject->SetName( pName );
    spawnedObject->SetWorld(this);

    spawnedObject->Init();
    spawnedObject->SetPosition( pPosition );
    spawnedObject->SetOrientation( pOrientation );

    InsertEntity( spawnedObject );

    return spawnedObject;
    }
    }
}
コード例 #10
0
    //---------------------------------------------------------------
    Profile& BaseExtraTechnique::getProfile ( const String& profileName )
    {
        // Is the given profile already in the map?
        ExtraTechniquesMap::iterator it = mExtraTechniques.find ( profileName );

        if ( it == mExtraTechniques.end() )
            mExtraTechniques.insert ( ExtraTechnique ( profileName, Profile() ) );

        it = mExtraTechniques.find ( profileName );
        if ( it == mExtraTechniques.end() ) { COLLADABU_ASSERT ( "Could not create a profile" ); }

        return ( *it ).second;
    }
コード例 #11
0
ファイル: datamodel.cpp プロジェクト: mNisblee/QTouch
Profile DataModel::getProfile(int index, bool selectStats)
{
	if (isValidProfileIndex(index))
	{
		// Lazy load stats
		if (selectStats)
		{
			mProfiles.at(index).clear();
			mDbHelper->getStats(mProfiles.at(index).getName(),
			                    std::inserter(mProfiles.at(index), mProfiles.at(index).begin()));
		}
		return mProfiles.at(index);
	}
	else
		return Profile(QString());
}
コード例 #12
0
ファイル: proflfun.c プロジェクト: DrItanium/maya
void ProfileCommand(
  Environment *theEnv,
  UDFContext *context,
  UDFValue *returnValue)
  {
   const char *argument;
   UDFValue theValue;

   if (! UDFFirstArgument(context,SYMBOL_BIT,&theValue)) return;
   argument = theValue.lexemeValue->contents;

   if (! Profile(theEnv,argument))
     {
      UDFInvalidArgumentMessage(context,"symbol with value constructs, user-functions, or off");
      return;
     }

   return;
  }
コード例 #13
0
ファイル: proflfun.c プロジェクト: atextor/derp
globle void ProfileCommand(
  void *theEnv)
  {
   char *argument;
   DATA_OBJECT theValue;

   if (EnvArgCountCheck(theEnv,"profile",EXACTLY,1) == -1) return;
   if (EnvArgTypeCheck(theEnv,"profile",1,SYMBOL,&theValue) == FALSE) return;

   argument = DOToString(theValue);

   if (! Profile(theEnv,argument))
     {
      ExpectedTypeError1(theEnv,"profile",1,"symbol with value constructs, user-functions, or off");
      return;
     }

   return;
  }
コード例 #14
0
ファイル: InputStream.cpp プロジェクト: Hendrik7/xbmc
bool CInputStream::Open(CFileItem &fileitem)
{
  INPUTSTREAM props;
  std::map<std::string, std::string> propsMap;
  for (auto &key : m_fileItemProps)
  {
    if (fileitem.GetProperty(key).isNull())
      continue;
    propsMap[key] = fileitem.GetProperty(key).asString();
  }

  props.m_nCountInfoValues = 0;
  for (auto &pair : propsMap)
  {
    props.m_ListItemProperties[props.m_nCountInfoValues].m_strKey = pair.first.c_str();
    props.m_ListItemProperties[props.m_nCountInfoValues].m_strValue = pair.second.c_str();
    props.m_nCountInfoValues++;
  }

  props.m_strURL = fileitem.GetPath().c_str();
  
  std::string libFolder = URIUtils::GetDirectory(m_parentLib);
  std::string profileFolder = CSpecialProtocol::TranslatePath(Profile());
  props.m_libFolder = libFolder.c_str();
  props.m_profileFolder = profileFolder.c_str();

  bool ret = false;
  try
  {
    ret = m_pStruct->Open(props);
    if (ret)
      m_caps = m_pStruct->GetCapabilities();
  }
  catch (std::exception &e)
  {
    CLog::Log(LOGERROR, "CInputStream::Open - could not open stream. Reason: %s", e.what());
    return false;
  }

  UpdateStreams();
  return ret;
}
コード例 #15
0
ファイル: video_xvid.cpp プロジェクト: BluePandaLi/mpeg4ip
bool CXvidVideoEncoder::EncodeImage(
				    const u_int8_t* pY, 
				    const u_int8_t* pU, 
				    const u_int8_t* pV, 
				    u_int32_t yStride,
				    u_int32_t uvStride,
				    bool wantKeyFrame,
				    Duration Elapsed,
				    Timestamp srcFrameTimestamp)
{
  m_srcFrameTimestamp = srcFrameTimestamp;
	m_vopBuffer = (u_int8_t*)malloc(Profile()->m_videoMaxVopSize);
	if (m_vopBuffer == NULL) {
		return false;
	}

	XVID_DEC_PICTURE decpict;
	decpict.y = (void *)pY;
	decpict.u = (void *)pU;
	decpict.v = (void *)pV;
	decpict.stride_y = yStride;
	decpict.stride_u = uvStride;
	m_xvidFrame.image = &decpict;
	m_xvidFrame.colorspace = XVID_CSP_USER;

	m_xvidFrame.bitstream = m_vopBuffer;
	m_xvidFrame.intra = (wantKeyFrame ? 1 : -1);

	if (xvid_encore(m_xvidHandle, XVID_ENC_ENCODE, &m_xvidFrame, 
	  &m_xvidResult) != XVID_ERR_OK) {
		debug_message("Xvid can't encode frame!");
		CHECK_AND_FREE(m_vopBuffer);
		return false;
	}

	m_vopBufferLength = m_xvidFrame.length;

	return true;
}
コード例 #16
0
ファイル: ScreenSaver.cpp プロジェクト: bild/xbmc
bool CScreenSaver::CreateScreenSaver()
{
#ifdef HAS_PYTHON
  if (URIUtils::HasExtension(LibPath(), ".py"))
  {
    // Don't allow a previously-scheduled alarm to kill our new screensaver
    g_alarmClock.Stop(PYTHON_ALARM, true);

    if (!g_pythonParser.StopScript(LibPath()))
      g_pythonParser.evalFile(LibPath(), AddonPtr(new CScreenSaver(Props())));
    return true;
  }
#endif
 // pass it the screen width,height
 // and the name of the screensaver
  int iWidth = g_graphicsContext.GetWidth();
  int iHeight = g_graphicsContext.GetHeight();

  m_pInfo = new SCR_PROPS;
#ifdef HAS_DX
  m_pInfo->device     = g_Windowing.Get3DDevice();
#else
  m_pInfo->device     = NULL;
#endif
  m_pInfo->x          = 0;
  m_pInfo->y          = 0;
  m_pInfo->width      = iWidth;
  m_pInfo->height     = iHeight;
  m_pInfo->pixelRatio = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()).fPixelRatio;
  m_pInfo->name       = strdup(Name().c_str());
  m_pInfo->presets    = strdup(CSpecialProtocol::TranslatePath(Path()).c_str());
  m_pInfo->profile    = strdup(CSpecialProtocol::TranslatePath(Profile()).c_str());

  if (CAddonDll<DllScreenSaver, ScreenSaver, SCR_PROPS>::Create() == ADDON_STATUS_OK)
    return true;

  return false;
}
コード例 #17
0
ファイル: init.c プロジェクト: kylekanos/mypluto
/* ********************************************************************* */
void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid) 
/*! 
 *  Assign user-defined boundary conditions.
 *
 * \param [in,out] d  pointer to the PLUTO data structure containing
 *                    cell-centered primitive quantities (d->Vc) and 
 *                    staggered magnetic fields (d->Vs, when used) to 
 *                    be filled.
 * \param [in] box    pointer to a RBox structure containing the lower
 *                    and upper indices of the ghost zone-centers/nodes
 *                    or edges at which data values should be assigned.
 * \param [in] side   specifies the boundary side where ghost zones need
 *                    to be filled. It can assume the following 
 *                    pre-definite values: X1_BEG, X1_END,
 *                                         X2_BEG, X2_END, 
 *                                         X3_BEG, X3_END.
 *                    The special value side == 0 is used to control
 *                    a region inside the computational domain.
 * \param [in] grid  pointer to an array of Grid structures.
 *
 *********************************************************************** */
{
  int   nv, i, j, k;
  double  r, vjet[NVAR], vout[NVAR];
 
  if (side == X2_BEG){

    JETVAL(vjet);
    X2_BEG_LOOP(k,j,i){
 
      r = grid[IDIR].x[i];
      for (nv = 0; nv < NVAR; nv++) 
        vout[nv] = d->Vc[nv][k][2*JBEG - j - 1][i];

      vout[VX2] *= -1.0;
      for (nv = 0; nv < NVAR; nv++) 
        d->Vc[nv][k][j][i] = vout[nv] + (vjet[nv] - vout[nv])*Profile(r,nv);
    }
コード例 #18
0
ファイル: Visualization.cpp プロジェクト: FernetMenta/xbmc
CVisualization::CVisualization(ADDON::BinaryAddonBasePtr addonBase, float x, float y, float w, float h)
  : IAddonInstanceHandler(ADDON_INSTANCE_VISUALIZATION, addonBase)
{
  // Setup new Visualization instance
  m_name = Name();
  m_presetsPath = CSpecialProtocol::TranslatePath(Path());
  m_profilePath = CSpecialProtocol::TranslatePath(Profile());

  m_struct = {{0}};
#if defined(TARGET_WINDOWS)
  m_struct.props.device = g_Windowing.Get3D11Context();
#else
  m_struct.props.device = nullptr;
#endif
  m_struct.props.x = static_cast<int>(x);
  m_struct.props.y = static_cast<int>(y);
  m_struct.props.width = static_cast<int>(w);
  m_struct.props.height = static_cast<int>(h);
  m_struct.props.pixelRatio = g_graphicsContext.GetResInfo().fPixelRatio;
  m_struct.props.name = m_name.c_str();
  m_struct.props.presets = m_presetsPath.c_str();
  m_struct.props.profile = m_profilePath.c_str();
  m_struct.toKodi.kodiInstance = this;
  m_struct.toKodi.transfer_preset = transfer_preset;

  /* Open the class "kodi::addon::CInstanceVisualization" on add-on side */
  if (CreateInstance(&m_struct) != ADDON_STATUS_OK)
  {
    CLog::Log(LOGFATAL, "Visualization: failed to create instance for '%s' and not usable!", ID().c_str());
    return;
  }

  /* presets becomes send with "transfer_preset" during call of function below */
  if (m_struct.toAddon.get_presets)
    m_struct.toAddon.get_presets(&m_struct);
}
コード例 #19
0
ファイル: video_x264.cpp プロジェクト: BluePandaLi/mpeg4ip
bool CX264VideoEncoder::Init (void)
{
  if (m_push != NULL) {
    delete m_push;
    m_push = NULL;
  }
  double rate;
  rate = TimestampTicks / Profile()->GetFloatValue(CFG_VIDEO_FRAME_RATE);

  m_frame_time = (Duration)rate;
  m_push = new CTimestampPush(6);

#ifdef OUTPUT_RAW
  m_outfile = fopen("raw.h264", FOPEN_WRITE_BINARY);
#endif

  if (Profile()->GetBoolValue(CFG_X264_FORCE_BASELINE)) {
    Profile()->SetBoolValue(CFG_VIDEO_USE_B_FRAMES, false);
    Profile()->SetBoolValue(CFG_X264_USE_CABAC, false);
    Profile()->SetBoolValue(CFG_X264_USE_PSNR, false);
    Profile()->SetBoolValue(CFG_X264_USE_SSIM, false);
    Profile()->SetBoolValue(CFG_X264_USE_8x8_DCT, false);
    Profile()->SetBoolValue(CFG_X264_USE_VBV, true);
    if (Profile()->GetIntegerValue(CFG_VIDEO_BIT_RATE) > 768) {
      Profile()->SetIntegerValue(CFG_VIDEO_BIT_RATE, 768);
    }
  }
  
  x264_param_default(&m_param);
  m_param.i_width = Profile()->m_videoWidth;
  m_param.i_height = Profile()->m_videoHeight;
  m_param.vui.i_sar_width = Profile()->GetIntegerValue(CFG_X264_SAR_WIDTH);
  m_param.vui.i_sar_height = Profile()->GetIntegerValue(CFG_X264_SAR_HEIGHT);
  m_param.i_fps_num = 
    (int)((Profile()->GetFloatValue(CFG_VIDEO_FRAME_RATE) + .5) * 1000);
  m_param.i_fps_den = 1000;
  //m_param.i_maxframes = 0;
  m_key_frame_count = m_param.i_keyint_max = 
    (int)(Profile()->GetFloatValue(CFG_VIDEO_FRAME_RATE) * 
	  Profile()->GetFloatValue(CFG_VIDEO_KEY_FRAME_INTERVAL));
  if (Profile()->GetBoolValue(CFG_VIDEO_USE_B_FRAMES)) {
    m_param.i_bframe = Profile()->GetIntegerValue(CFG_VIDEO_NUM_OF_B_FRAMES);
  } else {
    m_param.i_bframe = 0;
  }
  //debug_message("h264 b frames %d", m_param.i_bframe);
  m_param.rc.i_bitrate = Profile()->GetIntegerValue(CFG_VIDEO_BIT_RATE);
#ifndef HAVE_X264_PARAM_T_RC_I_RC_METHOD
  m_param.rc.b_cbr = Profile()->GetBoolValue(CFG_X264_USE_CBR) ? 1 : 0;
#else
  m_param.rc.i_rc_method = X264_RC_ABR;
#endif
  m_param.rc.f_rate_tolerance = Profile()->GetFloatValue(CFG_X264_BIT_RATE_TOLERANCE);

  const char *level = Profile()->GetStringValue(CFG_X264_LEVEL);
  if(level != NULL && *level != '\0') {
  	if( strstr( level, "1b" ) ) {
      m_param.i_level_idc = 1;
  	} else {
      if( atof(level) < 6 )
        m_param.i_level_idc = (int)(10*atof(level)+.5);
      else
        m_param.i_level_idc = atoi(level);
  	}
  }
  
  const char *partitions = Profile()->GetStringValue(CFG_X264_PARTITIONS);
  if(partitions != NULL) {
    m_param.analyse.inter = 0;
    if( strstr( partitions, "none" ) )  m_param.analyse.inter =  0;
    if( strstr( partitions, "all" ) )   m_param.analyse.inter = ~0;

    if( strstr( partitions, "i4x4" ) )  m_param.analyse.inter |= X264_ANALYSE_I4x4;
    if( strstr( partitions, "i8x8" ) )  m_param.analyse.inter |= X264_ANALYSE_I8x8;
    if( strstr( partitions, "p8x8" ) )  m_param.analyse.inter |= X264_ANALYSE_PSUB16x16;
    if( strstr( partitions, "p4x4" ) )  m_param.analyse.inter |= X264_ANALYSE_PSUB8x8;
    if( strstr( partitions, "b8x8" ) )  m_param.analyse.inter |= X264_ANALYSE_BSUB16x16;
  }

  const char *me = Profile()->GetStringValue(CFG_X264_ME);
  if(me != NULL) {
    x264_parse_enum( me, x264_motion_est_names, &m_param.analyse.i_me_method );
  }

  m_param.analyse.i_me_range = Profile()->GetIntegerValue(CFG_X264_ME_RANGE);
  m_param.analyse.i_subpel_refine = Profile()->GetIntegerValue(CFG_X264_SUBME);
  
  if (Profile()->GetBoolValue(CFG_X264_USE_VBV)) {
    if (Profile()->GetBoolValue(CFG_X264_FORCE_BASELINE)) {
      switch(m_param.i_level_idc) {
      	case 10:
          if (Profile()->GetIntegerValue(CFG_X264_VBV_MAXRATE) > 64) {
            Profile()->SetIntegerValue(CFG_X264_VBV_MAXRATE, 64);
          }
          if (Profile()->GetIntegerValue(CFG_X264_VBV_BUFSIZE) > 175) {
            Profile()->SetIntegerValue(CFG_X264_VBV_BUFSIZE, 175);
          }
          break;
        case 1:
          // Acctually level 1b
          if (Profile()->GetIntegerValue(CFG_X264_VBV_MAXRATE) > 128) {
            Profile()->SetIntegerValue(CFG_X264_VBV_MAXRATE, 128);
          }
          if (Profile()->GetIntegerValue(CFG_X264_VBV_BUFSIZE) > 350) {
            Profile()->SetIntegerValue(CFG_X264_VBV_BUFSIZE, 350);
          }
          m_param.i_level_idc = 11;
          break;
      	case 11:
          if (Profile()->GetIntegerValue(CFG_X264_VBV_MAXRATE) > 192) {
            Profile()->SetIntegerValue(CFG_X264_VBV_MAXRATE, 192);
          }
          if (Profile()->GetIntegerValue(CFG_X264_VBV_BUFSIZE) > 500) {
            Profile()->SetIntegerValue(CFG_X264_VBV_BUFSIZE, 500);
          }
          break;
        case 12:
          if (Profile()->GetIntegerValue(CFG_X264_VBV_MAXRATE) > 384) {
            Profile()->SetIntegerValue(CFG_X264_VBV_MAXRATE, 384);
          }
          if (Profile()->GetIntegerValue(CFG_X264_VBV_BUFSIZE) > 1000) {
            Profile()->SetIntegerValue(CFG_X264_VBV_BUFSIZE, 1000);
          }
          break;
      	case 13:
          if (Profile()->GetIntegerValue(CFG_X264_VBV_MAXRATE) > 768) {
            Profile()->SetIntegerValue(CFG_X264_VBV_MAXRATE, 768);
          }
          if (Profile()->GetIntegerValue(CFG_X264_VBV_BUFSIZE) > 2000) {
            Profile()->SetIntegerValue(CFG_X264_VBV_BUFSIZE, 2000);
          }
          break;
      }
    }
    m_param.rc.i_vbv_max_bitrate = Profile()->GetIntegerValue(CFG_X264_VBV_MAXRATE);
    m_param.rc.i_vbv_buffer_size = Profile()->GetIntegerValue(CFG_X264_VBV_BUFSIZE);
  }
  //m_param.rc.b_stat_write = 0;
  //m_param.analyse.inter = 0;
  m_param.analyse.b_psnr = Profile()->GetBoolValue(CFG_X264_USE_PSNR) ? 1 : 0;
  m_param.analyse.b_ssim = Profile()->GetBoolValue(CFG_X264_USE_SSIM) ? 1 : 0;
  m_param.analyse.b_transform_8x8 = Profile()->GetBoolValue(CFG_X264_USE_8x8_DCT) ? 1 : 0;
  m_param.b_cabac = Profile()->GetBoolValue(CFG_X264_USE_CABAC) ? 1 : 0;
  m_param.pf_log = x264_log;
  m_param.i_threads = Profile()->GetIntegerValue(CFG_X264_THREADS);
  m_pts_add = m_param.i_bframe ? (m_param.b_bframe_pyramid ? 2 : 1) : 0;
  m_pts_add *= m_frame_time;
  debug_message("pts add "D64, m_pts_add);

  m_h = x264_encoder_open(&m_param);
  if (m_h == NULL) {
    error_message("Couldn't init x264 encoder");
    return false;
  }

#ifdef USE_OUR_YUV
  m_pic_input.i_type = X264_TYPE_AUTO;
  m_pic_input.i_qpplus1 = 0;
  m_pic_input.img.i_csp = X264_CSP_I420;
#else
  x264_picture_alloc(&m_pic_input, X264_CSP_I420, Profile()->m_videoWidth,
		     Profile()->m_videoHeight);
#endif
  
  m_count = 0;
  
  return true;
}
コード例 #20
0
void SkeletizedObj :: Update(float T_time)
{
    Profile("Update skeletized object");

    //RigidObj::Update(T_time);

    //////////////////////////////////////////////////////// Update Verlets

    for (int bi = 0; bi < I_bones; ++bi)
        if (!FL_stationary)
        {
            xFLOAT I_count = 0;

            if (Collisions.size())
            {
                xVector3 NW_dump; NW_dump.zero();

                std::vector<Physics::Colliders::CollisionPoint>::iterator
                            iter_cur, iter_end = Collisions.end();

                for (iter_cur = Collisions.begin(); iter_cur != iter_end; ++iter_cur)
                    ApplyAcceleration(iter_cur->V_reaction, 1.f, *iter_cur);
                for (iter_cur = Collisions.begin(); iter_cur != iter_end; ++iter_cur)
                {
                    bool supports = false;
                    for (int ci = 0; ci < iter_cur->I_Bones && !supports; ++ci)
                        supports = (iter_cur->W_Bones[ci].I_bone == bi);

                    if (supports)
                    {
                        xVector3 N_fix = xVector3::Normalize(iter_cur->NW_fix);
                        xFLOAT W_cos = xVector3::DotProduct(N_fix, NW_VerletVelocity_new[bi]);
                        if (W_cos < 0.f)
                        {
                            NW_dump -= N_fix * W_cos;
                            ++I_count;
                        }
                    }
                }

                if (I_count)
                {
                    NW_VerletVelocity_new[bi] += NW_dump / I_count;
                    verletSystem.FL_attached[bi] = true;
                }
            }
            if (!I_count)
            {
                //if (T_time != 0)
                //{
                //    //drag
                //    xFLOAT V_vel = NW_VerletVelocity[i].length();
                //    xFLOAT W_air_drag = air_drag(S_radius, V_vel*V_vel) * T_time / M_mass;
                //    if (V_vel > W_air_drag)
                //        NW_VerletVelocity_new[i] += NW_VerletVelocity[i] * (1.f - W_air_drag / V_vel);
                //}
                //else
                    NW_VerletVelocity_new[bi] += NW_VerletVelocity[bi];
            }
            NW_VerletVelocity[bi] = NW_VerletVelocity_new[bi];

            if (!NW_VerletVelocity[bi].isZero())
            {
                if (T_time != 0)
                {
                    verletSystem.P_previous[bi] = verletSystem.P_current[bi] + NW_VerletVelocity[bi] * T_time;
                    Modify();
                }
                else
                    verletSystem.P_previous[bi] = verletSystem.P_current[bi];
                NW_VerletVelocity_new[bi].zero();
            }
            else
                verletSystem.P_previous[bi] = verletSystem.P_current[bi];
        }
    verletSystem.SwapPositions();

    xVector3 NW_translation;
    if (Collisions.size())
    {
        NW_translation = MergeCollisions() * 0.9f;
        if (NW_translation.lengthSqr() < 0.0001f)
            NW_translation.zero();
    }
    else
        NW_translation = verletSystem.P_current[0]-verletSystem.P_previous[0];

    // Update Matrices
    MX_LocalToWorld_Set().postTranslateT(NW_translation);
    UpdateMatrices();

    xSkeleton &spine = ModelGr->xModelP->Spine;
    verletSystem.C_constraints = spine.C_constraints;
    verletSystem.I_constraints = spine.I_constraints;
    verletSystem.C_lengthConst = spine.C_boneLength;
    verletSystem.Spine = &spine;
    verletSystem.MX_ModelToWorld   = MX_LocalToWorld_Get();
    verletSystem.MX_WorldToModel_T = MX_WorldToLocal;
    verletSystem.MX_WorldToModel_T.transpose();
    verletSystem.T_step = T_time;

    VerletSolver engine;
    engine.Init(verletSystem);
    engine.I_passes = 5;
    //engine.Verlet();
    engine.SatisfyConstraints();

    if (T_time > EPSILON)
    {
        xFLOAT T_time_Inv = 1.f / T_time;
        for (int i = 0; i < I_bones; ++i)
        {
            xVector3 V_speed = (verletSystem.P_current[i] - verletSystem.P_previous[i]) * T_time_Inv;
            if (V_speed.x > 0.f && NW_VerletVelocity[i].x > 0.f)
                V_speed.x = min (V_speed.x, NW_VerletVelocity[i].x);
            else
            if (V_speed.x < 0.f && NW_VerletVelocity[i].x < 0.f)
                V_speed.x = max (V_speed.x, NW_VerletVelocity[i].x);
            else
                V_speed.x = 0.f;

            if (V_speed.y > 0.f && NW_VerletVelocity[i].y > 0.f)
                V_speed.y = min (V_speed.y, NW_VerletVelocity[i].y);
            else
            if (V_speed.y < 0.f && NW_VerletVelocity[i].y < 0.f)
                V_speed.y = max (V_speed.y, NW_VerletVelocity[i].y);
            else
                V_speed.y = 0.f;

            if (V_speed.z > 0.f && NW_VerletVelocity[i].z > 0.f)
                V_speed.z = min (V_speed.z, NW_VerletVelocity[i].z);
            else
            if (V_speed.z < 0.f && NW_VerletVelocity[i].z < 0.f)
                V_speed.z = max (V_speed.z, NW_VerletVelocity[i].z);
            else
                V_speed.z = 0.f;
            NW_VerletVelocity[i] = V_speed;
        }
    }
    else
        for (int i = 0; i < I_bones; ++i)
            NW_VerletVelocity[i].zero();

    spine.CalcQuats(verletSystem.P_current, verletSystem.QT_boneSkew,
        0, verletSystem.MX_WorldToModel_T);
    spine.QuatsToArray(QT_verlet);

    FL_verlet = false;
    bool FL_locked = false;
    for (int i = 0; i < I_bones; ++i)
        if (verletSystem.FL_attached[i])
        {
            FL_locked = true;
            break;
        }

    xFLOAT T_mod = T_time;
    for (int i = 0; i < I_bones; ++i)
        if (T_Verlet[i] > T_time)
        {
            if (FL_locked) T_Verlet[i] -= T_time;
            verletSystem.W_boneMix[i] = 1.f;
            FL_verlet = true;
        }
        else
        if (T_Verlet[i] > 0.f)
        {
            T_Verlet[i] = 0.f;
            verletSystem.W_boneMix[i] = 1.f;
            FL_verlet = true;
        }
        else
        if (verletSystem.W_boneMix[i] > T_mod)
        {
            if (FL_locked) verletSystem.W_boneMix[i] -= T_mod;
            FL_verlet = true;
        }
        else
            verletSystem.W_boneMix[i] = 0.f;

    if (FL_verlet)
        comBoard.ID_action_cur = comBoard.StopAction.ID_action;


    spine.L_bones->QT_rotation.zeroQ();
    QT_verlet[0].zeroQ();

    //////////////////////////////////////////////////////// Track enemy movement

    if (FL_auto_movement && Tracker.Mode != Math::Tracking::ObjectTracker::TRACK_NOTHING &&
        !FL_verlet && LifeEnergy > 0.f && T_time > 0.f)
    {
        xVector3 NW_aim = MX_LocalToWorld_Get().preTransformV(
                              comBoard.GetActionRotation().preTransformV(
                                  xVector3::Create(0.f, -1.1f, 0.f)));
        NW_aim.z = 0.f;
        Tracker.P_destination = P_center_Trfm + NW_aim;
        Tracker.UpdateDestination();
        xVector3 NW_dst = Tracker.P_destination - P_center_Trfm; NW_dst.z = 0.f;

        comBoard.AutoMovement(NW_aim, NW_dst, T_time);
        MX_LocalToWorld_Set().preMultiply(comBoard.MX_shift);
    }
    bool FL_auto_movement_needed = comBoard.AutoAction != ComBoard::AutoHint::HINT_NONE;

    //////////////////////////////////////////////////////// Update Animation

	xQuaternion *bones = NULL, *bones2 = NULL;

    if (LifeEnergy > 0.f)
    {
        if (actions.L_actions.size())
        {
            xDWORD delta = (xDWORD)(T_time*1000);

            actions.Update(delta);
		    bones = actions.GetTransformations();

            if (actions.T_progress > 10000) actions.T_progress = 0;
        }
        
        if ((ControlType == Control_ComBoardInput || FL_auto_movement_needed) && comBoard.L_actions.size())
        {
            if (!FL_verlet)
            {
                comBoard.Update(T_time * 1000, ControlType == Control_ComBoardInput);
                MX_LocalToWorld_Set().preMultiply(comBoard.MX_shift);
            }
            bones2 = comBoard.GetTransformations();
        }
        else
        if (ControlType == Control_CaptureInput)
            bones2 = g_CaptureInput.GetTransformations();
        else
        if (ControlType == Control_NetworkInput)
            bones2 = g_NetworkInput.GetTransformations();
        else
        {
            //bones2 = new xQuaternion[ModelGr->instance.I_bones];
            //for (int i = 0; i < ModelGr->instance.I_bones; ++i)
            //    bones2[i].zeroQ();
        }
    }

    if (!bones && bones2) bones = bones2;
    else
    if (bones2)
    {
        xAnimation::Average(bones2, bones, ModelGr->instance.I_bones, 0.5f, bones);
        delete[] bones2;
    }

    if (bones)
        if (FL_verlet)
            xAnimation::Average(bones, QT_verlet, ModelGr->instance.I_bones, verletSystem.W_boneMix, bones);
        else
            UpdateSkews(bones);

    if (bones)
    {
        ModelGr->xModelP->Spine.QuatsFromArray(bones);
        delete[] bones;
        CalculateSkeleton();
    }
    else
    {
        ModelGr->xModelP->Spine.QuatsFromArray(QT_verlet);
        CalculateSkeleton();
    }

    //////////////////////////////////////////////////////// Update Physical Representation

	UpdateMatrices();
    UpdateVerletSystem();

    P_center_Trfm = MX_LocalToWorld_Get().preTransformP(P_center);

    if (T_time > EPSILON)
    {
        xFLOAT T_time_Inv = 1.f / T_time;
        for (int i = 0; i < I_bones; ++i)
            NW_VerletVelocity_total[i] = (verletSystem.P_current[i] - verletSystem.P_previous[i]) * T_time_Inv;
    }
    else
        for (int i = 0; i < I_bones; ++i)
            NW_VerletVelocity_total[i].zero();

    for (int i = 0; i < I_bones; ++i)
        if (NW_VerletVelocity_total[i].isZero())
            F_VerletPower[i].zero();
        else
        {
            xVector3 N_speed = xVector3::Normalize(NW_VerletVelocity_total[i]);
            xFLOAT   W_power = xVector3::DotProduct(F_VerletPower[i], N_speed);
            F_VerletPower[i] = NW_VerletVelocity_total[i];
            if (W_power > 0.f) F_VerletPower[i] += N_speed*W_power;

        }
}
コード例 #21
0
void RDCddbLookup::SendToServer(const QString &msg)
{
  lookup_socket->writeBlock(msg+"\n",msg.length()+1);
  Profile("sent to server: \""+msg+"\"");
}
コード例 #22
0
ファイル: text_encoder.cpp プロジェクト: BluePandaLi/mpeg4ip
 bool Init(void) { 
   m_encodedFrame = NULL;
   m_base_url = Profile()->GetStringValue(CFG_TEXT_HREF_BASE_URL);
   m_base_url_len = strlen(m_base_url);
   return true; 
 };
コード例 #23
0
ファイル: text_encoder.cpp プロジェクト: BluePandaLi/mpeg4ip
int CTextEncoder::ThreadMain (void)
{
  CMsg* pMsg;
  bool stop = false;
  
  Init();

  m_textDstType = GetFrameType();
  double temp = Profile()->GetFloatValue(CFG_TEXT_REPEAT_TIME_SECS);
  temp *= 1000.0;
  uint32_t wait_time = (uint32_t)temp;

  while (stop == false) {
    int rc = SDL_SemWaitTimeout(m_myMsgQueueSemaphore, wait_time);
    if (rc == 0) {
      pMsg = m_myMsgQueue.get_message();
      if (pMsg != NULL) {
	switch (pMsg->get_value()) {
	case MSG_NODE_STOP_THREAD:
	  debug_message("text %s stop received", 
			Profile()->GetName());
	  DoStopText();
	  stop = true;
	  break;
	case MSG_NODE_START:
	  // DoStartTransmit();  Anything ?
	  break;
	case MSG_NODE_STOP:
	  DoStopText();
	  break;
	case MSG_SINK_FRAME: {
	  uint32_t dontcare;
	  CMediaFrame *mf = (CMediaFrame*)pMsg->get_message(dontcare);
	  if (m_stop_thread == false)
	    ProcessTextFrame(mf);
	  if (mf->RemoveReference()) {
	    delete mf;
	  }
	  break;
	}
	}
      
	delete pMsg;
      } 
    } else if (rc == SDL_MUTEX_TIMEDOUT) {
      SendFrame(GetTimestamp());
    }
  }
  while ((pMsg = m_myMsgQueue.get_message()) != NULL) {
    if (pMsg->get_value() == MSG_SINK_FRAME) {
      uint32_t dontcare;
      CMediaFrame *mf = (CMediaFrame*)pMsg->get_message(dontcare);
      if (mf->RemoveReference()) {
	delete mf;
      }
    }
    delete pMsg;
  }
  debug_message("text encoder %s exit", Profile()->GetName());
  return 0;
}
コード例 #24
0
ファイル: dlna_media.hpp プロジェクト: mbits-os/DLNA
		void clear()
		{
			*this = Profile();
		}
コード例 #25
0
ファイル: sx.c プロジェクト: MiguelVis/RetroProjects
main()
{
	char *ptr;

	/* Build commands table */
	
	/*
	sv_cmd_max = 0;	*** Already initialized to 0
	*/

#ifdef SX_ALIAS	
	sv_cmd_name[sv_cmd_max]="alias";    sv_cmd_fun[sv_cmd_max++]=AliasMain;
#endif
#ifdef SX_ASCII
	sv_cmd_name[sv_cmd_max]="ascii";    sv_cmd_fun[sv_cmd_max++]=AsciiMain;
#endif
#ifdef SX_BATCH
	sv_cmd_name[sv_cmd_max]="batch";    sv_cmd_fun[sv_cmd_max++]=BatchMain;
#endif
#ifdef SX_BUILTIN
	sv_cmd_name[sv_cmd_max]="builtin";  sv_cmd_fun[sv_cmd_max++]=BuiltinMain;
#endif
#ifdef SX_CAT
	sv_cmd_name[sv_cmd_max]="cat";      sv_cmd_fun[sv_cmd_max++]=CatMain;
#endif
#ifdef SX_CD
	sv_cmd_name[sv_cmd_max]="cd";       sv_cmd_fun[sv_cmd_max++]=CdMain;
#endif
#ifdef SX_CHMOD
	sv_cmd_name[sv_cmd_max]="chmod";    sv_cmd_fun[sv_cmd_max++]=ChmodMain;
#endif
#ifdef SX_CLEAR
	sv_cmd_name[sv_cmd_max]="clear";    sv_cmd_fun[sv_cmd_max++]=ClearMain;
#endif
#ifdef SX_CP
	sv_cmd_name[sv_cmd_max]="cp";       sv_cmd_fun[sv_cmd_max++]=CpMain;
#endif
#ifdef SX_CPM
	sv_cmd_name[sv_cmd_max]="cpm";      sv_cmd_fun[sv_cmd_max++]=CpmMain;
#endif
#ifdef SX_DF
	sv_cmd_name[sv_cmd_max]="df";       sv_cmd_fun[sv_cmd_max++]=DfMain;
#endif
#ifdef SX_DIRALIAS
	sv_cmd_name[sv_cmd_max]="diralias"; sv_cmd_fun[sv_cmd_max++]=DiralMain;
#endif
#ifdef SX_DATE
	sv_cmd_name[sv_cmd_max]="date";     sv_cmd_fun[sv_cmd_max++]=DateMain;
#endif
#ifdef SX_DUMP
	sv_cmd_name[sv_cmd_max]="dump";     sv_cmd_fun[sv_cmd_max++]=DumpMain;
#endif
#ifdef SX_ECHO
	sv_cmd_name[sv_cmd_max]="echo";     sv_cmd_fun[sv_cmd_max++]=EchoMain;
#endif
#ifdef SX_ED
	sv_cmd_name[sv_cmd_max]="ed";       sv_cmd_fun[sv_cmd_max++]=EdMain;
#endif
#ifdef SX_ENV
	sv_cmd_name[sv_cmd_max]="env";      sv_cmd_fun[sv_cmd_max++]=EnvMain;
#endif
#ifdef SX_EXIT
	sv_cmd_name[sv_cmd_max]="exit";     sv_cmd_fun[sv_cmd_max++]=ExitMain;
#endif
#ifdef SX_FALSE
	sv_cmd_name[sv_cmd_max]="false";    sv_cmd_fun[sv_cmd_max++]=FalseMain;
#endif
#ifdef SX_FORTUNE
	sv_cmd_name[sv_cmd_max]="fortune";  sv_cmd_fun[sv_cmd_max++]=FortuneMain;
#endif
#ifdef SX_GOTO
	sv_cmd_name[sv_cmd_max]="goto";     sv_cmd_fun[sv_cmd_max++]=GotoMain;
#endif
#ifdef SX_GREP
	sv_cmd_name[sv_cmd_max]="grep";     sv_cmd_fun[sv_cmd_max++]=GrepMain;
#endif
#ifdef SX_HEAD
	sv_cmd_name[sv_cmd_max]="head";     sv_cmd_fun[sv_cmd_max++]=HeadMain;
#endif
#ifdef SX_HISTORY
	sv_cmd_name[sv_cmd_max]="history";  sv_cmd_fun[sv_cmd_max++]=HistMain;
#endif
#ifdef SX_IF
	sv_cmd_name[sv_cmd_max]="if";       sv_cmd_fun[sv_cmd_max++]=IfMain;
#endif
#ifdef SX_LS
	sv_cmd_name[sv_cmd_max]="ls";       sv_cmd_fun[sv_cmd_max++]=LsMain;
#endif
#ifdef SX_MAN
	sv_cmd_name[sv_cmd_max]="man";      sv_cmd_fun[sv_cmd_max++]=ManMain;
#endif
#ifdef SX_MEM
	sv_cmd_name[sv_cmd_max]="mem";      sv_cmd_fun[sv_cmd_max++]=MemMain;
#endif
#ifdef SX_MORE
	sv_cmd_name[sv_cmd_max]="more";     sv_cmd_fun[sv_cmd_max++]=MoreMain;
#endif
#ifdef SX_MV
	sv_cmd_name[sv_cmd_max]="mv";       sv_cmd_fun[sv_cmd_max++]=MvMain;
#endif
#ifdef SX_PWD
	sv_cmd_name[sv_cmd_max]="pwd";      sv_cmd_fun[sv_cmd_max++]=PwdMain;
#endif
#ifdef SX_READ
	sv_cmd_name[sv_cmd_max]="read";     sv_cmd_fun[sv_cmd_max++]=ReadMain;
#endif
#ifdef SX_RM
	sv_cmd_name[sv_cmd_max]="rm";       sv_cmd_fun[sv_cmd_max++]=RmMain;
#endif
#ifdef SX_SHIFT
	sv_cmd_name[sv_cmd_max]="shift";    sv_cmd_fun[sv_cmd_max++]=ShiftMain;
#endif
#ifdef SX_SLEEP
	sv_cmd_name[sv_cmd_max]="sleep";    sv_cmd_fun[sv_cmd_max++]=SleepMain;
#endif
#ifdef SX_SORT
	sv_cmd_name[sv_cmd_max]="sort";     sv_cmd_fun[sv_cmd_max++]=SortMain;
#endif
#ifdef SX_TAIL
	sv_cmd_name[sv_cmd_max]="tail";     sv_cmd_fun[sv_cmd_max++]=TailMain;
#endif
#ifdef SX_TEE
	sv_cmd_name[sv_cmd_max]="tee";      sv_cmd_fun[sv_cmd_max++]=TeeMain;
#endif
#ifdef SX_TRUE
	sv_cmd_name[sv_cmd_max]="true";     sv_cmd_fun[sv_cmd_max++]=TrueMain;
#endif
#ifdef SX_TTY
	sv_cmd_name[sv_cmd_max]="tty";      sv_cmd_fun[sv_cmd_max++]=TtyMain;
#endif
#ifdef SX_VER
	sv_cmd_name[sv_cmd_max]="ver";      sv_cmd_fun[sv_cmd_max++]=VerMain;
#endif
#ifdef SX_WC
	sv_cmd_name[sv_cmd_max]="wc";       sv_cmd_fun[sv_cmd_max++]=WcMain;
#endif
#ifdef SX_WHOAMI
	sv_cmd_name[sv_cmd_max]="whoami";   sv_cmd_fun[sv_cmd_max++]=WhoamiMain;
#endif

	/* Create some buffers and tables */

	/* FCXs */
	if(!(sv_fcxbuf = malloc(SX_MAX_FCX * 13)))
		return ErrorMem();

	/* Environment names */
	if(!(sv_env_name = KeyAlloc(SX_MAX_ENV)))
		return ErrorMem();

	/* Environment values */
	if(!(sv_env_value = KeyAlloc(SX_MAX_ENV)))
		return ErrorMem();

	/* Alias names */
	if(!(sv_alias_name = KeyAlloc(SX_MAX_ALIAS)))
		return ErrorMem();

	/* Alias values */
	if(!(sv_alias_value = KeyAlloc(SX_MAX_ALIAS)))
		return ErrorMem();

	/* Directory names */
	if(!(sv_dir_path = KeyAlloc(SX_MAX_DIR)))
		return ErrorMem();

	/* Directory values */
	if(!(sv_dir_alias = KeyAlloc(SX_MAX_DIR)))
		return ErrorMem();

	/* History */
	if(!(sv_hist = KeyAlloc(SX_MAX_HIST)))
		return ErrorMem();

	/* Set-up CP/M */
	SetUpCPM();

	/* Set-up some variables */
	sv_cmd_err = "SamaruX";

	/*
	sv_flg_hist = sv_flg_buf = sv_flg_quit = sv_flg_cpm = sv_cmd_exit = sv_batch = 0; *** Already initialized to 0
	*/

	/* Check if there is a CP/M command line */
	if(*(ptr = 0x0080))
	{
#ifdef SX_CMDCPM
		/* Check mode */

		if(*ptr > 4 && ptr[1] == ' ' && ptr[2] == '-' && ptr[3] == 'R' && ptr[4] == ' ')
		{
			/* Restore mode: comeback from a CP/M command */

			/* Set EOS */

			ptr[1 + (*ptr)] = 0;

			/* Load SamaruX status */

			LoadStatus(ptr + 5);
		}
		else
		{
#endif
			/* CP/M mode: execute command and return to CP/M */

			++sv_flg_cpm;

			/* Profile */
			Profile(SX_PROFCPM);

			/* Cook the command line a bit */
			ptr[*ptr + 1] = 0;

			while(*++ptr)
				*ptr = tolower(*ptr);

			/* Execute the command line */
			Execute(0x0081);

			/* Return to CP/M */
			return 0;
#ifdef SX_CMDCPM
		}
#endif
	}
	else
	{
		/* Interactive mode: execute commands until user quits the shell */
		printf("SamaruX v%d.%02d / %s\n\n%s\n\n", SX_VERSION, SX_RELEASE, SX_APPDATE, SX_COPYRGT);
		printf("CP/M v%d.%d\n\n", (sv_cpmver >> 4) & 0x0F, sv_cpmver & 0x0F);
		printf("%d built-in commands\n\n", sv_cmd_max);

		/* Profile */
		Profile(SX_PROFILE);
	}

	/* Interactive shell */
	while(1)
	{
		/* Re-use the buffer? */
		if(sv_flg_buf)
			sv_flg_buf = 0;
		else
			sv_ed_buf[0] = 0;

		/* Show prompt */
		Prompt();

		/* Read the command line */
		ReadLine(sv_ed_buf, SX_LINESIZE-1);
		putchar('\n');

		ptr = SkipSpaces(sv_ed_buf);

		if(*ptr)
		{
			/* Execute the command line */
			Execute(ptr);

			/* Quit the shell? */
			if(sv_flg_quit)
				break;

			/* Update history */
			UpdateHist();

			putchar('\n');
		}
	}

	/* Return to CP/M */
	return 0;
}
コード例 #26
0
ファイル: video_x264.cpp プロジェクト: BluePandaLi/mpeg4ip
bool CX264VideoEncoder::GetEsConfig (uint8_t **ppEsConfig, 
				     uint32_t *pEsConfigLen)
{
#ifdef DEBUG_H264
  debug_message("Getting es config for x264");
#endif
  CHECK_AND_FREE(Profile()->m_videoMpeg4Config);
  Profile()->m_videoMpeg4ConfigLength = 0;

  x264_nal_t *nal;
  int nal_num;
  if (x264_encoder_headers(m_h, &nal, &nal_num) != 0) {
    error_message("x264 - can't create headers");
    StopEncoder();
    return false;
  }
  
  uint8_t *seqptr = m_vopBuffer;
  uint8_t *picptr = m_vopBuffer;
  uint32_t seqlen = 0, piclen = 0;
  bool found_seq = false, found_pic = false;
  if (m_vopBuffer == NULL) {
    m_vopBuffer = (u_int8_t*)malloc(Profile()->m_videoMaxVopSize);
  }
  uint8_t *vopBuffer = m_vopBuffer;
  int vopBufferLen = Profile()->m_videoMaxVopSize;

  for (int ix = 0; ix < nal_num; ix++) {
    int i_size;
    i_size = x264_nal_encode(vopBuffer, &vopBufferLen, 1, &nal[ix]);
    if (i_size > 0) {
      bool useit = false;
      uint header_size = 0;
      if (h264_is_start_code(vopBuffer)) {
	header_size = vopBuffer[2] == 1 ? 3 : 4;
      }
      if (nal[ix].i_type == H264_NAL_TYPE_SEQ_PARAM) {
	found_seq = true;
	seqlen = i_size - header_size;
	seqptr = vopBuffer + header_size;
	useit = true;
      } else if (nal[ix].i_type == H264_NAL_TYPE_PIC_PARAM) {
	found_pic = true;
	piclen = i_size - header_size;
	picptr = vopBuffer + header_size;
	useit = true;
      }
      if (useit) {
	vopBuffer += i_size;
	vopBufferLen -= i_size;
      }
    }
  }
	  
  if (found_seq == false) {
    error_message("Can't find seq pointer in x264 header");
    StopEncoder();
    return false;
  }
  if (found_pic == false) {
    error_message("Can't find pic pointer in x264 header");
    StopEncoder();
    return false;
  }

  uint8_t *p = seqptr;
  
  if (*p == 0 && p[1] == 0 && 
      (p[2] == 1 || (p[2] == 0 && p[3] == 1))) {
    if (p[2] == 0) p += 4;
    else p += 3;
  }
  Profile()->m_videoMpeg4ProfileId = p[1] << 16 |
    p[2] << 8 |
    p[3];

  debug_message("profile id %x", Profile()->m_videoMpeg4ProfileId);
  
  char *sprop = NULL;
  char *base64;
  base64 = MP4BinaryToBase64(seqptr, seqlen);
  sprop = strdup(base64);
  free(base64);
  base64 = MP4BinaryToBase64(picptr, piclen);
  sprop = (char *)realloc(sprop, strlen(sprop) + strlen(base64) + 1 + 1);
  strcat(sprop, ",");
  strcat(sprop, base64);
  free(base64);

  debug_message("sprop %s", sprop);
  Profile()->m_videoMpeg4Config = (uint8_t *)sprop;
  Profile()->m_videoMpeg4ConfigLength = strlen(sprop) + 1;
  StopEncoder();
  return true;
}
コード例 #27
0
ファイル: VSPTree.cpp プロジェクト: rxantos/vsptree
VSPTree::VSPTree( QString appPath,  QString argument) :
	m_applicationPath( appPath ),
	m_settings( appPath + "/VSPTree.ini", QSettings::IniFormat )
{ 
	QDir dir(PATH32);
	QDir dir2(PATH64);
	if ( dir.exists() )
	{
		m_profilerpath = PATH32;
	}
	else if ( dir2.exists() )
	{
		m_profilerpath = PATH64;
	}
	else
	{
		QMessageBox::critical(NULL,"Standalone Debugger not installed", "C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Team Tools\\Performance Tools\\ does not exist");
	}

	QStringList env = QProcess::systemEnvironment();
	env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), QString("PATH=\\1;") + m_profilerpath);
	m_process.setEnvironment(env);

	if ( m_settings.contains("m_lastExe") ) 
	{
		m_lastExe = m_settings.value("m_lastExe").toString();
	}

	if ( m_settings.contains("m_lastVSP") ) 
	{
		m_lastVSP = m_settings.value("m_lastVSP").toString();
	}

	if ( m_settings.contains("m_lastArguments") ) 
	{
		m_lastArguments = m_settings.value("m_lastArguments").toString();
	}

	m_editorPath = "";
	if ( m_settings.contains("m_editorPath") ) 
	{
		m_editorPath = m_settings.value("m_editorPath").toString();
	}

	m_editorArguments = "<filename> -n<linenum>";
	if ( m_settings.contains("m_editorArguments") ) 
	{
		m_editorArguments = m_settings.value("m_editorArguments").toString();
	}

	m_log = new QTextEdit();
	m_log->setReadOnly(true);
	connect (&m_process, SIGNAL(readyReadStandardOutput()),this,  SLOT(StdOutLog()));
	connect (&m_process, SIGNAL(readyReadStandardError()),this,  SLOT(StdErrorLog()));

	menubar = this->menuBar();
	QMenu* fileMenu = menubar->addMenu("File");
	QAction* openAct = fileMenu->addAction("Open VSP");
	connect(openAct, SIGNAL(triggered()), this, SLOT(LoadVSPClicked()));
	QAction* exitAct = fileMenu->addAction("Exit");
	connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
	
	QMenu* profilerMenu = menubar->addMenu("Profiler");

	QAction* startProfilingAct = profilerMenu->addAction("Start Profiler Service");
	connect(startProfilingAct, SIGNAL(triggered()), this, SLOT(StartProfiling()));

	QAction* ProfileAct = profilerMenu->addAction("Profile Application");
	connect(ProfileAct, SIGNAL(triggered()), this, SLOT(Profile()));

	QAction* stopProfilingAct = profilerMenu->addAction("Stop Profiler Service");
	connect(stopProfilingAct, SIGNAL(triggered()), this, SLOT(StopProfiling()));

	QMenu* OptionsMenu = menubar->addMenu("Options");
	QAction* setTextEditor = OptionsMenu->addAction("Set Text Editor");
	connect(setTextEditor, SIGNAL(triggered()), this, SLOT(setTextEditor()));

	m_tabWidget = new QTabWidget();

	m_callTreeWidget = new QTreeWidget();

	m_flatCallTreeWidget = new QTreeWidget();

	m_functionSummaryTreeWidget = new QTreeWidget();

	m_tabWidget->addTab(m_callTreeWidget,"CallTree");
	m_tabWidget->addTab(m_flatCallTreeWidget,"CallTreeFlat");
	m_tabWidget->addTab(m_functionSummaryTreeWidget,"FunctionSummary");
	m_tabWidget->addTab(m_log,"Log");

	m_callTreeMenu = new QMenu();
	QAction* openFileAct = m_callTreeMenu->addAction("Open File");
	connect(openFileAct, SIGNAL(triggered()), this, SLOT(openFile()));

	QAction* expandAllAct = m_callTreeMenu->addAction("Expand All");
	connect(expandAllAct, SIGNAL(triggered()), m_callTreeWidget, SLOT(expandAll()));

	QAction* collapseAllAct = m_callTreeMenu->addAction("Collapse All");
	connect(collapseAllAct, SIGNAL(triggered()), m_callTreeWidget, SLOT(collapseAll()));

	m_flatCallTreeMenu = new QMenu();
	
	m_flatCallTreeMenu->addAction(openFileAct);
	QAction* FindInTreeAct = m_flatCallTreeMenu->addAction("Find In Tree");
	connect(FindInTreeAct, SIGNAL(triggered()), this, SLOT(FindInTree()));

	//threads
	connect( &m_thread, SIGNAL( output( QString ) ), this, SLOT( Log( QString ) ) );
	connect( &m_thread, SIGNAL( finished() ), this, SLOT( workDone() ) );

	this->setCentralWidget(m_tabWidget);
	this->setWindowTitle(VERSION);
	this->resize(640,480);
	this->show();

	if ( !argument.isEmpty() )
	{
		LoadVSP(argument);
	}
}
コード例 #28
0
 void Profile(FoldingSetNodeID &ID) const {
   Profile(ID, Attrs.data(), Attrs.size());
 }
コード例 #29
0
ファイル: IdentifierTable.cpp プロジェクト: vitillo/clang-upc
 void Profile(llvm::FoldingSetNodeID &ID) {
   Profile(ID, keyword_begin(), getNumArgs());
 }
コード例 #30
0
ファイル: video_x264.cpp プロジェクト: BluePandaLi/mpeg4ip
bool CX264VideoEncoder::EncodeImage(
				      const u_int8_t* pY, 
				      const u_int8_t* pU, 
				      const u_int8_t* pV, 
	u_int32_t yStride, u_int32_t uvStride,
	bool wantKeyFrame, 
	Duration elapsedDuration,
	Timestamp srcFrameTimestamp)
{
  //debug_message("encoding at "U64, srcFrameTimestamp);
  m_push->Push(srcFrameTimestamp);
  if (m_vopBuffer == NULL) {
    m_vopBuffer = (u_int8_t*)malloc(Profile()->m_videoMaxVopSize);
    if (m_vopBuffer == NULL) {
      error_message("Cannot malloc vop size");
      return false;
    }
  }
  m_count++;
  if (m_count >= m_key_frame_count) {
    wantKeyFrame = true;
    m_count = 0;
  }
#ifdef USE_OUR_YUV
  m_pic_input.img.plane[0] = (uint8_t *)pY;
  m_pic_input.img.i_stride[0] = yStride;
  m_pic_input.img.plane[1] = (uint8_t *)pU;
  m_pic_input.img.i_stride[1] = uvStride;
  m_pic_input.img.plane[2] = (uint8_t *)pV;
  m_pic_input.img.i_stride[2] = uvStride;
#else
  CopyYuv(pY, pU, pV, yStride, uvStride, uvStride,
	  m_pic_input.img.plane[0],m_pic_input.img.plane[1],m_pic_input.img.plane[2], 
	  m_pic_input.img.i_stride[0],m_pic_input.img.i_stride[1],m_pic_input.img.i_stride[2],
	  Profile()->m_videoWidth, Profile()->m_videoHeight);
#endif

  m_pic_input.i_type = wantKeyFrame ? X264_TYPE_IDR : X264_TYPE_AUTO;
  m_pic_input.i_pts = srcFrameTimestamp;

  x264_nal_t *nal;
  int i_nal;
  if (x264_encoder_encode(m_h, &nal, &i_nal, &m_pic_input, &m_pic_output) < 0) {
    error_message("x264_encoder_encode failed");
    return false;
  }
  CHECK_AND_FREE(m_nal_info);
  m_nal_info = (h264_nal_buf_t *)malloc(i_nal * sizeof(h264_nal_buf_t));
  uint8_t *vopBuffer = m_vopBuffer;
  int vopBufferLen = m_vopBufferLength;
  uint32_t loaded = 0;
  uint32_t nal_on = 0;

  // read the nals out of the encoder.  Nice...
  for (int ix = 0; ix < i_nal; ix++) {
    int i_size;
    bool skip = false;
    i_size = x264_nal_encode(vopBuffer, &vopBufferLen, 1, &nal[ix]);
    if (i_size > 0) {
      m_nal_info[nal_on].nal_length = i_size;
      m_nal_info[nal_on].nal_offset = loaded;
      m_nal_info[nal_on].nal_type = nal[ix].i_type;
      m_nal_info[nal_on].unique = false;
      uint32_t header = 0;
      if (h264_is_start_code(vopBuffer)) {
	header = vopBuffer[2] == 1 ? 3 : 4;
      }
      m_nal_info[nal_on].nal_length -= header;
      m_nal_info[nal_on].nal_offset += header;
      // we will send picture or sequence header through - let the
      // sinks decide to send or not
      if (skip == false) {
#ifdef DEBUG_H264
	uint8_t nal_type = nal[ix].i_type;
	if (h264_nal_unit_type_is_slice(nal_type)) {
	  uint8_t stype;
	  h264_find_slice_type(vopBuffer, i_size, &stype, true);
	  debug_message("nal %d - type %u slice type %u %d",
			ix, nal_type, stype, i_size);
	} else {
	  debug_message("nal %d - type %u %d", ix, nal_type, i_size);
	}
#endif
	nal_on++;
	loaded += i_size;
	vopBufferLen -= i_size;
	vopBuffer += i_size;
      } else {
#ifdef DEBUG_H264
	debug_message("skipped nal %u", nal[ix].i_type);
#endif
      }
    } else {
      error_message("Need to increase vop buffer size by %d", 
		    -i_size);
    }
  }
  m_nal_num = nal_on;
  m_vopBufferLength = loaded;
#ifdef DEBUG_H264
  debug_message("x264 loaded %d nals, %u len", 
		i_nal, loaded);
#endif
#ifdef OUTPUT_RAW
  if (m_vopBufferLength) {
    fwrite(m_vopBuffer, m_vopBufferLength, 1, m_outfile);
  }
#endif
	
  return true;
}