Skip to content

Commit

Permalink
Release 1.0.15
Browse files Browse the repository at this point in the history
* Several functions optimized for AVX-512 support.
* Fixed several issues reported by PVS Studio static analyzer.
* Fixed syntax error in C interface, covered with tests.
* Bugfix in horizontal summing functions (invalid register clobber list).
* Some AMD-related optimizations.
* Updated module versions in dependencies.
  • Loading branch information
sadko4u committed Sep 9, 2023
2 parents 65b5724 + 478e851 commit a6f91e4
Show file tree
Hide file tree
Showing 65 changed files with 4,127 additions and 690 deletions.
20 changes: 19 additions & 1 deletion .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.preprocessor.def.368930916" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LSP_TESTING"/>
<listOptionValue builtIn="false" value="LSP_IDE_DEBUG"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.380024909" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.424525884" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
Expand All @@ -44,6 +45,7 @@
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.1421051177" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LSP_TESTING"/>
<listOptionValue builtIn="false" value="LSP_IDE_DEBUG"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2008435369" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
Expand Down Expand Up @@ -85,6 +87,18 @@
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.218466097" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.1330341797.281573242" name="avx512.cpp" rcbsApplicability="disable" resourcePath="src/main/x86/avx512.cpp" toolsToInvoke="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1715496680.752248820">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1715496680.752248820" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1715496680">
<option id="gnu.cpp.compiler.option.other.other.2124416907" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -mavx512f -mavx512vl" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1847585465" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.874817721" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.22498286" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1153584601" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.1330341797.356003736" name="sse4.cpp" rcbsApplicability="disable" resourcePath="src/main/x86/sse4.cpp" toolsToInvoke="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1715496680.73118722">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1715496680.73118722" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1715496680">
<option id="gnu.cpp.compiler.option.other.other.824484852" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -msse4 -msse4a" valueType="string"/>
Expand Down Expand Up @@ -220,6 +234,7 @@
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.preprocessor.def.397756050" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LSP_TESTING"/>
<listOptionValue builtIn="false" value="LSP_IDE_DEBUG"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.2124347448" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1646920213" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
Expand All @@ -234,6 +249,7 @@
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.392178909" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LSP_TESTING"/>
<listOptionValue builtIn="false" value="LSP_IDE_DEBUG"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1546071444" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
Expand Down Expand Up @@ -353,8 +369,10 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="DebugLinux"/>
<configuration configurationName="Debug Linux"/>
<configuration configurationName="Debug Win"/>
<configuration configurationName="DebugWin"/>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/lsp-dsp-lib"/>
</configuration>
Expand All @@ -364,4 +382,4 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>
</cproject>
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
* RECENT CHANGES
*******************************************************************************

=== 1.0.15 ===
* Several functions optimized for AVX-512 support.
* Fixed several issues reported by PVS Studio static analyzer.
* Fixed syntax error in C interface, covered with tests.
* Bugfix in horizontal summing functions (invalid register clobber list).
* Some AMD-related optimizations.
* Updated module versions in dependencies.

=== 1.0.14 ===
* Implemented pcomplex_r2c instruction set.
* Updated build scripts.
Expand Down
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ This library provides set of functions that perform SIMD-optimized
computing on several hardware architectures.

Currently supported set of SIMD extensions:
* i586 architecture (32-bit): SSE, SSE2, SSE3, AVX, AVX2 and FMA3;
* x86_64 architecture (64-bit): SSE, SSE2, SSE3, AVX, AVX2 and FMA3;
* i586 architecture (32-bit): SSE, SSE2, SSE3, AVX, AVX2, FMA3 and AVX512;
* x86_64 architecture (64-bit): SSE, SSE2, SSE3, AVX, AVX2, FMA3 and AVX512;
* armv7 architecture (32-bit): NEON;
* AArch64 architecture (64-bit): ASIMD.

Expand All @@ -32,8 +32,7 @@ Current set of functions provided:
* Interpolation functions;
* Some set of function to work with 3D mathematics.

Supported platforms
======
## Supported platforms

The build and correct unit test execution has been confirmed for following platforms:
* FreeBSD
Expand All @@ -42,29 +41,26 @@ The build and correct unit test execution has been confirmed for following platf
* Windows 32-bit
* Windows 64-bit

Supported architectures
======
## Supported architectures

The support of following list of hardware architectures has been implemented:
* i386 (32-bit) - full support.
* x86_64 (64-bit) - full support.
* i386 (32-bit) - full support (AVX-512 on the way).
* x86_64 (64-bit) - full support (AVX-512 on the way).
* ARMv6A - full support.
* ARMv7A - full support.
* AArch64 - most functions.
* AArch64 - full support.

For all other architectures the generic implementation of algorithms is used, without any
architecture-specific optimizations.

Requirements
======
## Requirements

The following packages need to be installed for building:

* gcc >= 4.9
* make >= 4.0

Building
======
## Building

To build the library, perform the following commands:

Expand Down Expand Up @@ -112,8 +108,8 @@ To build source code archive with all possible dependencies, run:
make distsrc
```

Usage
======
## Usage


Here's the code snippet of how the library can be initialized and used in C++:

Expand Down Expand Up @@ -203,4 +199,6 @@ int main(int argc, const char **argv)
```

## SAST Tools

* [PVS-Studio](https://pvs-studio.com/en/pvs-studio/?utm_source=website&utm_medium=github&utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code.
172 changes: 82 additions & 90 deletions include/lsp-plug.in/dsp/common/3dmath/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,96 +29,88 @@
#define DSP_3D_MAXVALUE 1e+20f
#define DSP_3D_MAXISECT 8

#ifdef __cplusplus
namespace lsp
LSP_DSP_LIB_BEGIN_NAMESPACE

#pragma pack(push, 1)
typedef struct LSP_DSP_LIB_TYPE(point3d_t)
{
float x, y, z, w;
} LSP_DSP_LIB_TYPE(point3d_t);

typedef struct LSP_DSP_LIB_TYPE(vector3d_t)
{
float dx, dy, dz, dw;
} LSP_DSP_LIB_TYPE(vector3d_t);

typedef struct LSP_DSP_LIB_TYPE(color3d_t)
{
float r, g, b, a;
} LSP_DSP_LIB_TYPE(color3d_t);

typedef struct LSP_DSP_LIB_TYPE(ray3d_t)
{
LSP_DSP_LIB_TYPE(point3d_t) z; // The start point: x, y, z = point coordinates
LSP_DSP_LIB_TYPE(vector3d_t) v; // The spread vector: dx, dy, dz = direction
} LSP_DSP_LIB_TYPE(ray3d_t);

typedef struct LSP_DSP_LIB_TYPE(bound_box3d_t)
{
LSP_DSP_LIB_TYPE(point3d_t) p[8]; // Bounding-box contains 8 points
} LSP_DSP_LIB_TYPE(bound_box3d_t);

typedef struct LSP_DSP_LIB_TYPE(segment3d_t)
{
LSP_DSP_LIB_TYPE(point3d_t) p[2];
} LSP_DSP_LIB_TYPE(segment3d_t);

typedef struct LSP_DSP_LIB_TYPE(triangle3d_t)
{
LSP_DSP_LIB_TYPE(point3d_t) p[3]; // Vertexes: x, y, z = vertex coordinates, w = length of the corresponding edge
LSP_DSP_LIB_TYPE(vector3d_t) n; // Normal: dx, dy, dz = normal coordinates, dw = plane equation coefficient
} LSP_DSP_LIB_TYPE(triangle3d_t);

typedef struct LSP_DSP_LIB_TYPE(matrix3d_t)
{
float m[16]; // Matrix data
} LSP_DSP_LIB_TYPE(matrix3d_t);

typedef struct LSP_DSP_LIB_TYPE(raw_triangle_t)
{
LSP_DSP_LIB_TYPE(point3d_t) v[3];
} LSP_DSP_LIB_TYPE(raw_triangle_t);

#pragma pack(pop)

typedef enum LSP_DSP_LIB_TYPE(axis_orientation_t)
{
namespace dsp
{
#endif /* __cplusplus */

#pragma pack(push, 1)
typedef struct LSP_DSP_LIB_TYPE(point3d_t)
{
float x, y, z, w;
} LSP_DSP_LIB_TYPE(point3d_t);

typedef struct LSP_DSP_LIB_TYPE(vector3d_t)
{
float dx, dy, dz, dw;
} LSP_DSP_LIB_TYPE(vector3d_t);

typedef struct LSP_DSP_LIB_TYPE(color3d_t)
{
float r, g, b, a;
} LSP_DSP_LIB_TYPE(color3d_t);

typedef struct LSP_DSP_LIB_TYPE(ray3d_t)
{
LSP_DSP_LIB_TYPE(point3d_t) z; // The start point: x, y, z = point coordinates
LSP_DSP_LIB_TYPE(vector3d_t) v; // The spread vector: dx, dy, dz = direction
} LSP_DSP_LIB_TYPE(ray3d_t);

typedef struct LSP_DSP_LIB_TYPE(bound_box3d_t)
{
LSP_DSP_LIB_TYPE(point3d_t) p[8]; // Bounding-box contains 8 points
} LSP_DSP_LIB_TYPE(bound_box3d_t);

typedef struct LSP_DSP_LIB_TYPE(segment3d_t)
{
LSP_DSP_LIB_TYPE(point3d_t) p[2];
} LSP_DSP_LIB_TYPE(segment3d_t);

typedef struct LSP_DSP_LIB_TYPE(triangle3d_t)
{
LSP_DSP_LIB_TYPE(point3d_t) p[3]; // Vertexes: x, y, z = vertex coordinates, w = length of the corresponding edge
LSP_DSP_LIB_TYPE(vector3d_t) n; // Normal: dx, dy, dz = normal coordinates, dw = plane equation coefficient
} LSP_DSP_LIB_TYPE(triangle3d_t);

typedef struct LSP_DSP_LIB_TYPE(matrix3d_t)
{
float m[16]; // Matrix data
} LSP_DSP_LIB_TYPE(matrix3d_t);

typedef struct LSP_DSP_LIB_TYPE(raw_triangle_t)
{
LSP_DSP_LIB_TYPE(point3d_t) v[3];
} LSP_DSP_LIB_TYPE(raw_triangle_t);

#pragma pack(pop)

typedef enum LSP_DSP_LIB_TYPE(axis_orientation_t)
{
AO3D_POS_X_FWD_POS_Y_UP,
AO3D_POS_X_FWD_POS_Z_UP,
AO3D_POS_X_FWD_NEG_Y_UP,
AO3D_POS_X_FWD_NEG_Z_UP,
AO3D_NEG_X_FWD_POS_Y_UP,
AO3D_NEG_X_FWD_POS_Z_UP,
AO3D_NEG_X_FWD_NEG_Y_UP,
AO3D_NEG_X_FWD_NEG_Z_UP,

AO3D_POS_Y_FWD_POS_X_UP,
AO3D_POS_Y_FWD_POS_Z_UP,
AO3D_POS_Y_FWD_NEG_X_UP,
AO3D_POS_Y_FWD_NEG_Z_UP,
AO3D_NEG_Y_FWD_POS_X_UP,
AO3D_NEG_Y_FWD_POS_Z_UP,
AO3D_NEG_Y_FWD_NEG_X_UP,
AO3D_NEG_Y_FWD_NEG_Z_UP,

AO3D_POS_Z_FWD_POS_X_UP,
AO3D_POS_Z_FWD_POS_Y_UP,
AO3D_POS_Z_FWD_NEG_X_UP,
AO3D_POS_Z_FWD_NEG_Y_UP,
AO3D_NEG_Z_FWD_POS_X_UP,
AO3D_NEG_Z_FWD_POS_Y_UP,
AO3D_NEG_Z_FWD_NEG_X_UP,
AO3D_NEG_Z_FWD_NEG_Y_UP
} LSP_DSP_LIB_TYPE(axis_orientation_t);

#ifdef __cplusplus
}
}
#endif /* __cplusplus */
AO3D_POS_X_FWD_POS_Y_UP,
AO3D_POS_X_FWD_POS_Z_UP,
AO3D_POS_X_FWD_NEG_Y_UP,
AO3D_POS_X_FWD_NEG_Z_UP,
AO3D_NEG_X_FWD_POS_Y_UP,
AO3D_NEG_X_FWD_POS_Z_UP,
AO3D_NEG_X_FWD_NEG_Y_UP,
AO3D_NEG_X_FWD_NEG_Z_UP,

AO3D_POS_Y_FWD_POS_X_UP,
AO3D_POS_Y_FWD_POS_Z_UP,
AO3D_POS_Y_FWD_NEG_X_UP,
AO3D_POS_Y_FWD_NEG_Z_UP,
AO3D_NEG_Y_FWD_POS_X_UP,
AO3D_NEG_Y_FWD_POS_Z_UP,
AO3D_NEG_Y_FWD_NEG_X_UP,
AO3D_NEG_Y_FWD_NEG_Z_UP,

AO3D_POS_Z_FWD_POS_X_UP,
AO3D_POS_Z_FWD_POS_Y_UP,
AO3D_POS_Z_FWD_NEG_X_UP,
AO3D_POS_Z_FWD_NEG_Y_UP,
AO3D_NEG_Z_FWD_POS_X_UP,
AO3D_NEG_Z_FWD_POS_Y_UP,
AO3D_NEG_Z_FWD_NEG_X_UP,
AO3D_NEG_Z_FWD_NEG_Y_UP
} LSP_DSP_LIB_TYPE(axis_orientation_t);

LSP_DSP_LIB_END_NAMESPACE

#endif /* LSP_PLUG_IN_DSP_COMMON_3DMATH_TYPES_H_ */
41 changes: 17 additions & 24 deletions include/lsp-plug.in/dsp/common/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,24 @@

#include <lsp-plug.in/dsp/common/types.h>

#ifdef __cplusplus
namespace lsp
LSP_DSP_LIB_BEGIN_NAMESPACE

typedef struct LSP_DSP_LIB_TYPE(bitmap_t)
{
namespace dsp
{
#endif /* __cplusplus */

typedef struct LSP_DSP_LIB_TYPE(bitmap_t)
{
int32_t width;
int32_t height;
int32_t stride;
uint8_t *data;
} LSP_DSP_LIB_TYPE(bitmap_t);


typedef void (* LSP_DSP_LIB_TYPE(bitmap_render_func_t))(
LSP_DSP_LIB_TYPE(bitmap_t) *dst,
const LSP_DSP_LIB_TYPE(bitmap_t) *src,
ssize_t x,
ssize_t y);
#ifdef __cplusplus
} /* namespace dsp */
} /* namespace lsp */
#endif /* __cplusplus */
int32_t width;
int32_t height;
int32_t stride;
uint8_t *data;
} LSP_DSP_LIB_TYPE(bitmap_t);


typedef void (* LSP_DSP_LIB_TYPE(bitmap_render_func_t))(
LSP_DSP_LIB_TYPE(bitmap_t) *dst,
const LSP_DSP_LIB_TYPE(bitmap_t) *src,
ssize_t x,
ssize_t y);

LSP_DSP_LIB_END_NAMESPACE

#include <lsp-plug.in/dsp/common/bitmap/b1b8.h>
#include <lsp-plug.in/dsp/common/bitmap/b2b8.h>
Expand Down
2 changes: 1 addition & 1 deletion include/lsp-plug.in/dsp/common/bitmap/b1b8.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Put the source 1-bit bitmap to destination 8-bit bitmap,
* the result pixel value will be computed as: result[i] = src[i]
*/
LSP_DSP_LIB_SYMBOL(void, bitmap_put_b1b8, LSP_DSP_LIB_TYPE(LSP_DSP_LIB_TYPE(bitmap_t)) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y);
LSP_DSP_LIB_SYMBOL(void, bitmap_put_b1b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y);

/**
* Put the source 1-bit bitmap to destination 8-bit bitmap,
Expand Down
Loading

0 comments on commit a6f91e4

Please sign in to comment.