clang-format: Apply formatting

Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
This commit is contained in:
jp9000
2019-06-22 22:13:45 -07:00
parent 53615ee10f
commit f53df7da64
567 changed files with 34068 additions and 32903 deletions

View File

@@ -28,38 +28,79 @@ Copyright(c) 2005-2014 Intel Corporation. All Rights Reserved.
// =================================================================
// Helper macro definitions...
#define MSDK_PRINT_RET_MSG(ERR) {PrintErrString(ERR, __FILE__, __LINE__);}
#define MSDK_CHECK_RESULT(P, X, ERR) {if ((X) > (P)) {MSDK_PRINT_RET_MSG(ERR); return ERR;}}
#define MSDK_CHECK_POINTER(P, ERR) {if (!(P)) {MSDK_PRINT_RET_MSG(ERR); return ERR;}}
#define MSDK_CHECK_ERROR(P, X, ERR) {if ((X) == (P)) {MSDK_PRINT_RET_MSG(ERR); return ERR;}}
#define MSDK_IGNORE_MFX_STS(P, X) {if ((X) == (P)) {P = MFX_ERR_NONE;}}
#define MSDK_BREAK_ON_ERROR(P) {if (MFX_ERR_NONE != (P)) break;}
#define MSDK_SAFE_DELETE_ARRAY(P) {if (P) {delete[] P; P = NULL;}}
#define MSDK_ALIGN32(X) (((mfxU32)((X)+31)) & (~ (mfxU32)31))
#define MSDK_ALIGN16(value) (((value + 15) >> 4) << 4)
#define MSDK_SAFE_RELEASE(X) {if (X) { X->Release(); X = NULL; }}
#define MSDK_MAX(A, B) (((A) > (B)) ? (A) : (B))
#define MSDK_PRINT_RET_MSG(ERR) \
{ \
PrintErrString(ERR, __FILE__, __LINE__); \
}
#define MSDK_CHECK_RESULT(P, X, ERR) \
{ \
if ((X) > (P)) { \
MSDK_PRINT_RET_MSG(ERR); \
return ERR; \
} \
}
#define MSDK_CHECK_POINTER(P, ERR) \
{ \
if (!(P)) { \
MSDK_PRINT_RET_MSG(ERR); \
return ERR; \
} \
}
#define MSDK_CHECK_ERROR(P, X, ERR) \
{ \
if ((X) == (P)) { \
MSDK_PRINT_RET_MSG(ERR); \
return ERR; \
} \
}
#define MSDK_IGNORE_MFX_STS(P, X) \
{ \
if ((X) == (P)) { \
P = MFX_ERR_NONE; \
} \
}
#define MSDK_BREAK_ON_ERROR(P) \
{ \
if (MFX_ERR_NONE != (P)) \
break; \
}
#define MSDK_SAFE_DELETE_ARRAY(P) \
{ \
if (P) { \
delete[] P; \
P = NULL; \
} \
}
#define MSDK_ALIGN32(X) (((mfxU32)((X) + 31)) & (~(mfxU32)31))
#define MSDK_ALIGN16(value) (((value + 15) >> 4) << 4)
#define MSDK_SAFE_RELEASE(X) \
{ \
if (X) { \
X->Release(); \
X = NULL; \
} \
}
#define MSDK_MAX(A, B) (((A) > (B)) ? (A) : (B))
// Usage of the following two macros are only required for certain Windows DirectX11 use cases
#define WILL_READ 0x1000
#define WILL_READ 0x1000
#define WILL_WRITE 0x2000
// =================================================================
// Intel Media SDK memory allocator entrypoints....
// Implementation of this functions is OS/Memory type specific.
mfxStatus simple_alloc(mfxHDL pthis, mfxFrameAllocRequest* request, mfxFrameAllocResponse* response);
mfxStatus simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr);
mfxStatus simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr);
mfxStatus simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL* handle);
mfxStatus simple_free(mfxHDL pthis, mfxFrameAllocResponse* response);
mfxStatus simple_alloc(mfxHDL pthis, mfxFrameAllocRequest *request,
mfxFrameAllocResponse *response);
mfxStatus simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr);
mfxStatus simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr);
mfxStatus simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL *handle);
mfxStatus simple_free(mfxHDL pthis, mfxFrameAllocResponse *response);
// =================================================================
// Utility functions, not directly tied to Media SDK functionality
//
void PrintErrString(int err,const char* filestr,int line);
void PrintErrString(int err, const char *filestr, int line);
// LoadRawFrame: Reads raw frame from YUV file (YV12) into NV12 surface
// - YV12 is a more common format for YUV files than NV12 (therefore the conversion during read and write)
@@ -67,35 +108,38 @@ void PrintErrString(int err,const char* filestr,int line);
// LoadRawRGBFrame: Reads raw RGB32 frames from file into RGB32 surface
// - For the simulation case (fSource = NULL), the surface is filled with default image data
mfxStatus LoadRawFrame(mfxFrameSurface1* pSurface, FILE* fSource);
mfxStatus LoadRawRGBFrame(mfxFrameSurface1* pSurface, FILE* fSource);
mfxStatus LoadRawFrame(mfxFrameSurface1 *pSurface, FILE *fSource);
mfxStatus LoadRawRGBFrame(mfxFrameSurface1 *pSurface, FILE *fSource);
// Write raw YUV (NV12) surface to YUV (YV12) file
mfxStatus WriteRawFrame(mfxFrameSurface1* pSurface, FILE* fSink);
mfxStatus WriteRawFrame(mfxFrameSurface1 *pSurface, FILE *fSink);
// Write bit stream data for frame to file
mfxStatus WriteBitStreamFrame(mfxBitstream* pMfxBitstream, FILE* fSink);
mfxStatus WriteBitStreamFrame(mfxBitstream *pMfxBitstream, FILE *fSink);
// Read bit stream data from file. Stream is read as large chunks (= many frames)
mfxStatus ReadBitStreamData(mfxBitstream* pBS, FILE* fSource);
mfxStatus ReadBitStreamData(mfxBitstream *pBS, FILE *fSource);
void ClearYUVSurfaceSysMem(mfxFrameSurface1* pSfc, mfxU16 width, mfxU16 height);
void ClearYUVSurfaceSysMem(mfxFrameSurface1 *pSfc, mfxU16 width, mfxU16 height);
void ClearYUVSurfaceVMem(mfxMemId memId);
void ClearRGBSurfaceVMem(mfxMemId memId);
// Get free raw frame surface
int GetFreeSurfaceIndex(mfxFrameSurface1** pSurfacesPool, mfxU16 nPoolSize);
int GetFreeSurfaceIndex(mfxFrameSurface1 **pSurfacesPool, mfxU16 nPoolSize);
// For use with asynchronous task management
typedef struct {
mfxBitstream mfxBS;
mfxSyncPoint syncp;
mfxBitstream mfxBS;
mfxSyncPoint syncp;
} Task;
// Get free task
int GetFreeTaskIndex(Task* pTaskPool, mfxU16 nPoolSize);
int GetFreeTaskIndex(Task *pTaskPool, mfxU16 nPoolSize);
// Initialize Intel Media SDK Session, device/display and memory manager
mfxStatus Initialize(mfxIMPL impl, mfxVersion ver, MFXVideoSession* pSession, mfxFrameAllocator* pmfxAllocator, mfxHDL *deviceHandle = NULL, bool bCreateSharedHandles = false, bool dx9hack = false);
mfxStatus Initialize(mfxIMPL impl, mfxVersion ver, MFXVideoSession *pSession,
mfxFrameAllocator *pmfxAllocator,
mfxHDL *deviceHandle = NULL,
bool bCreateSharedHandles = false, bool dx9hack = false);
// Release resources (device/display)
void Release();
@@ -103,7 +147,7 @@ void Release();
// Convert frame type to string
char mfxFrameTypeString(mfxU16 FrameType);
void mfxGetTime(mfxTime* timestamp);
void mfxGetTime(mfxTime *timestamp);
//void mfxInitTime(); might need this for Windows
double TimeDiffMsec(mfxTime tfinish, mfxTime tstart);