Fixed small OpenMP bug.

Originally committed to SVN as r2089.
This commit is contained in:
Rodrigo Braz Monteiro 2008-03-21 03:02:39 +00:00
parent 21b3db9b2a
commit 398da989f9
3 changed files with 30 additions and 19 deletions

View File

@ -97,7 +97,7 @@
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)" OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4" ConfigurationType="2"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"
> >
@ -123,9 +123,11 @@
AdditionalIncludeDirectories="include/aegilib" AdditionalIncludeDirectories="include/aegilib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WINDOWS" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WINDOWS"
RuntimeLibrary="2" RuntimeLibrary="2"
OpenMP="true" OpenMP="false"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
PrecompiledHeaderThrough="prec.h" PrecompiledHeaderThrough="prec.h"
AssemblerOutput="4"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="4" WarningLevel="4"
WarnAsError="true" WarnAsError="true"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
@ -144,11 +146,14 @@
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLinkerTool"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool
Name="VCManifestTool"
/>
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
@ -158,6 +163,12 @@
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />

View File

@ -236,24 +236,21 @@ size_t Athenasub::GetUTF8Len(const wchar_t *utf16)
// Convert UTF-16 to UTF-8 // Convert UTF-16 to UTF-8
size_t Athenasub::UTF16toUTF8(const wchar_t *utf16,char *utf8) size_t Athenasub::UTF16toUTF8(const wchar_t *utf16,char *utf8)
{ {
wchar_t curChar = 1; wchar_t curChar = utf16[0];
size_t value; size_t value;
size_t written = 0; size_t written = 0;
for (size_t i=0;;i++) { for (size_t i=0;;i++) {
// Get next
curChar = utf16[i];
// 1 byte // 1 byte
if ((curChar & 0xFF80) == 0) { if ((curChar & 0xFF80) == 0) {
*utf8++ = char(curChar); utf8[written] = char(curChar);
if (curChar == 0) break; if (curChar == 0) break;
written++; written++;
} }
// 2 bytes // 2 bytes
else if ((curChar & 0xF800) == 0) { else if ((curChar & 0xF800) == 0) {
*utf8++ = char(((curChar & 0x07C0) >> 6) | 0xC0); utf8[written] = char(((curChar & 0x07C0) >> 6) | 0xC0);
*utf8++ = char((curChar & 0x003F) | 0x80); utf8[written+1] = char((curChar & 0x003F) | 0x80);
written += 2; written += 2;
} }
@ -261,24 +258,27 @@ size_t Athenasub::UTF16toUTF8(const wchar_t *utf16,char *utf8)
else if ((curChar & 0xFC00) == 0xD800) { else if ((curChar & 0xFC00) == 0xD800) {
// Read // Read
value = (curChar - 0xD800) << 10; value = (curChar - 0xD800) << 10;
value |= utf16[i+1] & 0x3FF;
i++; i++;
value |= utf16[i] & 0x3FF;
// Write // Write
*utf8++ = char(((value & 0x1C0000) >> 18) | 0xF0); utf8[written] = char(((value & 0x1C0000) >> 18) | 0xF0);
*utf8++ = char(((value & 0x03F000) >> 12) | 0x80); utf8[written+1] = char(((value & 0x03F000) >> 12) | 0x80);
*utf8++ = char(((value & 0x000FC0) >> 6) | 0x80); utf8[written+2] = char(((value & 0x000FC0) >> 6) | 0x80);
*utf8++ = char((value & 0x00003F) | 0x80); utf8[written+3] = char((value & 0x00003F) | 0x80);
written += 4; written += 4;
} }
// 3 bytes // 3 bytes
else if (curChar & 0xF800) { else if (curChar & 0xF800) {
*utf8++ = char(((curChar & 0xF000) >> 12) | 0xE0); utf8[written] = char(((curChar & 0xF000) >> 12) | 0xE0);
*utf8++ = char(((curChar & 0x0FC0) >> 6) | 0x80); utf8[written+1] = char(((curChar & 0x0FC0) >> 6) | 0x80);
*utf8++ = char((curChar & 0x003F) | 0x80); utf8[written+2] = char((curChar & 0x003F) | 0x80);
written += 3; written += 3;
} }
// Get next
curChar = utf16[i+1];
} }
return written; return written;
} }

View File

@ -168,7 +168,7 @@ public:
long len = length; long len = length;
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel shared(overlap,len,line_length) #pragma omp parallel shared(overlap,len)
#endif #endif
{ {
short *raw_sample_data = new short[line_length*2]; short *raw_sample_data = new short[line_length*2];