Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some corrections for GCC and extra API #10

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Codec/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "../Common/CFHDAllocator.h"


#ifdef _WINDOWS
#ifdef _MSC_VER

#ifdef INLINE
#undef INLINE
Expand Down
3 changes: 2 additions & 1 deletion Codec/encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions Codec/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ typedef union
} m128i;


FORCEINLINE static int _saturate10u(int x)
INLINE static int _saturate10u(int x)
{
const int upper_limit = 1023;

Expand All @@ -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;

Expand Down
4 changes: 4 additions & 0 deletions Common/CFHDDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions Common/CFHDSampleHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Common/MessageQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CMessageSemaphore
long count;
BOOL result = ReleaseSemaphore(handle, 1, &count);
assert(result);
return result;
return result!=0;
}
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions ConvertLib/ImageConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <emmintrin.h> // Include support for SSE2 intrinsics
Expand Down
2 changes: 2 additions & 0 deletions ConvertLib/ImageScaler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@

#include "cpuid.h"

/*
static int GetProcessorCount()
{
SYSTEM_INFO cSystem_info;
GetSystemInfo(&cSystem_info);
return cSystem_info.dwNumberOfProcessors;
}
*/

#elif __APPLE__

Expand Down
13 changes: 13 additions & 0 deletions DecoderSDK/CFHDDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions DecoderSDK/SampleDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down