]> git.sesse.net Git - casparcg/commitdiff
2.0. image_mixer: - Renderer is now properly and fully pre-multiplied. - Removed...
authorRonag <Ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 19 Aug 2011 18:47:23 +0000 (18:47 +0000)
committerRonag <Ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 19 Aug 2011 18:47:23 +0000 (18:47 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1236 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

core/mixer/image/image_kernel.cpp
core/mixer/image/image_mixer.cpp
core/mixer/image/image_shader.cpp
core/producer/transition/transition_producer.cpp
modules/decklink/interop/DeckLinkAPI_h.h
modules/decklink/interop/DeckLinkAPI_i.c
shell/casparcg.config

index bd75820e058b4d51ccf19540ed62e6f5af763d27..4db822a480045a0e2ba9cde4480f178341d5a1fc 100644 (file)
@@ -111,6 +111,7 @@ struct image_kernel::implementation : boost::noncopyable
                shader_->set("has_local_key",   local_key);\r
                shader_->set("has_layer_key",   layer_key);\r
                shader_->set("pixel_format",    item.pix_desc.pix_fmt); \r
+               shader_->set("opacity",                 item.transform.get_opacity());  \r
                \r
                // Setup blend_func\r
                \r
@@ -126,15 +127,16 @@ struct image_kernel::implementation : boost::noncopyable
                        switch(item.transform.get_blend_mode())\r
                        {\r
                        case image_transform::blend_mode::add:                  \r
-                               ogl.blend_func_separate(GL_ONE, GL_ONE, GL_ONE, GL_ONE);\r
+                               ogl.blend_func_separate(GL_ONE, GL_ONE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);\r
                                break;\r
                        case image_transform::blend_mode::replace:                      \r
                                ogl.blend_func_separate(GL_ONE, GL_ZERO, GL_ONE, GL_ONE);\r
                                break;\r
                        case image_transform::blend_mode::screen:\r
-                               ogl.blend_func_separate(GL_ONE, GL_ONE_MINUS_SRC_COLOR, GL_ONE, GL_ONE);\r
+                               ogl.blend_func_separate(GL_ONE, GL_ONE_MINUS_SRC_COLOR, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);\r
+                       case image_transform::blend_mode::normal:\r
                        default:\r
-                               ogl.blend_func_separate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);\r
+                               ogl.blend_func_separate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);\r
                                break;\r
                        }\r
                }\r
@@ -190,7 +192,7 @@ struct image_kernel::implementation : boost::noncopyable
                \r
                ogl.viewport(0, 0, background->width(), background->height());\r
 \r
-               GL(glColor4d(item.transform.get_gain(), item.transform.get_gain(), item.transform.get_gain(), item.transform.get_is_key() ? 1.0 : item.transform.get_opacity()));\r
+               GL(glColor4d(item.transform.get_gain(), item.transform.get_gain(), item.transform.get_gain(), item.transform.get_opacity()));\r
                                                \r
                auto m_p = item.transform.get_clip_translation();\r
                auto m_s = item.transform.get_clip_scale();\r
index c01e801b9833f1a022ad2869bdb5fa5900715b9a..ee84d8806be722d224ce8cff1f66c7601f77883d 100644 (file)
@@ -152,31 +152,33 @@ public:
 \r
                std::pair<int, std::shared_ptr<device_buffer>> local_key_buffer;\r
                                        \r
-               if(has_overlapping_items(layer, layer.front().transform.get_blend_mode()))\r
-               {\r
-                       auto local_draw_buffer = create_device_buffer(4);       \r
-\r
-                       int mode = 0;\r
-                       BOOST_FOREACH(auto& item, layer)\r
-                       {\r
-                               if(mode & item.mode)\r
-                                       item.transform.set_blend_mode(image_transform::blend_mode::normal); // Disable blending, it will be used when merging back into render stack.\r
-                               else\r
-                               {\r
-                                       item.transform.set_blend_mode(image_transform::blend_mode::replace); // Target field is empty, no blending\r
-                                       mode |= item.mode;\r
-                               }\r
-\r
-                               draw_item(std::move(item), local_draw_buffer, local_key_buffer, layer_key_buffer);              \r
-                       }\r
-\r
-                       kernel_.draw(channel_.ogl(), create_render_item(local_draw_buffer, layer.front().transform.get_blend_mode()), draw_buffer, nullptr, nullptr);\r
-               }\r
-               else // fast path\r
-               {\r
+               //if(has_overlapping_items(layer, layer.front().transform.get_blend_mode()))\r
+               //{\r
+               //      auto local_draw_buffer = create_device_buffer(4);       \r
+\r
+               //      auto local_blend_mode = layer.front().transform.get_blend_mode();\r
+\r
+               //      int fields = 0;\r
+               //      BOOST_FOREACH(auto& item, layer)\r
+               //      {\r
+               //              if(fields & item.mode)\r
+               //                      item.transform.set_blend_mode(image_transform::blend_mode::normal); // Disable blending, it will be used when merging back into render stack.\r
+               //              else\r
+               //              {\r
+               //                      item.transform.set_blend_mode(image_transform::blend_mode::replace); // Target field is empty, no blending, just copy\r
+               //                      fields |= item.mode;\r
+               //              }\r
+\r
+               //              draw_item(std::move(item), local_draw_buffer, local_key_buffer, layer_key_buffer);              \r
+               //      }\r
+\r
+               //      kernel_.draw(channel_.ogl(), create_render_item(local_draw_buffer, local_blend_mode), draw_buffer, nullptr, nullptr);\r
+               //}\r
+               //else // fast path\r
+               //{\r
                        BOOST_FOREACH(auto& item, layer)                \r
                                draw_item(std::move(item), draw_buffer, local_key_buffer, layer_key_buffer);            \r
-               }                                       \r
+               //}                                     \r
 \r
                CASPAR_ASSERT(local_key_buffer.first == 0 || local_key_buffer.first == core::video_mode::progressive);\r
 \r
index 23f7666d2f0ac6b9f842d12750aa39e1c4576354..77a3704585e971c693e545fb2935b763038f1440 100644 (file)
@@ -73,8 +73,8 @@ std::string get_blend_color_func()
        "         return fore;                                                                                                                          \n"\r
        "   vec4 back = texture2D(background, gl_TexCoord[1].st).bgra;                                          \n"\r
        "       fore.rgb = get_blend_color(back.rgb, fore.rgb);                                                                 \n"\r
-       "       return vec4(mix(back.rgb, fore.rgb, fore.a), back.a + fore.a);                                  \n"\r
-       "}                                                                                                                                                                      \n";\r
+       "       return fore + (1.0-fore.a)*back;                                                                                                \n"\r
+       "}                                                                                                                                                                      \n";                    \r
 }\r
                \r
 std::string get_simple_blend_color_func()\r
@@ -99,7 +99,6 @@ std::string get_vertex()
        "{                                                                                                                                                                      \n"\r
        "       gl_TexCoord[0] = gl_MultiTexCoord0;                                                                                             \n"\r
        "       gl_TexCoord[1] = gl_MultiTexCoord1;                                                                                             \n"\r
-       "       gl_FrontColor  = gl_Color;                                                                                                              \n"\r
        "       gl_Position    = ftransform();                                                                                                  \n"\r
        "}                                                                                                                                                                      \n";\r
 }\r
@@ -120,6 +119,7 @@ std::string get_fragment(bool blend_modes)
        "uniform int            blend_mode;                                                                                                             \n"\r
        "uniform int            pixel_format;                                                                                                   \n"\r
        "                                                                                                                                                                       \n"\r
+       "uniform float          opacity;                                                                                                                \n"\r
        "uniform bool           levels;                                                                                                                 \n"\r
        "uniform float          min_input;                                                                                                              \n"\r
        "uniform float          max_input;                                                                                                              \n"\r
@@ -239,10 +239,10 @@ std::string get_fragment(bool blend_modes)
        "       if(csb)                                                                                                                                                 \n"\r
        "               color.rgb = ContrastSaturationBrightness(color.rgb, brt, sat, con);                     \n"\r
        "       if(has_local_key)                                                                                                                               \n"\r
-       "               color.a *= texture2D(local_key, gl_TexCoord[1].st).r;                                           \n"\r
+       "               color *= texture2D(local_key, gl_TexCoord[1].st).r;                                                     \n"\r
        "       if(has_layer_key)                                                                                                                               \n"\r
-       "               color.a *= texture2D(layer_key, gl_TexCoord[1].st).r;                                           \n"\r
-       "   color *= gl_Color;                                                                                                                          \n"\r
+       "               color *= texture2D(layer_key, gl_TexCoord[1].st).r;                                                     \n"\r
+       "       color *= opacity;                                                                                                                               \n"\r
        "       color = blend(color);                                                                                                                   \n"\r
        "       gl_FragColor = color.bgra;                                                                                                              \n"\r
        "}                                                                                                                                                                      \n";\r
index ca8092644a9d3fb0454c0cf5832057a1915e393a..6fe58ec62ebc9578d7e7ee0c8fd79a0165b8efee 100644 (file)
@@ -65,7 +65,7 @@ struct transition_producer : public frame_producer
 \r
        virtual safe_ptr<basic_frame> receive(int hints)\r
        {\r
-               if(current_frame_++ >= info_.duration)\r
+               if(++current_frame_ >= info_.duration)\r
                        return basic_frame::eof();\r
                \r
                auto dest = basic_frame::empty();\r
@@ -129,15 +129,15 @@ struct transition_producer : public frame_producer
                d_frame1->get_audio_transform().set_has_audio(false);\r
                d_frame2->get_audio_transform().set_gain(delta2);\r
 \r
-               if(info_.type == transition::mix)\r
-               {\r
-                       d_frame1->get_image_transform().set_opacity(delta1);    \r
-                       d_frame2->get_image_transform().set_opacity(delta2);\r
+               //if(info_.type == transition::mix)\r
+               //{\r
+               //      d_frame1->get_image_transform().set_opacity(delta1);    \r
+               //      d_frame2->get_image_transform().set_opacity(delta2);\r
 \r
-                       s_frame1->get_image_transform().set_opacity(1.0-delta1);        \r
-                       s_frame2->get_image_transform().set_opacity(1.0-delta2);                \r
-               }\r
-               else if(info_.type == transition::slide)\r
+               //      s_frame1->get_image_transform().set_opacity(1.0-delta1);        \r
+               //      s_frame2->get_image_transform().set_opacity(1.0-delta2);                \r
+               //}\r
+               if(info_.type == transition::slide)\r
                {\r
                        d_frame1->get_image_transform().set_fill_translation((-1.0+delta1)*dir, 0.0);   \r
                        d_frame2->get_image_transform().set_fill_translation((-1.0+delta2)*dir, 0.0);           \r
index c5c63cdae0add52ff52b753b7487650576e3f6a1..3939157dc39c5f1c1a16e4f5f3b8719a23180915 100644 (file)
@@ -4,7 +4,7 @@
 \r
 \r
  /* File created by MIDL compiler version 7.00.0555 */\r
-/* at Fri Jul 29 10:16:40 2011\r
+/* at Thu Aug 18 20:53:57 2011\r
  */\r
 /* Compiler settings for interop\DeckLinkAPI.idl:\r
     Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
index e9a1eda90c20d61f92b13c891f97e9b8a2da6312..0d54c148d3425ff0ae2dbf0a9bad5a319513903f 100644 (file)
@@ -6,7 +6,7 @@
 \r
 \r
  /* File created by MIDL compiler version 7.00.0555 */\r
-/* at Fri Jul 29 10:16:40 2011\r
+/* at Thu Aug 18 20:53:57 2011\r
  */\r
 /* Compiler settings for interop\DeckLinkAPI.idl:\r
     Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
index c39dd970ef4fc663ce0230a1c5ee54b0baef2a09..5b6f1bd91b43d90d7eaa2ce824663fd48372a6e9 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>\r
 <configuration>\r
   <paths>\r
-    <media-path>L:\\casparcg\\_media\\</media-path>\r
+    <media-path>C:\Lokala Filer\server\branches\2.0.0.2\bin\_media</media-path>\r
     <log-path>L:\\casparcg\\_log\\</log-path>\r
     <data-path>L:\\casparcg\\_data\\</data-path>\r
     <template-path>L:\\casparcg\\_templates\\</template-path>\r
     <channel>\r
       <video-mode>720p5000</video-mode>\r
       <consumers>\r
-        <decklink>\r
-          <device>1</device>\r
-          <low-latency>true</low-latency>\r
-          <embedded-audio>true</embedded-audio>\r
-        </decklink>\r
         <screen>\r
-          <device>1</device>\r
-          <key-only>true</key-only>\r
+          <key-only>false</key-only>\r
         </screen>\r
       </consumers>\r
     </channel>\r