]> git.sesse.net Git - casparcg/commitdiff
2.1.0: Put "array" into its own file, common/memory/array.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 17 Feb 2012 23:56:10 +0000 (23:56 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 17 Feb 2012 23:56:10 +0000 (23:56 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2443 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

24 files changed:
accelerator/cpu/image/image_mixer.cpp
accelerator/ogl/image/image_mixer.cpp
accelerator/ogl/util/buffer.h
accelerator/ogl/util/device.cpp
common/common.vcxproj
common/common.vcxproj.filters
common/memory/array.cpp [new file with mode: 0644]
common/memory/array.h [new file with mode: 0644]
common/memory/memcpy.h
core/frame/frame.cpp
core/frame/frame.h
core/mixer/audio/audio_util.h
core/mixer/image/image_mixer.h
core/producer/color/color_producer.cpp
core/producer/frame_producer.h
modules/bluefish/consumer/bluefish_consumer.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/ffmpeg/consumer/ffmpeg_consumer.cpp
modules/ffmpeg/producer/util/util.cpp
modules/flash/producer/flash_producer.cpp
modules/image/consumer/image_consumer.cpp
modules/image/producer/image_producer.cpp
modules/image/producer/image_scroll_producer.cpp
modules/screen/consumer/screen_consumer.cpp

index 73b91a5f84c7f470d7bd744dab322fa6d3d2320f..93d933a144d5763fac5f7555017cc3d6c2de9fcf 100644 (file)
@@ -28,7 +28,7 @@
 #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
@@ -42,6 +42,7 @@
 #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
@@ -52,7 +53,7 @@
 #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
index b3e98d68cfb4c2c22474924c56857edb14b118a4..da9d1dfa0cb9941cc0c71ed8d80a4b21a78056e2 100644 (file)
@@ -30,7 +30,7 @@
 \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
index 53159127f1f5fb4b62f29a8f1491e3ab5c5bc258..45d4e6a27f86268b4ebe02be72e334eb54ff3544 100644 (file)
@@ -24,7 +24,7 @@
 #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
index 3b20deef8c8401055f492f243f0d66da36f18e13..f8f3813694a69229bf2fb4cddd954b5e3bafd294 100644 (file)
 #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
index 4a565f9568decad72292ea4c50718710502b1641..602e803756829061871377d920a1ac838b9eba75 100644 (file)
     <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
index 7f677e3abd6d60db3b54804282c7245df8a3a9d2..c63d03e80c75bd77964327ed3b9628c0fbda9976 100644 (file)
@@ -61,6 +61,9 @@
     <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
diff --git a/common/memory/array.cpp b/common/memory/array.cpp
new file mode 100644 (file)
index 0000000..9bdd205
--- /dev/null
@@ -0,0 +1,86 @@
+/*\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
diff --git a/common/memory/array.h b/common/memory/array.h
new file mode 100644 (file)
index 0000000..a206720
--- /dev/null
@@ -0,0 +1,94 @@
+#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
index 09251e8a29b02bcd74cdb6af2439dbc709f0ee2d..5267d8d59e6271a5add108541e646ebc65b6f652 100644 (file)
@@ -1,7 +1,7 @@
 #pragma once\r
 \r
 #include <intrin.h>\r
-#include <stdint.h>\r
+#include <cstdint>\r
 \r
 #include <array>\r
 \r
index 51b5cfaca59dc2d6a06d36bc065934dbfefad0d5..9c3f0384bf401c9777b871b6a9e9fc13da986039 100644 (file)
@@ -24,6 +24,8 @@
 #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
index e26fa1389444a839744d76f5b2af4d1a349f2ae3..0ec210934f915fea858556923ef84e6caf3d32f0 100644 (file)
 #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
index 03180e8c78fc58ce8abc6afb21d30e48685c79e3..2d4edbdc2614a81c07a45e15febe9b2484cdbce8 100644 (file)
@@ -23,7 +23,7 @@
 \r
 #include <algorithm>\r
 #include <vector>\r
-#include <stdint.h>\r
+#include <cstdint>\r
 \r
 #include <tbb/cache_aligned_allocator.h>\r
 \r
index 30988fcddfa65f9067f447742505e6ce410bc588..75eff17a40b84d6f5bf410fdcccef3273cbef4bd 100644 (file)
@@ -33,7 +33,7 @@
 \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
index 9686f139d5d53660f682a7d06cbdc9176ba4ad84..f2e96a37417b7a07531c6935dcb7e2f37354577e 100644 (file)
@@ -30,6 +30,7 @@
 #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
index 6369fcaa23da7358db7cf983699cf313627dc8d3..e5d22e170c1769d40a9f4adea2a823c35c3caf1b 100644 (file)
@@ -28,7 +28,7 @@
 #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
index 9193544b810ee9e1a47c9366cce7b9d9d7b74789..9c1b129137a4499dc99e3d029438cec29b92cd5f 100644 (file)
@@ -30,6 +30,7 @@
 \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
index f8310be5ce989bdc208be51e091f1f63c8689aa5..30416b9faee3ace53bd80784a65c2a64fbf2f58b 100644 (file)
@@ -35,6 +35,7 @@
 #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
index e49518cd035909ab8a107f526d3fb1b9aecbcf8c..733659fb8e5a9f8983613122cbd2ce53c1abc702 100644 (file)
 #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
index 82f5e661ea81e9dc48a3950e2404ac91df2fa730..7677bd807e83af4c7978db066cd95f1c866e1ad5 100644 (file)
@@ -37,6 +37,7 @@
 #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
index d9412fc7bf5bdfd69dc3e985bc55defd106959ae..3e749f53649bfd67865394462e1026b1582c9904 100644 (file)
@@ -41,6 +41,7 @@
 #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
index 9424750630864f0e6d0a3648545583c2ae4167ec..f15ab2a845c77b2bb4cf68b680b906d0f7caee37 100644 (file)
@@ -25,6 +25,7 @@
 #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
index ca9d013158d302bbcd2c81e049f335801b1c2664..e971eb82d9b025894c4da5c7fef6d54fcb059d9b 100644 (file)
@@ -32,6 +32,7 @@
 \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
index 5d138593645e50f5bb8fd6ad77e4d8feb426902d..65bc196df7a87f4a7dc7a5654c70569080361786 100644 (file)
@@ -34,6 +34,7 @@
 #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
index 446dfa30d8afe73faa6a2a79d207835e8529151d..ce33e782697427bbd16a5df21987cdd0de5bccb6 100644 (file)
@@ -28,6 +28,7 @@
 #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