summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2009-06-08 20:14:52 +0000
committerscuri <scuri>2009-06-08 20:14:52 +0000
commit01bb2586942d6dfcba290087f289fea28ea726eb (patch)
tree79e80fae485a3e8c3a5a2c0c3326fad80d00c1b2
parentf7498fef28dbb8f31a289fe6478fd609fda65af6 (diff)
*** empty log message ***
-rw-r--r--html/en/history.html5
-rw-r--r--mak.vc9/im.sln13
-rw-r--r--src/im_format_avi.cpp30
-rw-r--r--test/im_view.c5
-rw-r--r--test/im_view.vcproj6
5 files changed, 48 insertions, 11 deletions
diff --git a/html/en/history.html b/html/en/history.html
index 462cd14..4967ed2 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -11,6 +11,11 @@
<body>
<h1>History of Changes</h1>
+<h3 dir="ltr">Version 3.4.2 (XX/XX/2009)</h3>
+<ul>
+ <li><span style="color: #FF0000">Fixed:</span> AVI format when reading 32
+ bpp frames.</li>
+</ul>
<h3 dir="ltr">Version 3.4.1 (15/Dec/2008)</h3>
<ul>
<li><span style="color: #008000">Changed:</span> function <strong>
diff --git a/mak.vc9/im.sln b/mak.vc9/im.sln
index e748276..b235a45 100644
--- a/mak.vc9/im.sln
+++ b/mak.vc9/im.sln
@@ -26,6 +26,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imlua_process5", "imlua_pro
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "im_ecw", "im_ecw.vcproj", "{CB86E507-6B6C-4FDF-9B6D-27AA123AE463}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "im_view", "..\test\im_view.vcproj", "{909637FA-8229-45A9-9F42-53D8ED5F91C5}"
+ ProjectSection(ProjectDependencies) = postProject
+ {CB863607-6B6C-0000-0000-000000000000} = {CB863607-6B6C-0000-0000-000000000000}
+ {5A761929-07C3-48BD-8E4A-B37EC5C72C42} = {5A761929-07C3-48BD-8E4A-B37EC5C72C42}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -105,6 +111,13 @@ Global
{CB86E507-6B6C-4FDF-9B6D-27AA123AE463}.Release|Win32.ActiveCfg = Debug|Win32
{CB86E507-6B6C-4FDF-9B6D-27AA123AE463}.Release|Win32.Build.0 = Debug|Win32
{CB86E507-6B6C-4FDF-9B6D-27AA123AE463}.Release|x64.ActiveCfg = Debug|Win32
+ {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Debug|Win32.Build.0 = Debug|Win32
+ {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Debug|x64.ActiveCfg = Debug|x64
+ {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Debug|x64.Build.0 = Debug|x64
+ {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Release|Win32.ActiveCfg = Debug|x64
+ {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Release|x64.ActiveCfg = Debug|x64
+ {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Release|x64.Build.0 = Debug|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/im_format_avi.cpp b/src/im_format_avi.cpp
index 632e45b..dcb4898 100644
--- a/src/im_format_avi.cpp
+++ b/src/im_format_avi.cpp
@@ -2,7 +2,7 @@
* \brief AVI - Windows Audio-Video Interleaved RIFF
*
* See Copyright Notice in im_lib.h
- * $Id: im_format_avi.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $
+ * $Id: im_format_avi.cpp,v 1.3 2009/06/08 20:14:53 scuri Exp $
*/
#include "im_format.h"
@@ -59,7 +59,7 @@ class imFileFormatAVI: public imFileFormatBase
void ReadPalette(unsigned char* bmp_colors);
void WritePalette(unsigned char* bmp_colors);
- void FixRGB(int bpp);
+ void FixRGBOrder(int bpp);
void InitMasks(imDib* dib);
public:
@@ -282,7 +282,19 @@ int imFileFormatAVI::ReadImageInfo(int index)
this->line_buffer_extra = 4; // room enough for padding
/* prepares to read data from the stream */
- frame = AVIStreamGetFrameOpen(stream, NULL);
+ if (bpp == 32)
+ {
+ BITMAPINFOHEADER info;
+ memset(&info, 0, sizeof(BITMAPINFOHEADER));
+ info.biSize = sizeof(BITMAPINFOHEADER);
+ info.biWidth = width;
+ info.biHeight = height;
+ info.biPlanes = 1;
+ info.biBitCount = (WORD)bpp;
+ frame = AVIStreamGetFrameOpen(stream, &info);
+ }
+ else
+ frame = AVIStreamGetFrameOpen(stream, NULL);
if (!frame)
return IM_ERR_ACCESS;
@@ -504,7 +516,7 @@ void imFileFormatAVI::InitMasks(imDib* dib)
}
}
-void imFileFormatAVI::FixRGB(int bpp)
+void imFileFormatAVI::FixRGBOrder(int bpp)
{
int x;
@@ -532,13 +544,17 @@ void imFileFormatAVI::FixRGB(int bpp)
break;
case 32:
{
+ /* inverts the DWORD values if not intel */
+ if (imBinCPUByteOrder() == IM_BIGENDIAN)
+ imBinSwapBytes4(this->line_buffer, this->width);
+
unsigned int* dword_data = (unsigned int*)this->line_buffer;
imbyte* byte_data = (imbyte*)this->line_buffer;
for (x = 0; x < this->width; x++)
{
unsigned int dword_value = dword_data[x];
- int c = x*3;
+ int c = x*4;
byte_data[c] = (imbyte)((rmask & dword_value) >> roff);
byte_data[c+1] = (imbyte)((gmask & dword_value) >> goff);
byte_data[c+2] = (imbyte)((bmask & dword_value) >> boff);
@@ -586,7 +602,7 @@ int imFileFormatAVI::ReadImageData(void* data)
bits += dib->line_size;
if (dib->bmih->biBitCount > 8)
- FixRGB(dib->bmih->biBitCount);
+ FixRGBOrder(dib->bmih->biBitCount);
imFileLineBufferRead(this, data, row, 0);
@@ -623,7 +639,7 @@ int imFileFormatAVI::WriteImageData(void* data)
imFileLineBufferWrite(this, data, row, 0);
if (dib->bmih->biBitCount > 8)
- FixRGB(dib->bmih->biBitCount);
+ FixRGBOrder(dib->bmih->biBitCount);
CopyMemory(bits, this->line_buffer, dib->line_size);
bits += dib->line_size;
diff --git a/test/im_view.c b/test/im_view.c
index 1bfb568..2ec8fac 100644
--- a/test/im_view.c
+++ b/test/im_view.c
@@ -147,11 +147,14 @@ static Ihandle* CreateDialog(void)
return iup_dialog;
}
+#include "im_format_avi.h"
+
int main(int argc, char* argv[])
{
Ihandle* dlg;
- IupOpen();
+ imFormatRegisterAVI();
+ IupOpen(&argc, &argv);
dlg = CreateDialog();
diff --git a/test/im_view.vcproj b/test/im_view.vcproj
index 26aeb22..12cd0ba 100644
--- a/test/im_view.vcproj
+++ b/test/im_view.vcproj
@@ -44,7 +44,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="../../../iup/include;../../../cd/include;../../include"
+ AdditionalIncludeDirectories="../../iup/include;../../cd/include;../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="false"
BasicRuntimeChecks="3"
@@ -65,10 +65,10 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="comctl32.lib im.lib iup.lib cd.lib cdiup.lib"
+ AdditionalDependencies="comctl32.lib vfw32.lib im.lib im_avi.lib iup.lib cd.lib iupcd.lib freetype6.lib"
OutputFile="$(OutDir)/im_view.exe"
LinkIncremental="1"
- AdditionalLibraryDirectories="../../lib;../../../iup/lib;../../../cd/lib"
+ AdditionalLibraryDirectories="../lib;../../iup/lib/vc9;../../cd/lib/vc9"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/im_view.pdb"
SubSystem="1"