/*****************************************************************************
* osdep.c: platform-specific code
*****************************************************************************
- * Copyright (C) 2003-2013 x264 project
+ * Copyright (C) 2003-2016 x264 project
*
* Authors: Steven Walters <kemuri9@gmail.com>
* Laurent Aimar <fenrir@via.ecp.fr>
}
#endif
-#if HAVE_MMX
-#ifdef __INTEL_COMPILER
-/* Agner's patch to Intel's CPU dispatcher from pages 131-132 of
- * http://agner.org/optimize/optimizing_cpp.pdf (2011-01-30)
- * adapted to x264's cpu schema. */
-
-// Global variable indicating cpu
-int __intel_cpu_indicator = 0;
-// CPU dispatcher function
-void x264_intel_cpu_indicator_init( void )
-{
- unsigned int cpu = x264_cpu_detect();
- if( cpu&X264_CPU_AVX )
- __intel_cpu_indicator = 0x20000;
- else if( cpu&X264_CPU_SSE42 )
- __intel_cpu_indicator = 0x8000;
- else if( cpu&X264_CPU_SSE4 )
- __intel_cpu_indicator = 0x2000;
- else if( cpu&X264_CPU_SSSE3 )
- __intel_cpu_indicator = 0x1000;
- else if( cpu&X264_CPU_SSE3 )
- __intel_cpu_indicator = 0x800;
- else if( cpu&X264_CPU_SSE2 && !(cpu&X264_CPU_SSE2_IS_SLOW) )
- __intel_cpu_indicator = 0x200;
- else if( cpu&X264_CPU_SSE )
- __intel_cpu_indicator = 0x80;
- else if( cpu&X264_CPU_MMX2 )
- __intel_cpu_indicator = 8;
- else
- __intel_cpu_indicator = 1;
-}
-
-/* __intel_cpu_indicator_init appears to have a non-standard calling convention that
- * assumes certain registers aren't preserved, so we'll route it through a function
- * that backs up all the registers. */
-void __intel_cpu_indicator_init( void )
-{
- x264_safe_intel_cpu_indicator_init();
-}
-#else
-void x264_intel_cpu_indicator_init( void )
-{}
-#endif
-#endif
-
#ifdef _WIN32
/* Functions for dealing with Unicode on Windows. */
FILE *x264_fopen( const char *filename, const char *mode )
return -1;
}
+#if !HAVE_WINRT
int x264_vfprintf( FILE *stream, const char *format, va_list arg )
{
HANDLE console = NULL;
{
char buf[4096];
wchar_t buf_utf16[4096];
+ va_list arg2;
+
+ va_copy( arg2, arg );
+ int length = vsnprintf( buf, sizeof(buf), format, arg2 );
+ va_end( arg2 );
- int length = vsnprintf( buf, sizeof(buf), format, arg );
if( length > 0 && length < sizeof(buf) )
{
/* WriteConsoleW is the most reliable way to output Unicode to a console. */
}
return vfprintf( stream, format, arg );
}
+
+int x264_is_pipe( const char *path )
+{
+ wchar_t path_utf16[MAX_PATH];
+ if( utf8_to_utf16( path, path_utf16 ) )
+ return WaitNamedPipeW( path_utf16, 0 );
+ return 0;
+}
+#endif
#endif