#include <common/assert.h>\r
#include <common/gl/gl_check.h>\r
#include <common/concurrency/async.h>\r
-#include <common/memory/memcpy.h>\r
+#include <common/memory/array.h>\r
\r
#include <core/frame/frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <gl/glew.h>\r
\r
#include <tbb/cache_aligned_allocator.h>\r
+#include <tbb/parallel_for.h>\r
#include <tbb/parallel_for_each.h>\r
#include <tbb/concurrent_queue.h>\r
\r
#include <boost/thread/future.hpp>\r
\r
#include <algorithm>\r
-#include <stdint.h>\r
+#include <cstdint>\r
#include <vector>\r
\r
#if defined(_MSC_VER)\r
\r
#include <common/gl/gl_check.h>\r
#include <common/concurrency/async.h>\r
-#include <common/memory/memcpy.h>\r
+#include <common/memory/array.h>\r
\r
#include <core/frame/frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <common/spl/memory.h>\r
#include <common/enum_class.h>\r
\r
-#include <stdint.h>\r
+#include <cstdint>\r
\r
namespace caspar { namespace accelerator { namespace ogl {\r
\r
#include <common/assert.h>\r
#include <common/except.h>\r
#include <common/concurrency/async.h>\r
+#include <common/memory/array.h>\r
#include <common/gl/gl_check.h>\r
#include <common/os/windows/windows.h>\r
\r
+\r
#include <boost/foreach.hpp>\r
\r
#include <gl/glew.h>\r
<ClInclude Include="forward.h" />\r
<ClInclude Include="gl\gl_check.h" />\r
<ClInclude Include="log.h" />\r
+ <ClInclude Include="memory\array.h" />\r
<ClInclude Include="memory\memcpy.h" />\r
<ClInclude Include="memory\memshfl.h" />\r
<ClInclude Include="memory\page_locked_allocator.h" />\r
</ClCompile>\r
<ClCompile Include="log.cpp" />\r
<ClCompile Include="env.cpp" />\r
+ <ClCompile Include="memory\array.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
<ClCompile Include="memory\page_locked_allocator.cpp">\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<ClCompile Include="memory\page_locked_allocator.cpp">\r
<Filter>source\memory</Filter>\r
</ClCompile>\r
+ <ClCompile Include="memory\array.cpp">\r
+ <Filter>source\memory</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="compiler\vs\disable_silly_warnings.h">\r
<ClInclude Include="param.h">\r
<Filter>source</Filter>\r
</ClInclude>\r
+ <ClInclude Include="memory\array.h">\r
+ <Filter>source\memory</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
--- /dev/null
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
+#include "../stdafx.h"\r
+\r
+#include "array.h"\r
+\r
+namespace caspar { namespace core {\r
+ \r
+const_array::const_array(const const_array& other)\r
+ : ptr_(other.ptr_)\r
+ , size_(other.size_)\r
+ , storage_(other.storage_)\r
+{\r
+}\r
+\r
+const_array::const_array(const_array&& other)\r
+ : ptr_(other.ptr_)\r
+ , size_(other.size_)\r
+ , storage_(std::move(other.storage_))\r
+{\r
+}\r
+\r
+const_array& const_array::operator=(const_array other)\r
+{\r
+ other.swap(*this);\r
+ return *this;\r
+}\r
+\r
+void const_array::swap(const_array& other)\r
+{\r
+ std::swap(ptr_, other.ptr_);\r
+ std::swap(size_, other.size_);\r
+ std::swap(storage_, other.storage_);\r
+}\r
+ \r
+const std::uint8_t* const_array::begin() const {return ptr_;} \r
+const std::uint8_t* const_array::data() const {return ptr_;}\r
+const std::uint8_t* const_array::end() const {return ptr_ + size_;}\r
+std::size_t const_array::size() const {return size_;}\r
+bool const_array::empty() const {return size() == 0;}\r
+\r
+mutable_array::mutable_array(mutable_array&& other)\r
+ : ptr_(other.ptr_)\r
+ , size_(other.size_)\r
+ , storage_(std::move(other.storage_))\r
+{\r
+}\r
+ \r
+mutable_array& mutable_array::operator=(mutable_array&& other)\r
+{\r
+ ptr_ = other.ptr_;\r
+ size_ = other.size_;\r
+ storage_ = std::move(other.storage_);\r
+ return *this;\r
+}\r
+ \r
+std::uint8_t* mutable_array::begin() {return ptr_;} \r
+std::uint8_t* mutable_array::data() {return ptr_;}\r
+std::uint8_t* mutable_array::end() {return ptr_ + size_;} \r
+const std::uint8_t* mutable_array::begin() const {return ptr_;} \r
+const std::uint8_t* mutable_array::data() const {return ptr_;}\r
+const std::uint8_t* mutable_array::end() const {return ptr_ + size_;}\r
+std::size_t mutable_array::size() const {return size_;}\r
+bool mutable_array::empty() const {return size() == 0;}\r
+const boost::any& mutable_array::storage() const {return *storage_;}\r
+\r
+}}
\ No newline at end of file
--- /dev/null
+#pragma once\r
+\r
+#include "../spl/memory.h"\r
+#include "../forward.h"\r
+\r
+#include <boost/any.hpp>\r
+\r
+#include <cstddef>\r
+#include <cstdint>\r
+\r
+FORWARD1(boost, template<typename> class shared_future);\r
+\r
+namespace caspar { namespace core {\r
+\r
+class const_array\r
+{\r
+public:\r
+\r
+ // Static Members\r
+\r
+ // Constructors\r
+\r
+ template<typename T>\r
+ explicit const_array(const std::uint8_t* ptr, std::size_t size, T&& storage)\r
+ : ptr_(ptr)\r
+ , size_(size)\r
+ , storage_(new boost::any(std::forward<T>(storage)))\r
+ {\r
+ }\r
+ \r
+ const_array(const const_array& other);\r
+ const_array(const_array&& other);\r
+\r
+ // Methods\r
+\r
+ const_array& operator=(const_array other);\r
+ void swap(const_array& other);\r
+\r
+ // Properties\r
+ \r
+ const std::uint8_t* begin() const;\r
+ const std::uint8_t* data() const;\r
+ const std::uint8_t* end() const;\r
+ std::size_t size() const;\r
+ bool empty() const;\r
+ \r
+private:\r
+ const std::uint8_t* ptr_;\r
+ std::size_t size_;\r
+ spl::shared_ptr<boost::any> storage_;\r
+};\r
+\r
+class mutable_array\r
+{\r
+ mutable_array(const mutable_array&);\r
+ mutable_array& operator=(const mutable_array&);\r
+public:\r
+\r
+ // Static Members\r
+\r
+ // Constructors\r
+ \r
+ template<typename T>\r
+ explicit mutable_array(std::uint8_t* ptr, std::size_t size, T&& storage)\r
+ : ptr_(ptr)\r
+ , size_(size)\r
+ , storage_(new boost::any(std::forward<T>(storage)))\r
+ {\r
+ }\r
+\r
+ mutable_array(mutable_array&& other);\r
+\r
+ // Methods\r
+\r
+ mutable_array& operator=(mutable_array&& other);\r
+\r
+ // Properties\r
+ \r
+ std::uint8_t* begin();\r
+ std::uint8_t* data();\r
+ std::uint8_t* end();\r
+ const std::uint8_t* begin() const;\r
+ const std::uint8_t* data() const;\r
+ const std::uint8_t* end() const;\r
+ std::size_t size() const;\r
+ bool empty() const;\r
+ const boost::any& storage() const;\r
+private:\r
+ std::uint8_t* ptr_;\r
+ std::size_t size_;\r
+ spl::unique_ptr<boost::any> storage_;\r
+};\r
+\r
+}}
\ No newline at end of file
#pragma once\r
\r
#include <intrin.h>\r
-#include <stdint.h>\r
+#include <cstdint>\r
\r
#include <array>\r
\r
#include "frame.h"\r
\r
#include <common/except.h>\r
+#include <common/memory/array.h>\r
+\r
#include <core/frame/frame_visitor.h>\r
#include <core/frame/pixel_format.h>\r
\r
#include <tbb/cache_aligned_allocator.h>\r
\r
#include <cstddef>\r
-#include <stdint.h>\r
+#include <cstdint>\r
\r
FORWARD1(boost, template<typename> class shared_future);\r
\r
namespace caspar { namespace core {\r
\r
-class const_array\r
-{\r
-public:\r
-\r
- // Static Members\r
-\r
- // Constructors\r
-\r
- template<typename T>\r
- explicit const_array(const uint8_t* ptr, std::size_t size, T&& storage)\r
- : ptr_(ptr)\r
- , size_(size)\r
- , storage_(new boost::any(std::forward<T>(storage)))\r
- {\r
- }\r
- \r
- const_array(const const_array& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(other.storage_)\r
- {\r
- }\r
-\r
- const_array(const_array&& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(std::move(other.storage_))\r
- {\r
- }\r
-\r
- // Methods\r
-\r
- const_array& operator=(const_array other)\r
- {\r
- other.swap(*this);\r
- return *this;\r
- }\r
-\r
- void swap(const_array& other)\r
- {\r
- std::swap(ptr_, other.ptr_);\r
- std::swap(size_, other.size_);\r
- std::swap(storage_, other.storage_);\r
- }\r
-\r
- // Properties\r
- \r
- const uint8_t* begin() const {return ptr_;} \r
- const uint8_t* data() const {return ptr_;}\r
- const uint8_t* end() const {return ptr_ + size_;}\r
- std::size_t size() const {return size_;}\r
- bool empty() const {return size() == 0;}\r
- \r
-private:\r
- const uint8_t* ptr_;\r
- std::size_t size_;\r
- spl::shared_ptr<boost::any> storage_;\r
-};\r
-\r
-class mutable_array\r
-{\r
- mutable_array(const mutable_array&);\r
- mutable_array& operator=(const mutable_array&);\r
-public:\r
-\r
- // Static Members\r
-\r
- // Constructors\r
- \r
- template<typename T>\r
- explicit mutable_array(uint8_t* ptr, std::size_t size, T&& storage)\r
- : ptr_(ptr)\r
- , size_(size)\r
- , storage_(new boost::any(std::forward<T>(storage)))\r
- {\r
- }\r
-\r
- mutable_array(mutable_array&& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(std::move(other.storage_))\r
- {\r
- }\r
-\r
- // Methods\r
-\r
- mutable_array& operator=(mutable_array&& other)\r
- {\r
- ptr_ = other.ptr_;\r
- size_ = other.size_;\r
- storage_ = std::move(other.storage_);\r
- return *this;\r
- }\r
-\r
- // Properties\r
- \r
- uint8_t* begin() {return ptr_;} \r
- uint8_t* data() {return ptr_;}\r
- uint8_t* end() {return ptr_ + size_;} \r
- const uint8_t* begin() const {return ptr_;} \r
- const uint8_t* data() const {return ptr_;}\r
- const uint8_t* end() const {return ptr_ + size_;}\r
- std::size_t size() const {return size_;}\r
- bool empty() const {return size() == 0;}\r
- const boost::any& storage() const {return *storage_;}\r
-private:\r
- uint64_t id_;\r
- uint8_t* ptr_;\r
- std::size_t size_;\r
- spl::unique_ptr<boost::any> storage_;\r
-};\r
+class const_array;\r
+class mutable_array;\r
\r
typedef std::vector<int32_t, tbb::cache_aligned_allocator<int32_t>> audio_buffer;\r
\r
\r
#include <algorithm>\r
#include <vector>\r
-#include <stdint.h>\r
+#include <cstdint>\r
\r
#include <tbb/cache_aligned_allocator.h>\r
\r
\r
#include <boost/range.hpp>\r
\r
-#include <stdint.h>\r
+#include <cstdint>\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
FORWARD2(caspar, core, struct pixel_format_desc);\r
#include <core/frame/pixel_format.h>\r
\r
#include <common/except.h>\r
+#include <common/memory/array.h>\r
\r
#include <boost/algorithm/string.hpp>\r
\r
#include <common/spl/memory.h>\r
#include <common/enum_class.h>\r
\r
-#include <stdint.h>\r
+#include <cstdint>\r
#include <limits>\r
#include <functional>\r
#include <string>\r
\r
#include <common/concurrency/executor.h>\r
#include <common/diagnostics/graph.h>\r
+#include <common/memory/array.h>\r
#include <common/memory/memshfl.h>\r
\r
#include <core/consumer/frame_consumer.h>\r
#include <common/diagnostics/graph.h>\r
#include <common/except.h>\r
#include <common/memory/memshfl.h>\r
+#include <common/memory/array.h>\r
\r
#include <core/consumer/frame_consumer.h>\r
\r
#include <core/video_format.h>\r
\r
#include <common/env.h>\r
+#include <common/utf.h>\r
+#include <common/param.h>\r
#include <common/concurrency/executor.h>\r
#include <common/diagnostics/graph.h>\r
+#include <common/memory/array.h>\r
#include <common/spl/memory.h>\r
-#include <common/utf.h>\r
-#include <common/param.h>\r
\r
#include <boost/algorithm/string.hpp>\r
#include <boost/timer.hpp>\r
#include <core/producer/frame_producer.h>\r
\r
#include <common/except.h>\r
+#include <common/memory/array.h>\r
\r
#include <tbb/parallel_for.h>\r
\r
#include <common/concurrency/lock.h>\r
#include <common/diagnostics/graph.h>\r
#include <common/prec_timer.h>\r
+#include <common/memory/array.h>\r
\r
#include <boost/filesystem.hpp>\r
#include <boost/property_tree/ptree.hpp>\r
#include <common/env.h>\r
#include <common/log.h>\r
#include <common/utf.h>\r
+#include <common/memory/array.h>\r
\r
#include <core/consumer/frame_consumer.h>\r
#include <core/video_format.h>\r
\r
#include <common/env.h>\r
#include <common/log.h>\r
+#include <common/memory/array.h>\r
\r
#include <boost/assign.hpp>\r
#include <boost/filesystem.hpp>\r
#include <common/env.h>\r
#include <common/log.h>\r
#include <common/except.h>\r
+#include <common/memory/array.h>\r
\r
#include <boost/assign.hpp>\r
#include <boost/filesystem.hpp>\r
#include <common/gl/gl_check.h>\r
#include <common/log.h>\r
#include <common/spl/memory.h>\r
+#include <common/memory/array.h>\r
#include <common/memory/memshfl.h>\r
#include <common/utf.h>\r
\r