<ClInclude Include="io\SocketInfo.h" />\r
<ClInclude Include="log\log.h" />\r
<ClInclude Include="stdafx.h" />\r
- <ClInclude Include="utility\find_file.h" />\r
- <ClInclude Include="utility\memory.h" />\r
<ClInclude Include="utility\scope_exit.h" />\r
<ClInclude Include="utility\string_convert.h" />\r
</ItemGroup>\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>\r
</ClCompile>\r
- <ClCompile Include="utility\find_file.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
- <ClCompile Include="utility\memory.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
</ItemGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
<ClCompile Include="concurrency\Thread.cpp">\r
<Filter>Source\concurrency</Filter>\r
</ClCompile>\r
- <ClCompile Include="utility\find_file.cpp">\r
- <Filter>Source\utility</Filter>\r
- </ClCompile>\r
- <ClCompile Include="utility\memory.cpp">\r
- <Filter>Source\utility</Filter>\r
- </ClCompile>\r
<ClCompile Include="gl\frame_buffer_object.cpp">\r
<Filter>Source\gl</Filter>\r
</ClCompile>\r
<ClInclude Include="utility\scope_exit.h">\r
<Filter>Source\utility</Filter>\r
</ClInclude>\r
- <ClInclude Include="utility\find_file.h">\r
- <Filter>Source\utility</Filter>\r
- </ClInclude>\r
- <ClInclude Include="utility\memory.h">\r
- <Filter>Source\utility</Filter>\r
- </ClInclude>\r
<ClInclude Include="gl\pixel_buffer_object.h">\r
<Filter>Source\gl</Filter>\r
</ClInclude>\r
\r
#include "../../common/exception/exceptions.h"\r
#include "../../common/gl/utility.h"\r
-#include "../../common/utility/memory.h"\r
\r
namespace caspar { namespace common { namespace gl {\r
\r
+++ /dev/null
-#include "../stdafx.h"\r
-\r
-#include "find_file.h"\r
-\r
-#include <boost/filesystem.hpp>\r
-\r
-#include <string>\r
-#include <algorithm>\r
-\r
-namespace caspar { namespace common {\r
-\r
-std::wstring find_file(const std::wstring& filename, const std::vector<std::wstring> extensions)\r
-{\r
- auto it = std::find_if(extensions.cbegin(), extensions.cend(), [&](const std::wstring& extension) -> bool\r
- { \r
- auto filePath = boost::filesystem::wpath(filename);\r
- filePath.replace_extension(extension);\r
- return boost::filesystem::exists(filePath) && boost::filesystem::is_regular_file(filePath);\r
- });\r
-\r
- return it != extensions.end() ? filename + L"." + *it : L"";\r
-}\r
-\r
-}}
\ No newline at end of file
+++ /dev/null
-#pragma once\r
-\r
-#include <string>\r
-#include <vector>\r
-\r
-namespace caspar { namespace common {\r
-\r
-std::wstring find_file(const std::wstring& filename, const std::vector<std::wstring> extensions);\r
-\r
-}}
\ No newline at end of file
+++ /dev/null
-#include "../stdafx.h"\r
-\r
-#include "memory.h"\r
-\r
-#include <intrin.h>\r
-\r
-#include <tbb/parallel_for.h>\r
-#include <tbb/blocked_range.h>\r
-\r
-namespace caspar { namespace common {\r
- \r
-void* aligned_memcpy(void* dest, const void* source, size_t num)\r
-{ \r
- if(num < 128)\r
- return memcpy(dest, source, num);\r
-\r
- size_t r = num % 128;\r
- num -= r;\r
-\r
- __asm\r
- {\r
- mov esi, source; \r
- mov edi, dest; \r
- \r
- mov ebx, num; \r
- shr ebx, 7; \r
- \r
- cpy:\r
- prefetchnta [esi+80h];\r
- \r
- movdqa xmm0, [esi+00h];\r
- movdqa xmm1, [esi+10h];\r
- movdqa xmm2, [esi+20h];\r
- movdqa xmm3, [esi+30h];\r
- \r
- movntdq [edi+00h], xmm0;\r
- movntdq [edi+10h], xmm1;\r
- movntdq [edi+20h], xmm2;\r
- movntdq [edi+30h], xmm3;\r
- \r
- prefetchnta [esi+0C0h];\r
- \r
- movdqa xmm4, [esi+40h];\r
- movdqa xmm5, [esi+50h];\r
- movdqa xmm6, [esi+60h];\r
- movdqa xmm7, [esi+70h];\r
- \r
- movntdq [edi+40h], xmm4;\r
- movntdq [edi+50h], xmm5;\r
- movntdq [edi+60h], xmm6;\r
- movntdq [edi+70h], xmm7;\r
- \r
- lea edi, [edi+80h];\r
- lea esi, [esi+80h];\r
- dec ebx;\r
- \r
- jnz cpy;\r
- }\r
-\r
- return r == 0 ? dest : memcpy(reinterpret_cast<char*>(dest) + num, reinterpret_cast<const char*>(source) + num, r);\r
-}\r
-\r
-void* aligned_parallel_memcpy(void* dest, const void* source, size_t num)\r
-{ \r
- if(num < 128)\r
- return memcpy(dest, source, num);\r
-\r
- tbb::parallel_for(tbb::blocked_range<size_t>(0, num/128), [&](const tbb::blocked_range<size_t>& r)\r
- {\r
- aligned_memcpy(reinterpret_cast<char*>(dest) + r.begin()*128, reinterpret_cast<const char*>(source) + r.begin()*128, r.size()*128);\r
- });\r
-\r
- return dest;\r
-}\r
-\r
-void* clear(void* dest, size_t size)\r
-{\r
- tbb::parallel_for(tbb::blocked_range<size_t>(0, size/16), [&](const tbb::blocked_range<size_t>& r)\r
- {\r
- __m128i val = _mm_setzero_si128();\r
- __m128i* ptr = reinterpret_cast<__m128i*>(dest)+r.begin();\r
- __m128i* end = ptr + r.size();\r
-\r
- while(ptr != end) \r
- _mm_stream_si128(ptr++, val);\r
- }); \r
- return dest;\r
-}\r
-\r
-}}
\ No newline at end of file
+++ /dev/null
-#pragma once\r
-\r
-namespace caspar { namespace common {\r
- \r
-void* aligned_memcpy(void* dest, const void* source, size_t size);\r
-void* aligned_parallel_memcpy(void* dest, const void* source, size_t size);\r
-void* clear(void* dest, size_t size);\r
-\r
-}}
\ No newline at end of file
#include "DeckLinkAPI_h.h"\r
\r
#include "../../format/video_format.h"\r
-#include "../../../common/utility/memory.h"\r
\r
#include "../../producer/frame_producer_device.h"\r
\r
std::shared_ptr<DecklinkVideoFrame> pTempFrame = GetReservedFrame();\r
if(pTempFrame && frame->size() == pTempFrame->size())\r
{\r
- common::aligned_parallel_memcpy(pTempFrame->data(), frame->data(), pTempFrame->size());\r
+ memcpy(pTempFrame->data(), frame->data(), pTempFrame->size());\r
DoRender(pTempFrame);\r
}\r
else\r
\r
#include "../../format/video_format.h"\r
#include "../../processor/frame.h"\r
-#include "../../../common/utility/memory.h"\r
#include "../../../common/gl/utility.h"\r
#include "../../../common/gl/pixel_buffer_object.h"\r
\r
int next_index = (index_ + 1) % 2;\r
\r
auto ptr = pbos_[index_].end_write();\r
- common::aligned_parallel_memcpy(ptr, frame->data(), format_desc_.size);\r
+ memcpy(ptr, frame->data(), format_desc_.size);\r
\r
GL(glClear(GL_COLOR_BUFFER_BIT)); \r
pbos_[next_index].bind_texture(); \r
\r
#include "composite_frame.h"\r
#include "../../common/gl/utility.h"\r
-#include "../../common/utility/memory.h"\r
\r
#include <boost/range/algorithm.hpp>\r
#include <boost/range/algorithm_ext/erase.hpp>\r
\r
#include "frame.h"\r
#include "../format/pixel_format.h"\r
-#include "../../common/utility/memory.h"\r
#include "../../common/gl/utility.h"\r
#include "../../common/gl/pixel_buffer_object.h"\r
\r
\r
#include "audio_decoder.h"\r
\r
-#include "../../../../common/utility/memory.h"\r
-\r
#include <queue>\r
\r
#include <tbb/cache_aligned_allocator.h>\r
#include "video/video_transformer.h"\r
\r
#include "../../format/video_format.h"\r
-#include "../../../common/utility/find_file.h"\r
-#include "../../../common/utility/memory.h"\r
#include "../../../common/utility/scope_exit.h"\r
#include "../../server.h"\r
\r
};\r
\r
frame_producer_ptr create_ffmpeg_producer(const std::vector<std::wstring>& params)\r
-{\r
- std::wstring filename = params[0];\r
- std::wstring result_filename = common::find_file(server::media_folder() + filename, list_of(L"mpg")(L"avi")(L"mov")(L"dv")(L"wav")(L"mp3")(L"mp4")(L"f4v")(L"flv"));\r
- if(result_filename.empty())\r
+{ \r
+ static const std::vector<std::wstring> extensions = list_of(L"mpg")(L"avi")(L"mov")(L"dv")(L"wav")(L"mp3")(L"mp4")(L"f4v")(L"flv");\r
+ std::wstring filename = server::media_folder() + L"\\" + params[0];\r
+ \r
+ auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool\r
+ { \r
+ return boost::filesystem::is_regular_file(boost::filesystem::wpath(filename).replace_extension(ex));\r
+ });\r
+\r
+ if(ext == extensions.end())\r
return nullptr;\r
\r
- return std::make_shared<ffmpeg_producer>(result_filename, params);\r
+ return std::make_shared<ffmpeg_producer>(filename + L"." + *ext, params);\r
}\r
\r
}}}
\ No newline at end of file
#include "input.h"\r
\r
#include "../../format/video_format.h"\r
-#include "../../../common/utility/memory.h"\r
#include "../../../common/utility/scope_exit.h"\r
\r
#include <tbb/concurrent_queue.h>\r
#include "video_transformer.h"\r
\r
#include "../../../format/video_format.h"\r
-#include "../../../../common/utility/memory.h"\r
-#include "../../../processor/frame.h"\r
#include "../../../processor/frame.h"\r
#include "../../../processor/frame_processor_device.h"\r
\r
\r
#include "cg_producer.h"\r
\r
-#include "../../../common/utility/find_file.h"\r
#include "../../processor/frame.h"\r
#include "../../server.h"\r
\r
\r
frame_producer_ptr create_ct_producer(const std::vector<std::wstring>& params) \r
{\r
- std::wstring filename = params[0];\r
- std::wstring result_filename = common::find_file(server::media_folder() + filename, list_of(L"ct"));\r
- if(result_filename.empty())\r
- return nullptr;\r
+ static const std::vector<std::wstring> extensions = list_of(L"ct");\r
+ std::wstring filename = server::media_folder() + L"\\" + params[0];\r
\r
- std::wstring fixed_filename = result_filename;\r
- std::wstring::size_type pos = 0;\r
- while((pos = fixed_filename.find(TEXT('\\'), pos)) != std::wstring::npos) \r
- fixed_filename[pos] = TEXT('/');\r
+ auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool\r
+ { \r
+ return boost::filesystem::is_regular_file(boost::filesystem::wpath(filename).replace_extension(ex));\r
+ });\r
+\r
+ if(ext == extensions.end())\r
+ return nullptr;\r
\r
- cg_producer_ptr cg_producer(new cg_producer());\r
- cg_producer->add(0, filename, 1);\r
- return cg_producer;\r
+ auto producer = std::make_shared<cg_producer>();\r
+ producer->add(0, filename, 1);\r
+ return producer;\r
}\r
\r
}\r
#include "bitmap.h"\r
\r
#include "../../format/video_format.h"\r
-#include "../../../common/utility/find_file.h"\r
#include "../../server.h"\r
#include "../../../common/concurrency/executor.h"\r
-#include "../../../common/utility/memory.h"\r
#include "../../../common/utility/scope_exit.h"\r
\r
#include "../../processor/frame.h"\r
bitmap_ptr frame; \r
if(current_frame_ == nullptr) \r
current_frame_ = std::make_shared<bitmap>(format_desc.width, format_desc.height);\r
- common::clear(current_frame_->data(), current_frame_->size());\r
+ memset(current_frame_->data(), 0, current_frame_->size());\r
\r
flashax_container_->DrawControl(current_frame_->hdc());\r
} \r
\r
auto frame = frame_processor_->create_frame(format_desc.width, format_desc.height);\r
- common::aligned_parallel_memcpy(frame->data(), current_frame_->data(), current_frame_->size()); \r
+ memcpy(frame->data(), current_frame_->data(), current_frame_->size()); \r
\r
return frame;\r
}\r
\r
flash_producer_ptr create_flash_producer(const std::vector<std::wstring>& params)\r
{\r
- // TODO: Check for flash support\r
- auto filename = params[0];\r
- std::wstring result_filename = common::find_file(server::media_folder() + filename, list_of(L"swf"));\r
+ static const std::vector<std::wstring> extensions = list_of(L"swf");\r
+ std::wstring filename = server::media_folder() + L"\\" + params[0];\r
+ \r
+ auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool\r
+ { \r
+ return boost::filesystem::is_regular_file(boost::filesystem::wpath(filename).replace_extension(ex));\r
+ });\r
+\r
+ if(ext == extensions.end())\r
+ return nullptr;\r
\r
- return result_filename.empty() ? nullptr : std::make_shared<flash_producer>(result_filename);\r
+ return std::make_shared<flash_producer>(filename + L"." + *ext);\r
}\r
\r
}}}
\ No newline at end of file
#include "../processor/composite_frame.h"\r
\r
#include "../../common/utility/scope_exit.h"\r
-#include "../../common/utility/memory.h"\r
\r
#include <boost/thread.hpp>\r
#include <boost/range/algorithm_ext/erase.hpp>\r
#include "../../../common/exception/Exceptions.h"\r
\r
#include "../../processor/frame.h"\r
-#include "../../../common/utility/memory.h"\r
\r
#if defined(_MSC_VER)\r
#pragma warning (disable : 4714) // marked as __forceinline not inlined\r
#include "../../processor/frame_processor_device.h"\r
#include "../../format/video_format.h"\r
#include "../../server.h"\r
-#include "../../../common/utility/find_file.h"\r
-#include "../../../common/utility/memory.h"\r
\r
#include <boost/assign.hpp>\r
\r
auto bitmap = load_image(filename_);\r
FreeImage_FlipVertical(bitmap.get());\r
auto frame = frame_processor->create_frame(FreeImage_GetWidth(bitmap.get()), FreeImage_GetHeight(bitmap.get()));\r
- common::aligned_parallel_memcpy(frame->data(), FreeImage_GetBits(bitmap.get()), frame->size());\r
+ memcpy(frame->data(), FreeImage_GetBits(bitmap.get()), frame->size());\r
frame_ = frame;\r
}\r
\r
\r
frame_producer_ptr create_image_producer(const std::vector<std::wstring>& params)\r
{\r
- std::wstring filename = params[0];\r
- std::wstring resultFilename = common::find_file(server::media_folder() + filename, list_of(L"png")(L"tga")(L"bmp")(L"jpg")(L"jpeg"));\r
- if(!resultFilename.empty())\r
- return std::make_shared<image_producer>(resultFilename);\r
+ static const std::vector<std::wstring> extensions = list_of(L"png")(L"tga")(L"bmp")(L"jpg")(L"jpeg");\r
+ std::wstring filename = server::media_folder() + L"\\" + params[0];\r
+ \r
+ auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool\r
+ { \r
+ return boost::filesystem::is_regular_file(boost::filesystem::wpath(filename).replace_extension(ex));\r
+ });\r
+\r
+ if(ext == extensions.end())\r
+ return nullptr;\r
\r
- return nullptr;\r
+ return std::make_shared<image_producer>(filename + L"." + *ext);\r
}\r
\r
}}}
\ No newline at end of file
#include "../../format/video_format.h"\r
#include "../../processor/frame_processor_device.h"\r
#include "../../server.h"\r
-#include "../../../common/utility/find_file.h"\r
-#include "../../../common/utility/memory.h"\r
\r
#include <tbb/parallel_for.h>\r
#include <tbb/parallel_invoke.h>\r
image_height_ = std::max(height, format_desc_.height);\r
\r
image_ = std::shared_ptr<unsigned char>(static_cast<unsigned char*>(scalable_aligned_malloc(image_width_*image_height_*4, 16)));\r
- common::clear(image_.get(), image_width_*image_height_*4);\r
+ memset(image_.get(), 0, image_width_*image_height_*4);\r
\r
unsigned char* pBits = FreeImage_GetBits(pBitmap.get());\r
\r
for (size_t i = 0; i < height; ++i)\r
- common::aligned_parallel_memcpy(&image_.get()[i * image_width_ * 4], &pBits[i* width * 4], width * 4);\r
+ memcpy(&image_.get()[i * image_width_ * 4], &pBits[i* width * 4], width * 4);\r
}\r
\r
frame_ptr do_render_frame()\r
{\r
frame_ptr frame = frame_processor_->create_frame(format_desc_.width, format_desc_.height);\r
- common::clear(frame->data(), format_desc_.size);\r
+ memset(frame->data(), 0, format_desc_.size);\r
\r
const int delta_x = direction_ == direction::Left ? speed_ : -speed_;\r
const int delta_y = direction_ == direction::Up ? speed_ : -speed_;\r
\r
frame_producer_ptr create_image_scroll_producer(const std::vector<std::wstring>& params)\r
{\r
- std::wstring filename = params[0];\r
- auto result_filename = common::find_file(server::media_folder() + filename, list_of(L"spng")(L"stga")(L"sbmp")(L"sjpg")(L"sjpeg"));\r
- if(!result_filename.empty())\r
- return std::make_shared<image_scroll_producer>(result_filename, params);\r
+ static const std::vector<std::wstring> extensions = list_of(L"spng")(L"stga")(L"sbmp")(L"sjpg")(L"sjpeg");\r
+ std::wstring filename = server::media_folder() + L"\\" + params[0];\r
+ \r
+ auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool\r
+ { \r
+ return boost::filesystem::is_regular_file(boost::filesystem::wpath(filename).replace_extension(ex));\r
+ });\r
+\r
+ if(ext == extensions.end())\r
+ return nullptr;\r
\r
- return nullptr;\r
+ return std::make_shared<image_scroll_producer>(filename + L"." + *ext, params);\r
}\r
\r
}}}
\ No newline at end of file
#include "../../processor/composite_frame.h"\r
#include "../../processor/frame_processor_device.h"\r
\r
-#include "../../../common/utility/memory.h"\r
#include "../../producer/frame_producer_device.h"\r
\r
#include <boost/range/algorithm/copy.hpp>\r