]> git.sesse.net Git - casparcg/commitdiff
psd::producer_factory
authorniklaspandersson <niklas.p.andersson@svt.se>
Thu, 4 Jul 2013 14:12:19 +0000 (16:12 +0200)
committerniklaspandersson <niklas.p.andersson@svt.se>
Thu, 4 Jul 2013 14:12:19 +0000 (16:12 +0200)
15 files changed:
casparcg.sln
common/common.vcxproj
common/common.vcxproj.filters
common/endian.h [new file with mode: 0644]
modules/psd/doc.cpp
modules/psd/doc.h
modules/psd/layer.cpp
modules/psd/layer.h
modules/psd/misc.h
modules/psd/psd.vcxproj
modules/psd/psd.vcxproj.filters
modules/psd/util/bigendian_file_input_stream.cpp
shell/server.cpp
shell/shell.vcxproj
test/psd-test/psd-test.vcxproj

index bfa3d2e9e29f62d5c603b96deec9640e6d54ddc7..b582e83d8e9d2c75ddcab38e09113db387f79099 100644 (file)
@@ -186,26 +186,26 @@ Global
                {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|Win32.ActiveCfg = Release|x64\r
                {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|x64.ActiveCfg = Release|x64\r
                {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|x64.Build.0 = Release|x64\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|Mixed Platforms.Build.0 = Debug|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|Win32.Build.0 = Debug|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|x64.ActiveCfg = Debug|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|Mixed Platforms.ActiveCfg = Release|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|Mixed Platforms.Build.0 = Release|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|Win32.ActiveCfg = Release|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|Win32.Build.0 = Release|Win32\r
-               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|x64.ActiveCfg = Release|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|Mixed Platforms.Build.0 = Debug|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|Win32.Build.0 = Debug|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|x64.ActiveCfg = Debug|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|Mixed Platforms.ActiveCfg = Release|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|Mixed Platforms.Build.0 = Release|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|Win32.ActiveCfg = Release|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|Win32.Build.0 = Release|Win32\r
-               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|x64.ActiveCfg = Release|Win32\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|Mixed Platforms.ActiveCfg = Debug|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|Mixed Platforms.Build.0 = Debug|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|Win32.ActiveCfg = Debug|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|x64.ActiveCfg = Debug|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Debug|x64.Build.0 = Debug|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|Mixed Platforms.ActiveCfg = Release|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|Mixed Platforms.Build.0 = Release|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|Win32.ActiveCfg = Release|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|x64.ActiveCfg = Release|x64\r
+               {866A164B-6F7A-450E-8452-C6AE4E176436}.Release|x64.Build.0 = Release|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|Mixed Platforms.ActiveCfg = Debug|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|Mixed Platforms.Build.0 = Debug|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|Win32.ActiveCfg = Debug|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|x64.ActiveCfg = Debug|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Debug|x64.Build.0 = Debug|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|Mixed Platforms.ActiveCfg = Release|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|Mixed Platforms.Build.0 = Release|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|Win32.ActiveCfg = Release|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|x64.ActiveCfg = Release|x64\r
+               {156C91E0-8CAC-4DBA-A212-AAFDAFACD8BC}.Release|x64.Build.0 = Release|x64\r
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r
index 0a283960a9d2ed6ec1a895e92a90a4bc79b42ac0..4002216e8180460a6b7634d53496605f37c45963 100644 (file)
     <ClInclude Include="compiler\vs\disable_silly_warnings.h" />\r
     <ClInclude Include="compiler\vs\stack_walker.h" />\r
     <ClInclude Include="diagnostics\graph.h" />\r
+    <ClInclude Include="endian.h" />\r
     <ClInclude Include="enum_class.h" />\r
     <ClInclude Include="env.h" />\r
     <ClInclude Include="except.h" />\r
index e76acc960e5e9042227b3be5ec335cbba73a97b9..3914fc76621a8637be092938c6876f7aa32110f4 100644 (file)
     <ClInclude Include="blocking_priority_queue.h">\r
       <Filter>source</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="endian.h">\r
+      <Filter>source</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
diff --git a/common/endian.h b/common/endian.h
new file mode 100644 (file)
index 0000000..6d17d69
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+* Copyright 2013 Sveriges Television AB http://casparcg.com/
+*
+* This file is part of CasparCG (www.casparcg.com).
+*
+* CasparCG is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* CasparCG is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
+*
+* Author: Helge Norberg, helge.norberg@svt.se
+* Author: Robert Nagy, ronag89@gmail.com
+*/
+
+#pragma once
+
+#include <type_traits>
+
+#include <intrin.h>
+
+namespace caspar {
+
+template<typename T>
+typename std::enable_if<sizeof(T) == sizeof(unsigned char), T>::type swap_byte_order(
+               const T& value)
+{
+       return value;
+}
+
+template<typename T>
+typename std::enable_if<sizeof(T) == sizeof(unsigned short), T>::type swap_byte_order(
+               const T& value)
+{
+       auto swapped = _byteswap_ushort(reinterpret_cast<const unsigned short&>(value));
+       return reinterpret_cast<const T&>(swapped);
+}
+
+template<typename T>
+typename std::enable_if<sizeof(T) == sizeof(unsigned long), T>::type swap_byte_order(
+               const T& value)
+{
+       auto swapped = _byteswap_ulong(reinterpret_cast<const unsigned long&>(value));
+    return reinterpret_cast<const T&>(swapped);
+}
+
+template<typename T>
+typename std::enable_if<sizeof(T) == sizeof(unsigned long long), T>::type swap_byte_order(
+               const T& value)
+{
+       auto swapped = _byteswap_uint64(reinterpret_cast<const unsigned long long&>(value));
+    return reinterpret_cast<const T&>(swapped);
+}
+
+}
index 3e73c027dea373a644e652450baf408e98d03137..d15d878754963fd270b3770fc5098c8634b71f68 100644 (file)
 
 namespace caspar { namespace psd {
 
-Document::Document() : channels_(0), width_(0), height_(0), depth_(0), color_mode_(InvalidColorMode)
+psd_document::psd_document() : channels_(0), width_(0), height_(0), depth_(0), color_mode_(InvalidColorMode)
 {
 }
 
 
-bool Document::parse(const std::wstring& filename)
+bool psd_document::parse(const std::wstring& filename)
 {
        bool result = true;
        
@@ -44,14 +44,13 @@ bool Document::parse(const std::wstring& filename)
        }
        catch(std::exception& ex)
        {
-               std::clog << "ooops!" << std::endl;
                result = false;
        }
 
        return result;
 }
 
-void Document::read_header()
+void psd_document::read_header()
 {
        unsigned long signature = input_.read_long();
        unsigned short version = input_.read_short();
@@ -67,13 +66,13 @@ void Document::read_header()
        color_mode_ = int_to_color_mode(input_.read_short());
 }
 
-void Document::read_color_mode()
+void psd_document::read_color_mode()
 {
        unsigned long length = input_.read_long();
        input_.discard_bytes(length);
 }
 
-void Document::read_image_resources()
+void psd_document::read_image_resources()
 {
        unsigned long section_length = input_.read_long();
 
@@ -180,7 +179,7 @@ void Document::read_image_resources()
 }
 
 
-void Document::read_layers()
+void psd_document::read_layers()
 {
        //"Layer And Mask information"
        unsigned long total_length = input_.read_long();        //length of "Layer and Mask information"
@@ -194,12 +193,12 @@ void Document::read_layers()
                        unsigned long end_of_layers_info = input_.current_position() + layer_info_length;
 
                        short layers_count = abs(static_cast<short>(input_.read_short()));
-                       std::clog << "Expecting " << layers_count << " layers" << std::endl;
+                       //std::clog << "Expecting " << layers_count << " layers" << std::endl;
 
                        for(unsigned short layerIndex = 0; layerIndex < layers_count; ++layerIndex)
                        {
                                layers_.push_back(Layer::create(input_));       //each layer reads it's "layer record"
-                               std::clog << "Added layer: " << std::string(layers_[layerIndex]->name().begin(), layers_[layerIndex]->name().end()) << std::endl;
+                               //std::clog << "Added layer: " << std::string(layers_[layerIndex]->name().begin(), layers_[layerIndex]->name().end()) << std::endl;
                        }
 
                        unsigned long channel_data_start = input_.current_position();   //TODO: remove. For debug purposes only
@@ -221,7 +220,6 @@ void Document::read_layers()
        }
        catch(std::exception& ex)
        {
-               std::clog << "big oops";
                input_.set_position(end_of_layers);
        }
 }
index 1e0fe69bc87b6b46cdd1220cb2d945f51016ba6d..6a936d9e74dd1255f131c096e51b1e1e965a6c15 100644 (file)
 
 namespace caspar { namespace psd {
 
-class Document
+class psd_document
 {
 public:
-       Document();
+       psd_document();
 
        std::vector<layer_ptr>& layers()
        {
index 9664377c7e84c135362e87b0cc49e2a2de0a4aec..b03db00036425cebe49acea499ca3a5e25b7cbd1 100644 (file)
@@ -171,18 +171,21 @@ void Layer::read_channel_data(BEFileInputStream& stream)
 {
        image8bit_ptr img;
        image8bit_ptr mask;
-       std::clog << std::endl << "layer: " << std::string(name().begin(), name().end()) << std::endl;
+       //std::clog << std::endl << "layer: " << std::string(name().begin(), name().end()) << std::endl;
        
        if(rect_.width() > 0 && rect_.height() > 0)
        {
                img = std::make_shared<image8bit>(rect_.width(), rect_.height(), std::min<unsigned char>(channels_.size() - masks_, 4));
-               std::clog << std::dec << "has image: [width: " << rect_.width() << " height: " << rect_.height() << "]" << std::endl;
+               //std::clog << std::dec << "has image: [width: " << rect_.width() << " height: " << rect_.height() << "]" << std::endl;
+
+               if(!get_channel(psd::Transparency))
+                       std::memset(img->data(), (unsigned long)(255<<24), rect_.width()*rect_.height());
        }
 
        if(masks_ > 0 && mask_rect_.width() > 0 && mask_rect_.height() > 0)
        {
                mask = std::make_shared<image8bit>(mask_rect_.width(), mask_rect_.height(), 1);
-               std::clog << std::dec << "has mask: [width: " << mask_rect_.width() << " height: " << mask_rect_.height() << "]" << std::endl;
+               //std::clog << std::dec << "has mask: [width: " << mask_rect_.width() << " height: " << mask_rect_.height() << "]" << std::endl;
        }
 
        auto end = channels_.end();
@@ -198,7 +201,7 @@ void Layer::read_channel_data(BEFileInputStream& stream)
                else if((*it)->id() >= -1)      //RGBA-data
                {
                        target = img;
-                       offset = ((*it)->id() >= 0) ? (*it)->id() : 3;
+                       offset = ((*it)->id() >= 0) ? 2 - (*it)->id() : 3;
                }
                else if(mask)   //mask
                {
@@ -212,19 +215,19 @@ void Layer::read_channel_data(BEFileInputStream& stream)
                }
 
                unsigned long cp = stream.current_position();   //TODO: remove, for debug purposes only
-               std::clog << std::dec << "channel_id: " << (*it)->id() << ", reading data from: " << std::hex << cp << ", data_length: " << (*it)->data_length() << std::endl;
+               //std::clog << std::dec << "channel_id: " << (*it)->id() << ", reading data from: " << std::hex << cp << ", data_length: " << (*it)->data_length() << std::endl;
 
                if(!target)
                        discard_channel = true;
 
                if(discard_channel)
                {
-                       std::clog << "  -> discarding" << std::endl;
+                       //std::clog << "        -> discarding" << std::endl;
                        stream.discard_bytes((*it)->data_length());
                }
                else
                {
-                       std::clog << "  -> reading...";
+                       //std::clog << "        -> reading...";
                        unsigned short encoding = stream.read_short();
                        if(target)
                        {
@@ -235,7 +238,7 @@ void Layer::read_channel_data(BEFileInputStream& stream)
                                else
                                        throw PSDFileFormatException();
                        }
-                       std::clog << " " << std::hex << (stream.current_position() - cp) << " bytes read" << std::endl;
+                       //std::clog << " " << std::hex << (stream.current_position() - cp) << " bytes read" << std::endl;
                }
        }
 
index ade17056774a01be4c1e24d5fb988a55fc7da606..da5d05968bdaf4c5f8a23ee986ba4da9f4c5263c 100644 (file)
@@ -47,10 +47,6 @@ public:
        static std::shared_ptr<Layer> create(BEFileInputStream&);
        void read_channel_data(BEFileInputStream&);
 
-       unsigned long GetTotalDataLength();
-
-       //image_ptr read_image(BEFileInputStream&);
-       
        const std::wstring& name() const
        {
                return name_;
@@ -60,6 +56,9 @@ public:
                return rect_;
        }
 
+       const image8bit_ptr& image() const { return image_; }
+       const image8bit_ptr& mask() const { return mask_; }
+
 private:
        channel_ptr get_channel(ChannelType);
        void read_mask_data(BEFileInputStream&);
index b7541657263a985ed3e6229e6d79035d243c3fac..b1634e2297b624760a0fcc9d309e6a89ad12114c 100644 (file)
@@ -33,8 +33,8 @@ struct rect
        T right;
        T bottom;
        T left;
-       T width() { return right-left; }
-       T height() { return bottom-top; }
+       T width() const { return right-left; }
+       T height() const { return bottom-top; }
 };
 
 class PSDFileFormatException : public std::exception
index 3cd7dbde76393c4ff88993890831c4dd90d0d0d5..92adc0656fd52b3f8f5156fe39c8fa5ff6095333 100644 (file)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
+    <ProjectConfiguration Include="Debug|x64">
       <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
+      <Platform>x64</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
+    <ProjectConfiguration Include="Release|x64">
       <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
+      <Platform>x64</Platform>
     </ProjectConfiguration>
   </ItemGroup>
   <ItemGroup>
@@ -15,6 +15,7 @@
     <ClCompile Include="doc.cpp" />
     <ClCompile Include="layer.cpp" />
     <ClCompile Include="misc.cpp" />
+    <ClCompile Include="psd.cpp" />
     <ClCompile Include="resource.cpp" />
     <ClCompile Include="util\bigendian_file_input_stream.cpp" />
   </ItemGroup>
     <ClInclude Include="image.h" />
     <ClInclude Include="layer.h" />
     <ClInclude Include="misc.h" />
+    <ClInclude Include="psd.h" />
     <ClInclude Include="resource.h" />
     <ClInclude Include="util\bigendian_file_input_stream.h" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\common\common.vcxproj">
+      <Project>{02308602-7fe0-4253-b96e-22134919f56a}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\core\core.vcxproj">
+      <Project>{79388c20-6499-4bf6-b8b9-d8c33d7d4ddd}</Project>
+    </ProjectReference>
+  </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{866A164B-6F7A-450E-8452-C6AE4E176436}</ProjectGuid>
     <Keyword>Win32Proj</Keyword>
     <RootNamespace>psd</RootNamespace>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
     <WholeProgramOptimization>true</WholeProgramOptimization>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <IncludePath>..\..\dependencies64\boost\;$(IncludePath)</IncludePath>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <IncludePath>..\..\;..\..\dependencies64\boost\;C:\Lokala Filer\Utveckling\CasparCG\Server 2.1\dependencies64\tbb\include;$(IncludePath)</IncludePath>
     <OutDir>$(ProjectDir)bin\$(Configuration)\</OutDir>
     <IntDir>$(ProjectDir)tmp\$(Configuration)\</IntDir>
   </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
       <PrecompiledHeader>
       </PrecompiledHeader>
@@ -73,7 +83,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
     </Link>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <PrecompiledHeader>
index 0dcbb6be3b2942af38328f816ee3a1efee71552d..391efdd436743481201887b5761bf3b33e208938 100644 (file)
     </Filter>
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="util\bigendian_file_input_stream.cpp">
+      <Filter>Source Files\util</Filter>
+    </ClCompile>
+    <ClCompile Include="descriptor.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="doc.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="misc.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="util\bigendian_file_input_stream.cpp">
-      <Filter>Source Files\util</Filter>
-    </ClCompile>
     <ClCompile Include="resource.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="descriptor.cpp">
+    <ClCompile Include="psd.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="channel.h">
+    <ClInclude Include="util\bigendian_file_input_stream.h">
+      <Filter>Source Files\util</Filter>
+    </ClInclude>
+    <ClInclude Include="resource.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="doc.h">
+    <ClInclude Include="channel.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="layer.h">
+    <ClInclude Include="descriptor.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="misc.h">
+    <ClInclude Include="doc.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="util\bigendian_file_input_stream.h">
-      <Filter>Source Files\util</Filter>
+    <ClInclude Include="image.h">
+      <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="resource.h">
+    <ClInclude Include="layer.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="descriptor.h">
+    <ClInclude Include="misc.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="image.h">
+    <ClInclude Include="psd.h">
       <Filter>Source Files</Filter>
     </ClInclude>
   </ItemGroup>
index e670970b021ec07dd3d5215528711cf32ff162a3..86a120041dd08f452f2fbce4f82240cdeed4493d 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "bigendian_file_input_stream.h"
 #include "..\..\..\common\utf.h"
+#include <common/endian.h>
 #include <boost/locale.hpp>
 
 namespace caspar { namespace psd {
@@ -58,32 +59,34 @@ unsigned char BEFileInputStream::read_byte()
 
 unsigned short SWAP16(unsigned short inVal)
 {
-       unsigned short outVal;
-       __asm{
-               mov ax, inVal;
-               mov bl, ah;
-               mov bh, al;
-               mov outVal, bx;
-       }
-       return outVal;
+       return caspar::swap_byte_order(inVal);
+       //unsigned short outVal;
+       //__asm{
+       //      mov ax, inVal;
+       //      mov bl, ah;
+       //      mov bh, al;
+       //      mov outVal, bx;
+       //}
+       //return outVal;
 }
 
 unsigned long SWAP32(unsigned long inVal)
 {
-       unsigned long outVal;
-       __asm{
-               mov eax, inVal; //1 2 ah = 3 al = 4
-               mov bl, ah;
-               mov bh, al;
-
-               ror ebx, 16;
-               ror eax, 16;
-
-               mov bl, ah;
-               mov bh, al;
-               mov outVal, ebx;
-       }
-       return outVal;
+       return caspar::swap_byte_order(inVal);
+       //unsigned long outVal;
+       //__asm{
+       //      mov eax, inVal; //1 2 ah = 3 al = 4
+       //      mov bl, ah;
+       //      mov bh, al;
+
+       //      ror ebx, 16;
+       //      ror eax, 16;
+
+       //      mov bl, ah;
+       //      mov bh, al;
+       //      mov outVal, ebx;
+       //}
+       //return outVal;
 }
 
 unsigned short BEFileInputStream::read_short()
index 7b5e65393fcdfc478074b7645627f5d448660945..75133274a25039966b5e1aa5dc6f652627d6231e 100644 (file)
@@ -43,6 +43,7 @@
 #include <modules/oal/oal.h>
 #include <modules/screen/screen.h>
 #include <modules/image/image.h>
+#include <modules/psd/psd.h>
 
 #include <modules/oal/consumer/oal_consumer.h>
 #include <modules/bluefish/consumer/bluefish_consumer.h>
@@ -99,6 +100,9 @@ struct server::impl : boost::noncopyable
                flash::init();            
                CASPAR_LOG(info) << L"Initialized flash module.";
 
+               psd::init();              
+               CASPAR_LOG(info) << L"Initialized psd module.";
+
                register_producer_factory(&core::scene::create_dummy_scene_producer);
 
                setup_channels(env::properties());
index 4959ed599466a9421cd1398c3324531f02a3c4d8..4c23ff52c9bf16a36dd7c3bef79a80abe9a31a98 100644 (file)
@@ -52,6 +52,9 @@
     <ProjectReference Include="..\modules\oal\oal.vcxproj">\r
       <Project>{82ed7ed6-8a15-40ec-a8af-f5e712e0da68}</Project>\r
     </ProjectReference>\r
+    <ProjectReference Include="..\modules\psd\psd.vcxproj">\r
+      <Project>{866a164b-6f7a-450e-8452-c6ae4e176436}</Project>\r
+    </ProjectReference>\r
     <ProjectReference Include="..\modules\reroute\reroute.vcxproj">\r
       <Project>{7d58bd57-fdd5-46e6-a23b-ed14b5314a0e}</Project>\r
     </ProjectReference>\r
index c18d39d888d8b49bcfda48f95dd86eb53d532db2..235fdfce7bcf011342578683c8d3d504ee6ea413 100644 (file)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
+    <ProjectConfiguration Include="Debug|x64">
       <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
+      <Platform>x64</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
+    <ProjectConfiguration Include="Release|x64">
       <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
+      <Platform>x64</Platform>
     </ProjectConfiguration>
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <RootNamespace>psdtest</RootNamespace>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
     <WholeProgramOptimization>true</WholeProgramOptimization>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <LinkIncremental>true</LinkIncremental>
     <LibraryPath>C:\Lokala Filer\Utveckling\CasparCG\Server 2.1\dependencies64\boost\stage\lib;$(LibraryPath)</LibraryPath>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
       <PrecompiledHeader>
       </PrecompiledHeader>
@@ -57,7 +57,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
     </Link>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <PrecompiledHeader>