]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2:
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 3 Nov 2010 23:03:39 +0000 (23:03 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 3 Nov 2010 23:03:39 +0000 (23:03 +0000)
- TransitionProducer: Fixed scalability issues where work was not properly divided
between cores. Transitions with cpu intensive HD videos will now work properly.
- ColorProducer: Is now working.

git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@227 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

core/producer/color/color_producer.cpp
core/producer/transition/transition_producer.cpp
shell/caspar.config
shell/main.cpp
shell/shell.vcxproj

index 256259bb409fd935daba041672473600b9458ef9..0164daecef2f6172ccbfda1f2849a153706165b6 100644 (file)
@@ -32,20 +32,26 @@ namespace caspar { namespace core {
 class color_producer : public frame_producer\r
 {\r
 public:\r
-       explicit color_producer(unsigned long color_value, const frame_format_desc& format_desc) : format_desc_(format_desc){}\r
+       explicit color_producer(unsigned int color_value, const frame_format_desc& format_desc) \r
+               : color_value_(color_value), format_desc_(format_desc){}\r
 \r
-       gpu_frame_ptr get_frame() { return frame_; }\r
+       gpu_frame_ptr get_frame()\r
+       { \r
+               frame_ = factory_->create_frame(format_desc_);\r
+               __stosd(reinterpret_cast<unsigned long*>(frame_->data()), color_value_, frame_->size() / sizeof(unsigned long));\r
+               return frame_;\r
+       }\r
        const frame_format_desc& get_frame_format_desc() const { return format_desc_; }\r
        \r
        void initialize(const frame_factory_ptr& factory)\r
        {\r
-               frame_ = factory->create_frame(format_desc_);\r
-               __stosd(reinterpret_cast<unsigned long*>(frame_->data()), color_value_, frame_->size() / sizeof(unsigned long));\r
+               factory_ = factory;\r
        }\r
 \r
        frame_format_desc format_desc_;\r
        gpu_frame_ptr frame_;\r
-       unsigned long color_value_;\r
+       unsigned int color_value_;\r
+       frame_factory_ptr factory_;\r
 };\r
 \r
 union Color \r
@@ -58,10 +64,10 @@ union Color
                unsigned char b;\r
        } comp;\r
 \r
-       unsigned long value;\r
+       unsigned int value;\r
 };\r
 \r
-unsigned long get_pixel_color_value(const std::wstring& parameter)\r
+unsigned int get_pixel_color_value(const std::wstring& parameter)\r
 {\r
        std::wstring color_code;\r
        if(parameter.length() != 9 || parameter[0] != '#')\r
index e9306781aaa7bd1e441b5621a2b72af1e4a90615..4dcea720e30c0c3b1df19ce3d785af13d4fe1a2e 100644 (file)
@@ -37,7 +37,7 @@ struct transition_producer::implementation : boost::noncopyable
 {\r
        implementation(const frame_producer_ptr& dest, const transition_info& info, \r
                                        const frame_format_desc& format_desc) \r
-               : current_frame_(0), info_(info), format_desc_(format_desc), dest_(dest)\r
+               : current_frame_(0), info_(info), format_desc_(format_desc), dest_producer_(dest)\r
        {\r
                if(!dest)\r
                        BOOST_THROW_EXCEPTION(null_argument() << arg_name_info("dest"));\r
@@ -45,12 +45,12 @@ struct transition_producer::implementation : boost::noncopyable
                \r
        frame_producer_ptr get_following_producer() const\r
        {\r
-               return dest_;\r
+               return dest_producer_;\r
        }\r
        \r
        void set_leading_producer(const frame_producer_ptr& producer)\r
        {\r
-               source_ = producer;\r
+               source_producer_ = producer;\r
        }\r
                \r
        gpu_frame_ptr get_frame()\r
@@ -58,7 +58,16 @@ struct transition_producer::implementation : boost::noncopyable
                if(++current_frame_ >= info_.duration)\r
                        return nullptr;\r
 \r
-               return compose(get_producer_frame(dest_), get_producer_frame(source_));\r
+               gpu_frame_ptr source;\r
+               gpu_frame_ptr dest;\r
+\r
+               tbb::parallel_invoke\r
+               (\r
+                       [&]{dest = get_producer_frame(dest_producer_);},\r
+                       [&]{source = get_producer_frame(source_producer_);}\r
+               );\r
+\r
+               return compose(dest, source);\r
        }\r
 \r
        gpu_frame_ptr get_producer_frame(frame_producer_ptr& producer)\r
@@ -93,18 +102,18 @@ struct transition_producer::implementation : boost::noncopyable
                return frame;\r
        }\r
                        \r
-       gpu_frame_ptr compose(const gpu_frame_ptr& dest_frame, const gpu_frame_ptr& src_frame) \r
+       gpu_frame_ptr compose(const gpu_frame_ptr& dest_producer_frame, const gpu_frame_ptr& src_frame) \r
        {       \r
                if(!src_frame)\r
-                       return dest_frame;\r
+                       return dest_producer_frame;\r
 \r
-               if(info_.type == transition_type::cut || !dest_frame)           \r
+               if(info_.type == transition_type::cut || !dest_producer_frame)          \r
                        return src_frame;\r
                \r
                int volume = static_cast<int>(static_cast<double>(current_frame_)/static_cast<double>(info_.duration)*256.0);\r
                                \r
-               for(size_t n = 0; n < dest_frame->audio_data().size(); ++n)\r
-                       dest_frame->audio_data()[n] = static_cast<short>((static_cast<int>(dest_frame->audio_data()[n])*volume)>>8);\r
+               for(size_t n = 0; n < dest_producer_frame->audio_data().size(); ++n)\r
+                       dest_producer_frame->audio_data()[n] = static_cast<short>((static_cast<int>(dest_producer_frame->audio_data()[n])*volume)>>8);\r
 \r
                for(size_t n = 0; n < src_frame->audio_data().size(); ++n)\r
                        src_frame->audio_data()[n] = static_cast<short>((static_cast<int>(src_frame->audio_data()[n])*(256-volume))>>8);\r
@@ -112,26 +121,26 @@ struct transition_producer::implementation : boost::noncopyable
                float alpha = static_cast<float>(current_frame_)/static_cast<float>(info_.duration);\r
                auto composite = std::make_shared<gpu_composite_frame>();\r
                composite->add(src_frame);\r
-               composite->add(dest_frame);\r
+               composite->add(dest_producer_frame);\r
                if(info_.type == transition_type::mix)\r
-                       dest_frame->alpha(alpha);               \r
+                       dest_producer_frame->alpha(alpha);              \r
                else if(info_.type == transition_type::slide)\r
                {\r
                        if(info_.direction == transition_direction::from_left)                  \r
-                               dest_frame->translate(-1.0f+alpha, 0.0f);                       \r
+                               dest_producer_frame->translate(-1.0f+alpha, 0.0f);                      \r
                        else if(info_.direction == transition_direction::from_right)\r
-                               dest_frame->translate(1.0f-alpha, 0.0f);                        \r
+                               dest_producer_frame->translate(1.0f-alpha, 0.0f);                       \r
                }\r
                else if(info_.type == transition_type::push)\r
                {\r
                        if(info_.direction == transition_direction::from_left)          \r
                        {\r
-                               dest_frame->translate(-1.0f+alpha, 0.0f);\r
+                               dest_producer_frame->translate(-1.0f+alpha, 0.0f);\r
                                src_frame->translate(0.0f+alpha, 0.0f);\r
                        }\r
                        else if(info_.direction == transition_direction::from_right)\r
                        {\r
-                               dest_frame->translate(1.0f-alpha, 0.0f);\r
+                               dest_producer_frame->translate(1.0f-alpha, 0.0f);\r
                                src_frame->translate(0.0f-alpha, 0.0f);\r
                        }\r
                }\r
@@ -139,13 +148,13 @@ struct transition_producer::implementation : boost::noncopyable
                {\r
                        if(info_.direction == transition_direction::from_left)          \r
                        {\r
-                               dest_frame->translate(-1.0f+alpha, 0.0f);\r
-                               dest_frame->texcoords(rectangle(-1.0+alpha, 1.0, alpha, 0.0));\r
+                               dest_producer_frame->translate(-1.0f+alpha, 0.0f);\r
+                               dest_producer_frame->texcoords(rectangle(-1.0+alpha, 1.0, alpha, 0.0));\r
                        }\r
                        else if(info_.direction == transition_direction::from_right)\r
                        {\r
-                               dest_frame->translate(1.0f-alpha, 0.0f);\r
-                               dest_frame->texcoords(rectangle(1.0-alpha, 1.0, 2.0-alpha, 0.0));\r
+                               dest_producer_frame->translate(1.0f-alpha, 0.0f);\r
+                               dest_producer_frame->texcoords(rectangle(1.0-alpha, 1.0, 2.0-alpha, 0.0));\r
                        }\r
                }\r
 \r
@@ -154,14 +163,14 @@ struct transition_producer::implementation : boost::noncopyable
                \r
        void initialize(const frame_factory_ptr& factory)\r
        {\r
-               dest_->initialize(factory);\r
+               dest_producer_->initialize(factory);\r
                factory_ = factory;\r
        }\r
 \r
        const frame_format_desc         format_desc_;\r
 \r
-       frame_producer_ptr                      source_;\r
-       frame_producer_ptr                      dest_;\r
+       frame_producer_ptr                      source_producer_;\r
+       frame_producer_ptr                      dest_producer_;\r
        \r
        unsigned short                          current_frame_;\r
        \r
index 5923723243961a465e419057a1a116a317842e2f..195f1ee0c1d098d5272f658f4620c80b54744321 100644 (file)
@@ -8,7 +8,7 @@
   </paths>\r
   <channels>\r
     <channel>\r
-      <videomode>720p5000</videomode>\r
+      <videomode>PAL</videomode>\r
       <consumers>\r
         <ogl>\r
           <device>1</device>\r
index 04eee18eae23c90ee3867f67ae76a6188d6b5e59..53218af8eab10ade58aba2e17927fd2918437fb6 100644 (file)
@@ -94,17 +94,17 @@ int main(int argc, wchar_t* argv[])
                        std::wstring wcmd;\r
                        std::getline(std::wcin, wcmd); // TODO: It's blocking...\r
                        is_running = wcmd != L"exit" && wcmd != L"q";\r
-                       if(wcmd == L"1")\r
-                               wcmd = L"LOADBG 1-1 DV SLIDE 100 LOOP AUTOPLAY";\r
-                       else if(wcmd == L"2")\r
-                               wcmd = L"LOADBG 1-1 DV PUSH 100 LOOP AUTOPLAY";\r
-                       else if(wcmd == L"3")\r
-                               wcmd = L"LOADBG 1-1 DV MIX 100 LOOP AUTOPLAY";\r
-                       else if(wcmd == L"4")\r
-                               wcmd = L"LOADBG 1-1 DV WIPE 100 LOOP AUTOPLAY";\r
+                       if(wcmd.substr(0, 1) == L"1")\r
+                               wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" SLIDE 100 LOOP AUTOPLAY";\r
+                       else if(wcmd.substr(0, 1) == L"2")\r
+                               wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" PUSH 100 LOOP AUTOPLAY";\r
+                       else if(wcmd.substr(0, 1) == L"3")\r
+                               wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" MIX 100 LOOP AUTOPLAY";\r
+                       else if(wcmd.substr(0, 1) == L"4")\r
+                               wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" WIPE 100 LOOP AUTOPLAY";\r
                        else if(wcmd == L"5")\r
-                               wcmd = L"LOADBG 1-1 DV CUT 100 LOOP AUTOPLAY";\r
-                       else if(wcmd == L"6")\r
+                               wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" CUT 100 LOOP AUTOPLAY";\r
+                       else if(wcmd.substr(0, 1) == L"6")\r
                                wcmd = L"CG 1-2 ADD 1 BBTELEFONARE 1";\r
 \r
                        wcmd += L"\r\n";\r
index cfb39525c96d02339e945941a0b6c46ddc6d82ca..37c152990bfc7e30b3a3be2acee15cd496015f5b 100644 (file)
@@ -25,7 +25,9 @@
     </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
-    <None Include="caspar.config" />\r
+    <None Include="caspar.config">\r
+      <SubType>Designer</SubType>\r
+    </None>\r
   </ItemGroup>\r
   <PropertyGroup Label="Globals">\r
     <ProjectGuid>{8C26C94F-8092-4769-8D84-DEA479721C5B}</ProjectGuid>\r