diff --git a/Codec/allocator.h b/Codec/allocator.h index 148b34c..64b02c6 100644 --- a/Codec/allocator.h +++ b/Codec/allocator.h @@ -31,7 +31,7 @@ #include "../Common/CFHDAllocator.h" -#ifdef _WINDOWS +#ifdef _MSC_VER #ifdef INLINE #undef INLINE diff --git a/Codec/encoder.c b/Codec/encoder.c index 43623d0..0169d08 100644 --- a/Codec/encoder.c +++ b/Codec/encoder.c @@ -1953,12 +1953,13 @@ bool EncodeSample(ENCODER *encoder, uint8_t *data, int width, int height, int pi frame = encoder->frame; assert(frame != NULL); - + /* if(pitch < 0) { data += (display_height - 1) * pitch; pitch = -pitch; } + */ #if DEBUG && 0 { diff --git a/Codec/frame.c b/Codec/frame.c index 70088bc..acdf8d7 100644 --- a/Codec/frame.c +++ b/Codec/frame.c @@ -123,7 +123,7 @@ typedef union } m128i; -FORCEINLINE static int _saturate10u(int x) +INLINE static int _saturate10u(int x) { const int upper_limit = 1023; @@ -134,7 +134,7 @@ FORCEINLINE static int _saturate10u(int x) return x; } -FORCEINLINE static int _saturate12u(int x) +INLINE static int _saturate12u(int x) { const int upper_limit = 4095; diff --git a/Common/CFHDDecoder.h b/Common/CFHDDecoder.h index fa0dc64..448caf1 100644 --- a/Common/CFHDDecoder.h +++ b/Common/CFHDDecoder.h @@ -263,6 +263,10 @@ CFHDDECODER_API CFHD_Error CFHD_GetImageSize(uint32_t imageWidth, uint32_t imageHeight, CFHD_PixelFormat pixelFormat, CFHD_VideoSelect videoselect, CFHD_Stereo3DType stereotype, uint32_t *imageSizeOut); +// Return colorspace flags +CFHDDECODER_API CFHD_Error +CFHD_GetColorFlags(CFHD_DecoderRef decoderRef, int* flagsOut); + // Decode one frame of CineForm HD encoded video CFHDDECODER_API CFHD_Error CFHD_DecodeSample(CFHD_DecoderRef decoderRef, diff --git a/Common/CFHDSampleHeader.h b/Common/CFHDSampleHeader.h index 3993ef5..de30370 100644 --- a/Common/CFHDSampleHeader.h +++ b/Common/CFHDSampleHeader.h @@ -24,6 +24,8 @@ #ifndef _CFHD_SAMPLE_HEADER_H #define _CFHD_SAMPLE_HEADER_H +#include "color.h" + /* @brief Information obtained by parsing the sample header @@ -37,6 +39,7 @@ class CFHD_SampleHeader CFHD_SampleHeader() : m_encodedFormat(CFHD_ENCODED_FORMAT_YUV_422), + m_inputFormat(COLOR_FORMAT_UNKNOWN), m_fieldType(CFHD_FIELD_TYPE_UNKNOWN), m_width(0), m_height(0) @@ -55,6 +58,18 @@ class CFHD_SampleHeader return CFHD_ERROR_OKAY; } + CFHD_Error SetInputFormat(COLOR_FORMAT inputFormat) + { + m_inputFormat = inputFormat; + return CFHD_ERROR_OKAY; + } + + CFHD_Error GetInputFormat(COLOR_FORMAT *inputFormatOut) + { + *inputFormatOut = m_inputFormat; + return CFHD_ERROR_OKAY; + } + CFHD_Error SetFieldType(CFHD_FieldType fieldType) { m_fieldType = fieldType; @@ -82,6 +97,7 @@ class CFHD_SampleHeader private: CFHD_EncodedFormat m_encodedFormat; + COLOR_FORMAT m_inputFormat; CFHD_FieldType m_fieldType; int m_width; int m_height; diff --git a/Common/MessageQueue.h b/Common/MessageQueue.h index f32a95b..b96da90 100644 --- a/Common/MessageQueue.h +++ b/Common/MessageQueue.h @@ -71,7 +71,7 @@ class CMessageSemaphore long count; BOOL result = ReleaseSemaphore(handle, 1, &count); assert(result); - return result; + return result!=0; } return false; } diff --git a/ConvertLib/ImageConverter.cpp b/ConvertLib/ImageConverter.cpp index dcf5a60..5f5adb6 100644 --- a/ConvertLib/ImageConverter.cpp +++ b/ConvertLib/ImageConverter.cpp @@ -31,13 +31,13 @@ #include "ImageConverter.h" //#include "ConvertLib.h" -#if !defined(_WIN64) // certain SIMD instructions are NOT supported in Win64... +//#if !defined(_WIN64) // certain SIMD instructions are NOT supported in Win64... #ifndef _XMMOPT #define _XMMOPT 1 // Use SIMD instructions in this program #endif #define XMMOPT (1 && _XMMOPT) // Use SIMD instructions in this module -#endif +//#endif #if XMMOPT #include // Include support for SSE2 intrinsics diff --git a/ConvertLib/ImageScaler.cpp b/ConvertLib/ImageScaler.cpp index d929334..301d1b6 100644 --- a/ConvertLib/ImageScaler.cpp +++ b/ConvertLib/ImageScaler.cpp @@ -85,12 +85,14 @@ #include "cpuid.h" +/* static int GetProcessorCount() { SYSTEM_INFO cSystem_info; GetSystemInfo(&cSystem_info); return cSystem_info.dwNumberOfProcessors; } +*/ #elif __APPLE__ diff --git a/DecoderSDK/CFHDDecoder.cpp b/DecoderSDK/CFHDDecoder.cpp index f629b9c..c273493 100644 --- a/DecoderSDK/CFHDDecoder.cpp +++ b/DecoderSDK/CFHDDecoder.cpp @@ -487,6 +487,8 @@ CFHD_ParseSampleHeader(void *samplePtr, encodedFormat = CSampleDecoder::EncodedFormat(header.encoded_format); sampleHeader->SetEncodedFormat(encodedFormat); + sampleHeader->SetInputFormat(header.input_format); + fieldType = CSampleDecoder::FieldType(&header); sampleHeader->SetFieldType(fieldType); @@ -681,6 +683,17 @@ CFHD_GetImageSize(uint32_t imageWidth, uint32_t imageHeight, CFHD_PixelFormat pi return CFHD_ERROR_INVALID_ARGUMENT; } +CFHDDECODER_API CFHD_Error +CFHD_GetColorFlags(CFHD_DecoderRef decoderRef, int* flagsOut) +{ + if (flagsOut) + { + CSampleDecoder *decoder = (CSampleDecoder *)decoderRef; + return decoder->GetColorFlags(*flagsOut); + } + return CFHD_ERROR_INVALID_ARGUMENT; +} + /*! @function CFHD_DecodeSample diff --git a/DecoderSDK/SampleDecoder.h b/DecoderSDK/SampleDecoder.h index 1f19ebb..c642b82 100644 --- a/DecoderSDK/SampleDecoder.h +++ b/DecoderSDK/SampleDecoder.h @@ -152,6 +152,12 @@ class CSampleDecoder : public ISampleDecoder CFHD_PixelFormat outputFormat, int decodedResolution); + CFHD_Error GetColorFlags(int &data) + { + data = m_decoder->frame.colorspace; + return CFHD_ERROR_OKAY; + } + protected: #if 0 CFHD_Error PrepareToDecodeBayer(int outputWidth,