]> git.sesse.net Git - casparcg/blobdiff - core/frame/frame_transform.cpp
[ffmpeg] Ported 2.0.7 ffmpeg producer to 2.1.0 while still keeping the usage of the...
[casparcg] / core / frame / frame_transform.cpp
index e93d3a7c563af2603237769cd22e042161feffec..4ba1899202eea6d4daca30d18753c03145785d6f 100644 (file)
@@ -91,11 +91,17 @@ image_transform& image_transform::operator*=(const image_transform &other)
        levels.min_output                = std::max(levels.min_output, other.levels.min_output);
        levels.max_output                = std::min(levels.max_output, other.levels.max_output);
        levels.gamma                    *= other.levels.gamma;
+       chroma.key                               = std::max(chroma.key, other.chroma.key);
+       chroma.threshold                += other.chroma.threshold;
+       chroma.softness                 += other.chroma.softness;
+       chroma.spill                    += other.chroma.spill;
        field_mode                               = field_mode & other.field_mode;
        is_key                                  |= other.is_key;
        is_mix                                  |= other.is_mix;
        is_still                                |= other.is_still;
        use_mipmap                              |= other.use_mipmap;
+       blend_mode                               = std::max(blend_mode, other.blend_mode);
+       layer_depth                             += other.layer_depth;
 
        return *this;
 }
@@ -130,7 +136,7 @@ void do_tween_corners(const corners& source, const corners& dest, corners& out,
 };
 
 image_transform image_transform::tween(double time, const image_transform& source, const image_transform& dest, double duration, const tweener& tween)
-{      
+{
        image_transform result; 
 
        result.brightness                       = do_tween(time, source.brightness,                             dest.brightness,                        duration, tween);
@@ -153,11 +159,17 @@ image_transform image_transform::tween(double time, const image_transform& sourc
        result.levels.max_output        = do_tween(time, source.levels.max_output,              dest.levels.max_output,         duration, tween);
        result.levels.min_output        = do_tween(time, source.levels.min_output,              dest.levels.min_output,         duration, tween);
        result.levels.gamma                     = do_tween(time, source.levels.gamma,                   dest.levels.gamma,                      duration, tween);
+       result.chroma.threshold         = do_tween(time, source.chroma.threshold,               dest.chroma.threshold,          duration, tween);
+       result.chroma.softness          = do_tween(time, source.chroma.softness,                dest.chroma.softness,           duration, tween);
+       result.chroma.spill                     = do_tween(time, source.chroma.spill,                   dest.chroma.spill,                      duration, tween);
+       result.chroma.key                       = dest.chroma.key;
        result.field_mode                       = source.field_mode & dest.field_mode;
        result.is_key                           = source.is_key | dest.is_key;
        result.is_mix                           = source.is_mix | dest.is_mix;
        result.is_still                         = source.is_still | dest.is_still;
        result.use_mipmap                       = source.use_mipmap | dest.use_mipmap;
+       result.blend_mode                       = std::max(source.blend_mode, dest.blend_mode);
+       result.layer_depth                      = dest.layer_depth;
 
        do_tween_rectangle(source.crop, dest.crop, result.crop, time, duration, tween);
        do_tween_corners(source.perspective, dest.perspective, result.perspective, time, duration, tween);
@@ -204,6 +216,8 @@ bool operator==(const image_transform& lhs, const image_transform& rhs)
                lhs.is_mix == rhs.is_mix &&
                lhs.is_still == rhs.is_still &&
                lhs.use_mipmap == rhs.use_mipmap &&
+               lhs.blend_mode == rhs.blend_mode &&
+               lhs.layer_depth == rhs.layer_depth &&
                lhs.crop == rhs.crop &&
                lhs.perspective == rhs.perspective;
 }
@@ -282,6 +296,34 @@ bool operator!=(const frame_transform& lhs, const frame_transform& rhs)
        return !(lhs == rhs);
 }
 
+
+core::chroma::type get_chroma_mode(const std::wstring& str)
+{
+       if (boost::iequals(str, L"none"))
+               return core::chroma::type::none;
+       else if (boost::iequals(str, L"green"))
+               return core::chroma::type::green;
+       else if (boost::iequals(str, L"blue"))
+               return core::chroma::type::blue;
+       else
+               CASPAR_THROW_EXCEPTION(user_error() << msg_info("chroma mode has to be one of none, green or blue"));
+}
+
+std::wstring get_chroma_mode(core::chroma::type type)
+{
+       switch (type)
+       {
+       case core::chroma::type::none:
+               return L"none";
+       case core::chroma::type::green:
+               return L"green";
+       case core::chroma::type::blue:
+               return L"blue";
+       default:
+               CASPAR_THROW_EXCEPTION(programming_error() << msg_info("Unhandled enum constant"));
+       };
+}
+
 namespace detail {
 
 boost::thread_specific_ptr<double>& get_thread_local_aspect_ratio()