summaryrefslogtreecommitdiff
path: root/effects_software.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'effects_software.cpp')
-rw-r--r--effects_software.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/effects_software.cpp b/effects_software.cpp
index 71023e0..031f0a6 100644
--- a/effects_software.cpp
+++ b/effects_software.cpp
@@ -107,23 +107,15 @@ CurvesSolver(real32 *LUT, v2 Point_P1, v2 Point_P2, v2 m1, v2 m2, int i)
}
}
-/*
static void
-Effect_Curves(file_source *Source, void *BitmapAddress, uint16 ShaderProgram, uint8 *FileEffectAddress)
+Effect_Software_Curves(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, v2 *PointData, real32 PointCount, v4 PointCount_Col)
{
- uint32 ChannelIndex = *(uint32 *)(real32 *)FileEffectAddress;
- FileEffectAddress += sizeof(real32);
- real32 NumberOfPoints_Main = *(real32 *)FileEffectAddress;
- FileEffectAddress += sizeof(real32);
- v4 NumberOfPoints_Col = *(v4 *)FileEffectAddress;
- FileEffectAddress += sizeof(v4);
-
real32 LUT[5][256] = {};
for (int a = 0; a < 5; a++) {
- int Num = (a == 0) ? NumberOfPoints_Main : NumberOfPoints_Col.E[a-1];
- v2 *CurvePoint = (v2 *)(FileEffectAddress + (a * (sizeof(v2) * 10)));
+ int Num = (a == 0) ? (int)PointCount : (int)PointCount_Col.E[a-1];
+ v2 *CurvePoint = PointData + (MAX_PROPERTIES_PER_EFFECT / 5 * a);
for (int i = 0; i < Num; i++) {
v2 Point_P1 = CurvePoint[i];
@@ -164,13 +156,14 @@ Effect_Curves(file_source *Source, void *BitmapAddress, uint16 ShaderProgram, ui
}
- uint64 Size = Source->Width*Source->Height;
+ uint64 Size = Width*Height;
int i = 0;
Assert(BytesPerPixel == 4);
while (i < Size) {
- uint32 *Pixel = (uint32 *)BitmapAddress + i;
+ uint32 *Pixel = (uint32 *)EffectBitmapAddress + i;
v4 t = Uint32ToCol8(*Pixel);
+#if 1
real32 R_Lookup = LUT[1][(uint32)(t.r)];
real32 G_Lookup = LUT[2][(uint32)(t.g)];
real32 B_Lookup = LUT[3][(uint32)(t.b)];
@@ -179,8 +172,14 @@ Effect_Curves(file_source *Source, void *BitmapAddress, uint16 ShaderProgram, ui
real32 R_Lookup_All = LUT[0][(uint32)(R_Lookup*255)];
real32 G_Lookup_All = LUT[0][(uint32)(G_Lookup*255)];
real32 B_Lookup_All = LUT[0][(uint32)(B_Lookup*255)];
+#else
+ real32 R_Lookup_All = LUT[0][(uint32)(t.r)];
+ real32 G_Lookup_All = LUT[0][(uint32)(t.g)];
+ real32 B_Lookup_All = LUT[0][(uint32)(t.b)];
+#endif
+
- uint32 Result = (((uint32)((A_Lookup * 255.0f) + 0.5) << 24) |
+ uint32 Result = (((uint32)((t.a) + 0.5) << 24) |
((uint32)((B_Lookup_All * 255.0f) + 0.5) << 16) |
((uint32)((G_Lookup_All * 255.0f) + 0.5) << 8) |
((uint32)((R_Lookup_All * 255.0f) + 0.5) << 0));
@@ -189,4 +188,3 @@ Effect_Curves(file_source *Source, void *BitmapAddress, uint16 ShaderProgram, ui
i++;
}
}
-*/