diff --git a/README.chromium b/README.chromium index 7dbebaa56..586f93550 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 949 +Version: 950 License: BSD License File: LICENSE diff --git a/include/libyuv/basic_types.h b/include/libyuv/basic_types.h index 51b15f876..12d61d6b6 100644 --- a/include/libyuv/basic_types.h +++ b/include/libyuv/basic_types.h @@ -98,6 +98,10 @@ typedef signed char int8; #endif // __GNUC__ #endif // LIBYUV_API +#define LIBYUV_BOOL int +#define LIBYUV_FALSE 0 +#define LIBYUV_TRUE 1 + // Visual C x86 or GCC little endian. #if defined(__x86_64__) || defined(_M_X64) || \ defined(__i386__) || defined(_M_IX86) || \ diff --git a/include/libyuv/cpu_id.h b/include/libyuv/cpu_id.h index 79da994c7..dc858a814 100644 --- a/include/libyuv/cpu_id.h +++ b/include/libyuv/cpu_id.h @@ -20,7 +20,7 @@ extern "C" { // TODO(fbarchard): Consider overlapping bits for different architectures. // Internal flag to indicate cpuid requires initialization. -static const int kCpuInit = 0x1; +#define kCpuInit 0x1 // These flags are only valid on ARM processors. static const int kCpuHasARM = 0x2; diff --git a/include/libyuv/mjpeg_decoder.h b/include/libyuv/mjpeg_decoder.h index 7bb82fce1..14bdef199 100644 --- a/include/libyuv/mjpeg_decoder.h +++ b/include/libyuv/mjpeg_decoder.h @@ -11,10 +11,9 @@ #ifndef INCLUDE_LIBYUV_MJPEG_DECODER_H_ // NOLINT #define INCLUDE_LIBYUV_MJPEG_DECODER_H_ -#ifdef __cplusplus - #include "libyuv/basic_types.h" +#ifdef __cplusplus // NOTE: For a simplified public API use convert.h MJPGToI420(). struct jpeg_common_struct; @@ -23,7 +22,15 @@ struct jpeg_source_mgr; namespace libyuv { -bool ValidateJpeg(const uint8* sample, size_t sample_size); +#ifdef __cplusplus +extern "C" { +#endif + +LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size); + +#ifdef __cplusplus +} // extern "C" +#endif static const uint32 kUnknownDataSize = 0xFFFFFFFF; diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 83ea87def..9a2d799fb 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 949 +#define LIBYUV_VERSION 950 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/cpu_id.cc b/source/cpu_id.cc index 872a117a4..0c26aa23a 100644 --- a/source/cpu_id.cc +++ b/source/cpu_id.cc @@ -48,7 +48,7 @@ LIBYUV_API void CpuId(uint32 info_eax, uint32 info_ecx, uint32* cpu_info) { #if defined(_MSC_VER) #if (_MSC_FULL_VER >= 160040219) - __cpuidex(reinterpret_cast(cpu_info), info_eax, info_ecx); + __cpuidex((int*)(cpu_info), info_eax, info_ecx); #elif defined(_M_IX86) __asm { mov eax, info_eax @@ -62,7 +62,7 @@ void CpuId(uint32 info_eax, uint32 info_ecx, uint32* cpu_info) { } #else if (info_ecx == 0) { - __cpuid(reinterpret_cast(cpu_info), info_eax); + __cpuid((int*)(cpu_info), info_eax); } else { cpu_info[3] = cpu_info[2] = cpu_info[1] = cpu_info[0] = 0; } @@ -94,7 +94,7 @@ void CpuId(uint32 info_eax, uint32 info_ecx, uint32* cpu_info) { int TestOsSaveYmm() { uint32 xcr0 = 0u; #if defined(_MSC_VER) && (_MSC_FULL_VER >= 160040219) - xcr0 = static_cast(_xgetbv(0)); // VS2010 SP1 required. + xcr0 = (uint32)(_xgetbv(0)); // VS2010 SP1 required. #elif defined(_M_IX86) __asm { xor ecx, ecx // xcr 0 @@ -162,18 +162,18 @@ int cpu_info_ = kCpuInit; // cpu_info is not initialized yet. // to disable. Zero ignored to make it easy to set the variable on/off. #if !defined(__native_client__) && !defined(_M_ARM) -static bool TestEnv(const char* name) { +static LIBYUV_BOOL TestEnv(const char* name) { const char* var = getenv(name); if (var) { if (var[0] != '0') { - return true; + return LIBYUV_TRUE; } } - return false; + return LIBYUV_FALSE; } #else // nacl does not support getenv(). -static bool TestEnv(const char*) { - return false; +static LIBYUV_BOOL TestEnv(const char*) { + return LIBYUV_FALSE; } #endif diff --git a/source/mjpeg_validate.cc b/source/mjpeg_validate.cc index 1d0aeebd1..23d22d099 100644 --- a/source/mjpeg_validate.cc +++ b/source/mjpeg_validate.cc @@ -10,32 +10,38 @@ #include "libyuv/mjpeg_decoder.h" +#ifdef __cplusplus namespace libyuv { +extern "C" { +#endif // Helper function to validate the jpeg appears intact. // TODO(fbarchard): Optimize case where SOI is found but EOI is not. -bool ValidateJpeg(const uint8* sample, size_t sample_size) { +LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size) { + size_t i; if (sample_size < 64) { // ERROR: Invalid jpeg size: sample_size - return false; + return LIBYUV_FALSE; } if (sample[0] != 0xff || sample[1] != 0xd8) { // Start Of Image // ERROR: Invalid jpeg initial start code - return false; + return LIBYUV_FALSE; } - for (int i = static_cast(sample_size) - 2; i > 1;) { + for (i = sample_size - 2; i > 1;) { if (sample[i] != 0xd9) { if (sample[i] == 0xff && sample[i + 1] == 0xd9) { // End Of Image - return true; + return LIBYUV_TRUE; // Success: Valid jpeg. } --i; } --i; } // ERROR: Invalid jpeg end code not found. Size sample_size - return false; + return LIBYUV_FALSE; } +#ifdef __cplusplus +} // extern "C" } // namespace libyuv - +#endif diff --git a/source/video_common.cc b/source/video_common.cc index b13c8407e..efbedf46e 100644 --- a/source/video_common.cc +++ b/source/video_common.cc @@ -16,14 +16,14 @@ namespace libyuv { extern "C" { #endif -#define ARRAY_SIZE(x) (static_cast((sizeof(x) / sizeof(x[0])))) +#define ARRAY_SIZE(x) (int)(sizeof(x) / sizeof(x[0])) struct FourCCAliasEntry { uint32 alias; uint32 canonical; }; -static const FourCCAliasEntry kFourCCAliases[] = { +static const struct FourCCAliasEntry kFourCCAliases[] = { {FOURCC_IYUV, FOURCC_I420}, {FOURCC_YU16, FOURCC_I422}, {FOURCC_YU24, FOURCC_I444}, @@ -47,7 +47,8 @@ static const FourCCAliasEntry kFourCCAliases[] = { LIBYUV_API uint32 CanonicalFourCC(uint32 fourcc) { - for (int i = 0; i < ARRAY_SIZE(kFourCCAliases); ++i) { + int i; + for (i = 0; i < ARRAY_SIZE(kFourCCAliases); ++i) { if (kFourCCAliases[i].alias == fourcc) { return kFourCCAliases[i].canonical; }