Skip to content

Commit 68f2396

Browse files
committed
Fix VideoStitch sample build
1 parent a118570 commit 68f2396

File tree

7 files changed

+33
-29
lines changed

7 files changed

+33
-29
lines changed

amf/public/common/AMFSTL.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
#include <codecvt>
4747
#endif
4848

49+
#if !defined(__APPLE__) && !defined(_WIN32)
50+
#include <malloc.h>
51+
#endif
52+
4953
#pragma warning(disable: 4996)
5054

5155
#if defined(__linux) || defined(__APPLE__)
@@ -684,6 +688,28 @@ void AMF_STD_CALL amf_free(void* ptr)
684688
free(ptr);
685689
}
686690
//----------------------------------------------------------------------------------------
691+
void* AMF_STD_CALL amf_aligned_alloc(size_t count, size_t alignment)
692+
{
693+
#if defined(_WIN32)
694+
return _aligned_malloc(count, alignment);
695+
#elif defined (__APPLE__)
696+
void* p = nullptr;
697+
posix_memalign(&p, alignment, count);
698+
return p;
699+
#elif defined(__linux)
700+
return memalign(alignment, count);
701+
#endif
702+
}
703+
//----------------------------------------------------------------------------------------
704+
void AMF_STD_CALL amf_aligned_free(void* ptr)
705+
{
706+
#if defined(_WIN32)
707+
return _aligned_free(ptr);
708+
#else
709+
return free(ptr);
710+
#endif
711+
}
712+
//----------------------------------------------------------------------------------------
687713
#if defined (__ANDROID__)
688714
template <typename CHAR_T>
689715
static bool isOneOf(CHAR_T p_ch, const CHAR_T* p_set)

amf/public/common/AMFSTL.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ extern "C"
6262
// allocator
6363
void* AMF_STD_CALL amf_alloc(amf_size count);
6464
void AMF_STD_CALL amf_free(void* ptr);
65+
void* AMF_STD_CALL amf_aligned_alloc(size_t count, size_t alignment);
66+
void AMF_STD_CALL amf_aligned_free(void* ptr);
6567
#if defined(__cplusplus)
6668
}
6769
#endif

amf/public/common/Linux/ThreadLinux.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -591,21 +591,6 @@ void AMF_STD_CALL amf_virtual_free(void* ptr)
591591
free(ptr); // according to linux help memory allocated by memalign() must be freed by free()
592592
}
593593
//----------------------------------------------------------------------------------------
594-
void* AMF_STD_CALL amf_aligned_alloc(size_t count, size_t alignment)
595-
{
596-
#if defined(__APPLE__)
597-
void* p = nullptr;
598-
posix_memalign(&p, alignment, count);
599-
return p;
600-
#else
601-
return memalign(alignment, count);
602-
#endif
603-
}
604-
//----------------------------------------------------------------------------------------
605-
void AMF_STD_CALL amf_aligned_free(void* ptr)
606-
{
607-
return free(ptr);
608-
}
609594

610595
amf_handle AMF_STD_CALL amf_load_library(const wchar_t* filename)
611596
{

amf/public/proj/vs2019/VideoStitch/VideoStitch.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@
234234
<ClCompile Include="..\..\..\..\public\common\Thread.cpp" />
235235
<ClCompile Include="..\..\..\..\public\common\TraceAdapter.cpp" />
236236
<ClCompile Include="..\..\..\..\public\common\Windows\ThreadWindows.cpp" />
237-
<ClCompile Include="..\..\..\..\runtime\src\common\windows\OSWrappersWindows.cpp" />
238237
<ClCompile Include="..\..\..\common\Linux\ThreadLinux.cpp" />
239238
<ClCompile Include="..\..\..\src\components\VideoStitch\DirectX11\StitchEngineDX11.cpp" />
240239
<ClCompile Include="..\..\..\src\components\VideoStitch\HistogramImpl.cpp" />

amf/public/proj/vs2019/VideoStitch/VideoStitch.vcxproj.filters

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@
2222
<Filter Include="common">
2323
<UniqueIdentifier>{02f1f550-82ac-4ae6-889b-fe2fddbaf79a}</UniqueIdentifier>
2424
</Filter>
25-
<Filter Include="runtime">
26-
<UniqueIdentifier>{23658dc9-7f81-4be3-9cae-62a67632c47f}</UniqueIdentifier>
27-
</Filter>
28-
<Filter Include="runtime\src">
29-
<UniqueIdentifier>{a3f484db-78f5-4e19-90d5-0307246590cf}</UniqueIdentifier>
30-
</Filter>
31-
<Filter Include="runtime\src\common">
32-
<UniqueIdentifier>{e430efb6-4198-4739-9196-1e291c340e46}</UniqueIdentifier>
33-
</Filter>
3425
</ItemGroup>
3526
<ItemGroup>
3627
<ClInclude Include="..\..\..\..\public\include\core\Buffer.h">
@@ -173,9 +164,6 @@
173164
<ClCompile Include="..\..\..\common\Linux\ThreadLinux.cpp">
174165
<Filter>common</Filter>
175166
</ClCompile>
176-
<ClCompile Include="..\..\..\..\runtime\src\common\windows\OSWrappersWindows.cpp">
177-
<Filter>runtime\src\common</Filter>
178-
</ClCompile>
179167
</ItemGroup>
180168
<ItemGroup>
181169
<CustomBuild Include="..\..\..\src\components\VideoStitch\DirectX11\StitchD3D11.hlsl">

amf/public/src/components/VideoStitch/DirectX11/StitchEngineDX11.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ using namespace DirectX;
5252
#define ALPHA_BLEND_ENABLED 1
5353
#define HIST_SIZE 256
5454

55+
inline static amf_uint32 AlignValue(amf_uint32 value, amf_uint32 alignment)
56+
{
57+
return ((value + (alignment - 1)) & ~(alignment - 1));
58+
}
5559

5660
extern XMVECTOR MakeSphere(XMVECTOR src, float centerX,float centerY,float centerZ, float newRadius);
5761

amf/public/src/components/VideoStitch/StitchEngineBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
#include "public/include/core/Trace.h"
3535
#include "public/include/core/Context.h"
3636
#include "public/common/InterfaceImpl.h"
37+
#include "public/common/AMFSTL.h"
3738
#include "public/include/components/VideoStitch.h"
3839
#include "HistogramImpl.h"
3940
#include <DirectXMath.h>
4041

4142
#include <vector>
42-
#include <runtime/include/core/Typedefs.h>
4343

4444
//#define DEBUG_TRANSPARENT
4545
namespace amf

0 commit comments

Comments
 (0)