Example #1
0
_internal_handle_float(
    int negative,
    int exp,
    int suppress,
    ULONGLONG d,
    int l_or_L_prefix,
    va_list *ap)
{
    long double cur = 1, expcnt = 10;
    unsigned fpcontrol;
    BOOL negexp;

    fpcontrol = _control87(0, 0);
    _control87(_EM_DENORMAL|_EM_INVALID|_EM_ZERODIVIDE
            |_EM_OVERFLOW|_EM_UNDERFLOW|_EM_INEXACT, 0xffffffff);

    negexp = (exp < 0);
    if(negexp)
        exp = -exp;
    /* update 'cur' with this exponent. */
    while(exp) {
        if(exp & 1)
            cur *= expcnt;
        exp /= 2;
        expcnt = expcnt*expcnt;
    }
    cur = (negexp ? d/cur : d*cur);

    _control87(fpcontrol, 0xffffffff);

    if (!suppress) {
        if (l_or_L_prefix) _SET_NUMBER_(double);
        else _SET_NUMBER_(float);
    }
}
Example #2
0
void fpu_fix_start(unsigned int *old_cw) {
#ifdef X86
#ifdef _WIN32
#ifdef __BORLANDC__
  /* Win 32 Borland C */
  unsigned short cw = _control87(0, 0);
  _control87(0x0200, 0x0300);
  if (old_cw) {
    *old_cw = cw;
  }
#else
  /* Win 32 MSVC */
  unsigned int cw = _control87(0, 0);
  _control87(0x00010000, 0x00030000);
  if (old_cw) {
    *old_cw = cw;
  }
#endif
#else
  /* Linux */
  int cw, new_cw;
  _FPU_GETCW(cw);

  new_cw = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
  _FPU_SETCW(new_cw);
  
  if (old_cw) {
    *old_cw = cw;
  }
#endif
#endif
}
Example #3
0
void fpu_fix_end(unsigned int *old_cw) {
#ifdef X86
#ifdef _WIN32

#ifdef __BORLANDC__
  /* Win 32 Borland C */
  if (old_cw) {
    unsigned short cw = (unsigned short) *old_cw;
    _control87(cw, 0xFFFF);
  }
#else
  /* Win 32 MSVC */
  if (old_cw) {
    _control87(*old_cw, 0xFFFFFFFF);
  }
#endif

#else
  /* Linux */
  if (old_cw) {
    int cw;
    cw = *old_cw;
    _FPU_SETCW(cw);
  }
#endif
#endif
}
Example #4
0
	BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID lpvReserved)
#endif
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		{
			_clear87		();
			_control87		( _PC_53,   MCW_PC );
			_control87		( _RC_CHOP, MCW_RC );
			_control87		( _RC_NEAR, MCW_RC );
			_control87		( _MCW_EM,  MCW_EM );
		}
//.		LogFile.reserve		(256);
		break;
	case DLL_THREAD_ATTACH:
		CoInitializeEx	(NULL, COINIT_MULTITHREADED);
		timeBeginPeriod	(1);
		break;
	case DLL_THREAD_DETACH:
		break;
	case DLL_PROCESS_DETACH:
#ifdef USE_MEMORY_MONITOR
		memory_monitor::flush_each_time	(true);
#endif // USE_MEMORY_MONITOR
		break;
	}
    return TRUE;
}
Example #5
0
/*
 * Class:     sun_awt_windows_WDesktopPeer
 * Method:    ShellExecute
 * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute
  (JNIEnv *env, jclass cls, jstring uri_j, jstring verb_j)
{
    const WCHAR* uri_c = env->GetStringChars(uri_j, JNI_FALSE);
    const WCHAR* verb_c = env->GetStringChars(verb_j, JNI_FALSE);

    // 6457572: ShellExecute possibly changes FPU control word - saving it here
    unsigned oldcontrol87 = _control87(0, 0);
    HINSTANCE retval = ShellExecuteW(NULL, verb_c, uri_c, NULL, NULL, SW_SHOWNORMAL);
    _control87(oldcontrol87, 0xffffffff);

    env->ReleaseStringChars(uri_j, uri_c);
    env->ReleaseStringChars(verb_j, verb_c);

    if ((int)retval <= 32) {
        // ShellExecute failed.
        LPVOID buffer;
        int len = FormatMessageW(
                    FORMAT_MESSAGE_ALLOCATE_BUFFER |
                    FORMAT_MESSAGE_FROM_SYSTEM  |
                    FORMAT_MESSAGE_IGNORE_INSERTS,
                    NULL,
                    GetLastError(),
                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                    (LPWSTR) &buffer,
                    0,
                    NULL );

        jstring errmsg = env->NewString((LPCWSTR)buffer, len);
        LocalFree(buffer);
        return errmsg;
    }

    return NULL;
}
Example #6
0
	void		initialize		()
	{
		_clear87	();

		_control87	( _PC_24,   MCW_PC );
		_control87	( _RC_CHOP, MCW_RC );
		_24			= getFPUsw();	// 24, chop
		_control87	( _RC_NEAR, MCW_RC );
		_24r		= getFPUsw();	// 24, rounding

		_control87	( _PC_53,   MCW_PC );
		_control87	( _RC_CHOP, MCW_RC );
		_53			= getFPUsw();	// 53, chop
		_control87	( _RC_NEAR, MCW_RC );
		_53r		= getFPUsw();	// 53, rounding

		_control87	( _PC_64,   MCW_PC );
		_control87	( _RC_CHOP, MCW_RC );
		_64			= getFPUsw();	// 64, chop
		_control87	( _RC_NEAR, MCW_RC );
		_64r		= getFPUsw();	// 64, rounding

#ifndef XRCORE_STATIC

		m24r		();

#endif	//XRCORE_STATIC

		::Random.seed	( u32(CPU::GetCLK()%(1i64<<32i64)) );
	}
Example #7
0
int FloatConstNode::intValue(){
	float flt=value;
	int temp;
	_control87( _RC_NEAR|_PC_24|_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW|_EM_UNDERFLOW|_EM_INEXACT|_EM_DENORMAL,0xfffff );
	_asm{
		fld [flt];
		fistp [temp];
	}
	_control87( _CW_DEFAULT,0xfffff );
	return temp;
}
Example #8
0
/* One helper function: */
static void inline DisableFPUException()
{
  unsigned short usCW;

  // Some OS/2 PM API calls modify the FPU Control Word,
  // but forgets to restore it.

  // This can result in XCPT_FLOAT_INVALID_OPCODE exceptions,
  // so to be sure, we always disable Invalid Opcode FPU exception
  // before using FPU stuffs with Cairo or from this thread.

  usCW = _control87(0, 0);
  usCW = usCW | EM_INVALID | 0x80;
  _control87(usCW, MCW_EM | 0x80);
}
Example #9
0
fractal_context *
make_fractalc (const int formula, float wi, float he)
{
    fractal_context *new_ctxt;

#ifdef __GNUC__
#ifdef __i386__
#ifndef NOASSEMBLY
    _control87 (PC_64 | MCW_EM | MCW_RC, MCW_PC | MCW_EM | MCW_RC);
#endif
#endif
#endif
    new_ctxt = (fractal_context *) calloc (1, sizeof (fractal_context));
    if (new_ctxt == NULL)
        return 0;
    new_ctxt->windowwidth = wi;
    new_ctxt->periodicity = 1;
    new_ctxt->windowheight = he;
    new_ctxt->maxiter = DEFAULT_MAX_ITER;
    new_ctxt->bailout = DEFAULT_BAILOUT;
    new_ctxt->coloringmode = 0;
    new_ctxt->intcolor = 0;
    new_ctxt->outtcolor = 0;
    new_ctxt->slowmode = 0;
    new_ctxt->range = 3;
    new_ctxt->angle = 0;
    set_formula (new_ctxt, formula);
    return (new_ctxt);
}
Example #10
0
UINT CWin32Exception::Translate (UINT uiExceptions, UINT uiMask)
{
UINT uiPrev = m_uiTranslated;

	m_uiTranslated = (uiPrev & ~uiMask) | (uiExceptions & uiMask);

// evtl. Floating Exceptions einschalten
	if ((uiExceptions & uiMask) & W32EXP_FltException) {
	UINT uiFltEx = uiExceptions & uiMask;
	UINT uiNewCW = 0;

		if (uiFltEx & W32EXP_FltDenormalOperand)
			uiNewCW |= _EM_DENORMAL;
		if (uiFltEx & W32EXP_FltDivideByZero)
			uiNewCW |= _EM_ZERODIVIDE;
		if (uiFltEx & W32EXP_FltInexactResult)
			uiNewCW |= _EM_INEXACT;
		if (uiFltEx & W32EXP_FltInvalidOperation)
			uiNewCW |= _EM_INVALID;
		if (uiFltEx & W32EXP_FltOverflow)
			uiNewCW |= _EM_OVERFLOW;
		if (uiFltEx & W32EXP_FltUnderflow)
			uiNewCW |= _EM_UNDERFLOW;

		if (uiNewCW != 0)
			_control87 (uiNewCW, uiNewCW);
	}
	return uiPrev;
}
Example #11
0
int
main(int argc, char *argv[])
{
   const char * const me=argv[0];
   const float zero=0.0F;
   union {
     float flt32bit;
     int   int32bit;
   } qnan;

#if defined(__BORLANDC__)
   // Disable floating point exceptions in Borland
   _control87(MCW_EM, MCW_EM);
#endif // defined(__BORLANDC__)

   if (sizeof(float) != sizeof(int))
     {
     fprintf(stderr, "%s: MADNESS:  sizeof(float)=%d != sizeof(int)=%d\n",
           me, (int)sizeof(float), (int)sizeof(int));
     return -1;
     }
   qnan.flt32bit=zero/zero;
   printf("-DTEEM_QNANHIBIT=%d\n", (qnan.int32bit >> 22) & 1);
   return (int)((qnan.int32bit >> 22) & 1);
}
Example #12
0
int _glfwPlatformInit(void)
{
    // To make SetForegroundWindow work as we want, we need to fiddle
    // with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early
    // as possible in the hope of still being the foreground process)
    SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
                         &_glfw.win32.foregroundLockTimeout, 0);
    SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
                         SPIF_SENDCHANGE);

    if (!initLibraries())
        return GL_FALSE;

    if (_glfw_SetProcessDPIAware)
        _glfw_SetProcessDPIAware();

#ifdef __BORLANDC__
    // With the Borland C++ compiler, we want to disable FPU exceptions
    // (this is recommended for OpenGL applications under Windows)
    _control87(MCW_EM, MCW_EM);
#endif

    if (!_glfwInitContextAPI())
        return GL_FALSE;

    _glfwInitTimer();
    _glfwInitJoysticks();

    return GL_TRUE;
}
static void inline
DisableFPUException (void)
{
    unsigned short usCW;

    /* Some OS/2 PM API calls modify the FPU Control Word,
     * but forget to restore it.
     *
     * This can result in XCPT_FLOAT_INVALID_OPCODE exceptions,
     * so to be sure, we disable Invalid Opcode FPU exception
     * before using FPU stuffs.
     */
    usCW = _control87 (0, 0);
    usCW = usCW | EM_INVALID | 0x80;
    _control87 (usCW, MCW_EM | 0x80);
}
Example #14
0
int _glfwPlatformInit(void)
{
    // To make SetForegroundWindow work as we want, we need to fiddle
    // with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early
    // as possible in the hope of still being the foreground process)
    SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
                         &_glfw.win32.foregroundLockTimeout, 0);
    SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
                         SPIF_SENDCHANGE);

    if (!initLibraries())
        return GL_FALSE;

#ifdef __BORLANDC__
    // With the Borland C++ compiler, we want to disable FPU exceptions
    // (this is recommended for OpenGL applications under Windows)
    _control87(MCW_EM, MCW_EM);
#endif

    _glfw.win32.instance = GetModuleHandle(NULL);

    // Save the original gamma ramp
    _glfw.originalRampSize = 256;
    _glfwPlatformGetGammaRamp(&_glfw.originalRamp);
    _glfw.currentRamp = _glfw.originalRamp;

    if (!_glfwInitOpenGL())
        return GL_FALSE;

    _glfwInitTimer();

    _glfwInitJoysticks();

    return GL_TRUE;
}
Example #15
0
int main(int, char** argv)
{
#ifdef __BORLANDC__
	_control87(MCW_EM | PC_53, MCW_EM | MCW_PC);
#endif

	// setup temp path as the executable folder
	std::string temp = argv[0];
	std::string::size_type slash = temp.find_last_of("\\/");
	temp.erase((slash != std::string::npos) ? slash + 1 : 0);

	test_runner::_temp_path = temp.c_str();
	
	replace_memory_management();

	unsigned int total = 0;
	unsigned int passed = 0;

	test_runner* test = 0; // gcc3 "variable might be used uninitialized in this function" bug workaround

	for (test = test_runner::_tests; test; test = test->_next)
	{
		total++;
		passed += run_test(test);
	}

	unsigned int failed = total - passed;

	if (failed != 0)
		printf("FAILURE: %u out of %u tests failed.\n", failed, total);
	else
		printf("Success: %u tests passed.\n", total);

	return failed;
}
Example #16
0
void fenv_rounding(e_ieee754_rounding rounding_mode)
{
#if defined LMI_IEC_559
    int z =
          (fe_tonearest  == rounding_mode) ? FE_TONEAREST
        : (fe_downward   == rounding_mode) ? FE_DOWNWARD
        : (fe_upward     == rounding_mode) ? FE_UPWARD
        : (fe_towardzero == rounding_mode) ? FE_TOWARDZERO
        : throw std::runtime_error("Failed to set rounding mode.")
        ;
    fesetround(z);
#elif defined __BORLANDC__
    unsigned short int z =
          (fe_tonearest  == rounding_mode) ? (unsigned short int)(RC_NEAR)
        : (fe_downward   == rounding_mode) ? (unsigned short int)(RC_DOWN)
        : (fe_upward     == rounding_mode) ? (unsigned short int)(RC_UP)
        : (fe_towardzero == rounding_mode) ? (unsigned short int)(RC_CHOP)
        : throw std::runtime_error("Failed to set rounding mode.")
        ;
    _control87(z, MCW_RC);
#elif defined LMI_X86
    intel_control_word control_word(x87_control_word());
    control_word.rc(rounding_mode);
    x87_control_word(control_word.cw());
#else  // Unknown compiler or platform.
#   error Unknown compiler or platform.
#endif // Unknown compiler or platform.
}
Example #17
0
 void
fpinit_ASL(void)
{
	static int first = 1;

#ifndef No_Control87 /* for DEC Alpha */
#ifndef MCW_EM
#ifndef _MCW_EM	/* for cygwin with -mno-cygwin */
#define _MCW_EM 0x0008001F
#endif
#define MCW_EM _MCW_EM
#endif
#ifndef PC_53
#ifndef _PC_53
#define _PC_53 0x00010000
#endif
#define PC_53 _PC_53
#endif
#ifndef MCW_PC
#ifndef _MCW_PC
#define _MCW_PC 0x00030000
#endif
#define MCW_PC _MCW_PC
#endif
	_control87(MCW_EM | PC_53, MCW_EM | MCW_PC);
#endif
	if (first) {
		first = 0;
		siglisten();
		}
	}
Example #18
0
/*
 =======================================================================================================================
 =======================================================================================================================
 */
DWORD AUDIO_ProcessAList(void)
{
	int k = 1600;

	/* try/except is handled from the call to this function */
	__try
	{
		_control87(_RC_NEAR|_PC_64, _MCW_RC|_MCW_PC);

		if(_AUDIO_ProcessAList_Count_Cycles != NULL && currentromoptions.RSP_RDP_Timing)
		{
			k = _AUDIO_ProcessAList_Count_Cycles();
		}
		else if(_AUDIO_ProcessAList != NULL) 
			_AUDIO_ProcessAList();

        RestoreOldRoundingMode(((uint32) cCON31 & 0x00000003) << 8);
	}

	__except(NULL, EXCEPTION_EXECUTE_HANDLER)
	{
		/* Some people won't have a sound card. No error. */
		//MessageBox(0, "Exception", "", 0);
	}

	return k;
}
Example #19
0
/*
 * pc_init()
 *   return: none
 */
void
pc_init (void)
{
  unsigned int fpbits;

  fpbits = _EM_OVERFLOW | _EM_UNDERFLOW | _EM_ZERODIVIDE;
  (void) _control87 (fpbits, fpbits);
}
Example #20
0
void TJSRestoreFPUE()
{

#if defined(__WIN32__) && !defined(__GNUC__)
	if(!TJSFPUInit) return;
	_control87(TJSDefaultFPUCW, 0xffff);
#endif
}
Example #21
0
int main() { // Main
  int i;
#if defined(DJGPP) || defined(__WATCOMC__)
   // Put the fpu in a low precision, no exception state
  _control87(MCW_EM|PC_24,MCW_EM|MCW_PC); 
#endif

  exSetGraphics(); // Set graphics

  CubeMat = plMatCreate();    // Create the material for the cube
  CubeMat->NumGradients = 100; // Have it use 100 colors
  CubeMat->ShadeType = PL_SHADE_FLAT; // Make the cube flat shaded
  plMatInit(CubeMat);          // Initialize the material

  AllMaterials[0] = CubeMat; // Make list of materials
  AllMaterials[1] = 0; // Null terminate list of materials
  plMatMakeOptPal(ThePalette,1,255,AllMaterials); // Create a nice palette

  ThePalette[0] = ThePalette[1] = ThePalette[2] = 0; // Color 0 is black

  plMatMapToPal(CubeMat,ThePalette,0,255); // Map the material to our palette

  // Convert std 8 bit/chan palette to vga's 6 bit/chan palette
  for (i = 0; i < 768; i ++) ThePalette[i] >>= 2;
  exSetPalette(ThePalette); // Set the palette
 
  TheCube = plMakeBox(100.0,100.0,100.0,CubeMat); // Create the cube

  TheCamera = plCamCreate(320, // Screen width
                          200, // Screen height
                          320*3.0/(200*4.0), // Aspect ratio
                          90.0, // Field of view
                          TheFrameBuffer, // Framebuffer
                          NULL // ZBuffer (none)
                          ); // Create the camera
  TheCamera->Z = -300; // Back the camera up from the origin

  TheLight = plLightSet(plLightCreate(), // Create a light to be set up
             PL_LIGHT_VECTOR, // vector light
             0.0,0.0,0.0, // rotation angles
             1.0, // intensity
             1.0); // falloff, not used for vector lights
             
  while (!exGetKey()) { // While the keyboard hasn't been touched
    TheCube->Xa += 1.0; // Rotate by 1 degree on each axis
    TheCube->Ya += 1.0;
    TheCube->Za += 1.0;
    memset(TheFrameBuffer,0,320*200); // clear framebuffer for next frame
    plRenderBegin(TheCamera);        // Start rendering with the camera
    plRenderLight(TheLight);         // Render our light
    plRenderObj(TheCube);            // Render our object
    plRenderEnd();                   // Finish rendering
    exWaitVSync();                   // Sync with retrace
    memcpy(exGraphMem,TheFrameBuffer,320*200); // dump to screen
  }
  exSetText(); // Restore text mode
  return 0;          // Quit
}
Example #22
0
	void Detect	()
	{
		// General CPU identification
		if (!_cpuid	(&ID))	
		{
			// Core.Fatal		("Fatal error: can't detect CPU/FPU.");
			abort				();
		}

		// Timers & frequency
		u64			start,end;
		u32			dwStart,dwTest;

		SetPriorityClass		(GetCurrentProcess(),REALTIME_PRIORITY_CLASS);

		// Detect Freq
		dwTest	= timeGetTime();
		do { dwStart = timeGetTime(); } while (dwTest==dwStart);
		start	= GetCLK();
		while (timeGetTime()-dwStart<1000) ;
		end		= GetCLK();
		clk_per_second = end-start;

		// Detect RDTSC Overhead
		clk_overhead	= 0;
		u64 dummy		= 0;
		for (int i=0; i<256; i++)	{
			start			=	GetCLK();
			clk_overhead	+=	GetCLK()-start-dummy;
		}
		clk_overhead		/=	256;

		// Detect QPC Overhead
		QueryPerformanceFrequency	((PLARGE_INTEGER)&qpc_freq)	;
		qpc_overhead	= 0;
		for (int i=0; i<256; i++)	{
			start			=	QPC();
			qpc_overhead	+=	QPC()-start-dummy;
		}
		qpc_overhead		/=	256;

		SetPriorityClass	(GetCurrentProcess(),NORMAL_PRIORITY_CLASS);

		clk_per_second	-=	clk_overhead;
		clk_per_milisec	=	clk_per_second/1000;
		clk_per_microsec	=	clk_per_milisec/1000;

		_control87	( _PC_64,   MCW_PC );
//		_control87	( _RC_CHOP, MCW_RC );
		double a,b;
		a = 1;		b = double(clk_per_second);
		clk_to_seconds = float(double(a/b));
		a = 1000;	b = double(clk_per_second);
		clk_to_milisec = float(double(a/b));
		a = 1000000;b = double(clk_per_second);
		clk_to_microsec = float(double(a/b));
	}
Example #23
0
void lis_quad_x87_fpu_init(unsigned int *cw_old)
{
#ifdef HAS_X87_FPU
#ifdef _WIN32
	unsigned int cw = _control87(0, 0);
	_control87(0x00010000, 0x00030000);
	*cw_old = cw;
	cw = _control87(0, 0);
#else
	int cw,cw_new;
	asm volatile ("fnstcw %0":"=m" (cw));
	cw_new = (cw & ~0x0300) | 0x0200;
	asm volatile ("fldcw %0": :"m" (cw_new));
	*cw_old = cw;
#endif
#else
	*cw_old = 0;
#endif
}
Example #24
0
void lis_quad_x87_fpu_finalize(unsigned int cw)
{
#ifdef HAS_X87_FPU
#ifdef _WIN32
    _control87(cw, 0xFFFFFFFF);
#else
	asm volatile ("fldcw %0": :"m" (cw));
#endif
#endif
}
Example #25
0
void    __MaskDefaultFPE( void ) {
//==========================
#if defined( _M_IX86 )
    // By default we don't report the following exceptions;
    // the user has to make his own call to _control87.  This has to
    // be done in the "fpc" model as well in case there is an 80x87
    // present.
    _control87( ~0, EM_UNDERFLOW | EM_DENORMAL | EM_PRECISION );
#endif
}
void __fastcall TMainCaptureForm::FormCreate(TObject *Sender)
{

	CaptureWorkerForm = new TCaptureWorkerForm(this);
	CaptureWorkerForm1 = new TCaptureWorkerForm(this);
	CaptureWorkerForm2 = new TCaptureWorkerForm(this);
	CaptureWorkerForm3 = new TCaptureWorkerForm(this);
     MainCaptureForm->Caption = UnicodeString("CES Video Stream, version ") + getVersion();
	//There has to be some option other than silent failure and dialog box, but I haven't found it yet.
	//	_control87(MCW_EM, MCW_EM);  //Turn off FPU generated floating point exceptions. Threads still fail however.
	_control87( 0x1372, 0x137F ); //turns on dialog exceptions, but not in TThread. Exceptions in TThread cause the thread to die.


	pBmpRec=new Graphics::TBitmap;
	pBmpRec-> LoadFromFile("Rec.bmp");
	pBmpRecGr=new Graphics::TBitmap;
	pBmpRecGr-> LoadFromFile("Rec-gr.bmp");
	pBmpPau=new Graphics::TBitmap;
	pBmpPau->LoadFromFile("Pau.bmp");
	pBmpPauGr=new Graphics::TBitmap;
	pBmpPauGr->LoadFromFile("Pau-gr.bmp");

	//set default output folder to c:\Users\currentUser\Desktop\capture
 //	char pathC[MAX_PATH];
 //	SHGetSpecialFolderPath(NULL, pathC, CSIDL_DESKTOP, 1);
 //	edOutput->Text = UnicodeString(pathC) + "\\capture";

	frameThread = NULL;
	frameThread1 = NULL;
	frameThread2 = NULL;
	frameThread3 = NULL;
	hMutex = CreateMutex(0,false,0);
	hMutex1 = CreateMutex(0,false,0);
	hMutex2 = CreateMutex(0,false,0);
	hMutex3 = CreateMutex(0,false,0);
	BitBtnStop->Enabled = false;
	FrameDivisorEditChange(this);
	SpatialDivisorEditChange(this);



	allegro_init();
	set_gdi_color_format();
	set_color_depth(CDEPTH);

	nFrames=0;
	SetToVideoMode();

	   // let's refresh the controls according to the TVideoGrabber's states
   AssignListToComboBox (cbVideoInputDevice, CaptureWorkerForm->VideoGrabber->VideoDevices, CaptureWorkerForm->VideoGrabber->VideoDevice);
   AssignListToComboBox (cbVideoInputDevice1, CaptureWorkerForm1->VideoGrabber->VideoDevices, CaptureWorkerForm1->VideoGrabber->VideoDevice);
   AssignListToComboBox (cbVideoInputDevice2, CaptureWorkerForm2->VideoGrabber->VideoDevices, CaptureWorkerForm2->VideoGrabber->VideoDevice);
   AssignListToComboBox (cbVideoInputDevice3, CaptureWorkerForm3->VideoGrabber->VideoDevices, CaptureWorkerForm3->VideoGrabber->VideoDevice);

}
Example #27
0
 static void
ieee0(Void)
{
#ifndef __alpha
	_control87(EM_DENORMAL | EM_UNDERFLOW | EM_INEXACT, MCW_EM);
#endif
	/* With MS VC++, compiling and linking with -Zi will permit */
	/* clicking to invoke the MS C++ debugger, which will show */
	/* the point of error -- provided SIGFPE is SIG_DFL. */
	signal(SIGFPE, SIG_DFL);
	}
Example #28
0
void  C3DTransform::Initialize()
{

    if (false == g_bInitSinCosTable)
    {
        _control87(_MCW_RC, _RC_DOWN); //设置FPU的舍入模式,在Bilinear函数中需要使用汇编加快float->int

        Build_Sin_Cos_Tables();
        g_bInitSinCosTable = true;
    }
}
Example #29
0
bool initFPU()
{
#ifdef _WIN64
//    int old_cw = ld_initfpu(_RC_NEAR);
    int old_cw = ld_initfpu(0x300 /*_PC_64  | _RC_NEAR*/, // #defines NOT identical to CPU FPU control word!
                            0xF00 /*_MCW_PC | _MCW_RC*/);
#else
    int old_cw = _control87(_MCW_EM | _PC_64  | _RC_NEAR,
                            _MCW_EM | _MCW_PC | _MCW_RC);
#endif
    return true;
}
Example #30
0
bool initFPU()
{
#ifdef _WIN64
//    int old_cw = ld_initfpu(_RC_NEAR);
    int old_cw = ld_initfpu(0x300 /*_PC_64  | _RC_NEAR*/, // #defines NOT identical to CPU FPU control word!
                            0xF00 /*_MCW_PC | _MCW_RC*/);
#else
    int old_cw = _control87(_MCW_EM | _PC_64  | _RC_NEAR,
                            _MCW_EM | _MCW_PC | _MCW_RC);
#endif
    _set_output_format(_TWO_DIGIT_EXPONENT);
    return true;
}