[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1749-gf5fc0e9
[email protected] (Robin Watts) Thu, 24 Oct 2019 12:02:47 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via f5fc0e9941d0eb9cf93772a954e4ba729fbc4c02 (commit)
from a44d0ce727f2095fbbedb8bf6b1e062fca3c8f01 (commit)
----------------------------------------------------------------------
commit f5fc0e9941d0eb9cf93772a954e4ba729fbc4c02
Author: Robin Watts <[email protected]>
Date: Mon Oct 21 17:37:59 2019 +0100
Use CAL implementation of ETS in WITH_CAL builds.
diff --git a/base/cal.mak b/base/cal.mak
index c1a7b8c..7ffc870 100644
--- a/base/cal.mak
+++ b/base/cal.mak
@@ -118,5 +118,11 @@ $(CAL_OBJ)$(CAL_PREFIX)blendsse42.$(OBJ) : $(CAL_SRC)blendsse42.c $(cal_HDRS) $(
$(CAL_OBJ)$(CAL_PREFIX)blend.$(OBJ) : $(CAL_SRC)blend.c $(cal_HDRS) $(CAL_DEP) $(gsmemory_h)
$(CAL_CC) $(I_)$(GLSRC) $(CAL_O)blend.$(OBJ) $(C_) $(CAL_SRC)blend.c
+cal_ets_h=$(CAL_SRC)cal_ets.h
+ca_ets_tm_h=$(CAL_SRC)cal_ets_tm.h
+$(GLOBJ)ets_1.$(OBJ) : $(CAL_SRC)cal_ets.c $(CAL_SRC)ets_template.c $(AK) \
+ $(cal_ets_h) $(cal_ets_tm_h) $(LIB_MAK) $(MAKEDIRS)
+ $(GLCC) $(GLO_)ets_1.$(OBJ) $(C_) $(CAL_SRC)cal_ets.c
+
# end of file
diff --git a/base/ets.h b/base/ets.h
index a549da5..4b009b8 100644
--- a/base/ets.h
+++ b/base/ets.h
@@ -120,6 +120,7 @@ ets_line(ETS_Ctx *ctx, unsigned char **dest, const ETS_SrcPixel * const * gs_res
void
ets_destroy(void *malloc_arg, ETS_Ctx *ctx);
+/* These are called from ETS and must be implemented by the calling code. */
void *
ets_malloc(void *malloc_arg, int size);
diff --git a/base/gxdownscale.c b/base/gxdownscale.c
index e2e83ea..8721d1d 100644
--- a/base/gxdownscale.c
+++ b/base/gxdownscale.c
@@ -19,7 +19,12 @@
#include "string_.h"
#include "gdevprn.h"
#include "assert_.h"
+
+#ifdef WITH_CAL
+#include "cal_ets.h"
+#else
#include "ets.h"
+#endif
/* Nasty inline declaration, as gxht_thresh.h requires penum */
void gx_ht_threshold_row_bit_sub(byte *contone, byte *threshold_strip,
@@ -1799,6 +1804,57 @@ static int check_trapping(gs_memory_t *memory, int trap_w, int trap_h,
return 0;
}
+static void
+find_aspect_ratio(float *res, int *a, int *b)
+{
+ float xres = res[0];
+ float yres = res[1];
+ float f;
+
+ if (xres == yres) {
+ *a = *b = 1;
+ return;
+ }
+ else if (xres > yres)
+ {
+ xres /= yres;
+ f = xres - (int)xres;
+ if (f >= 0.2 && f < 0.3)
+ xres *= 4, yres = 4;
+ else if (f >= 0.3 && f < 0.4)
+ xres *= 3, yres = 3;
+ else if (f >= 0.4 && f < 0.6)
+ xres *= 2, yres = 2;
+ else if (f >= 0.6 && f < 0.7)
+ xres *= 3, yres = 3;
+ else if (f >= 0.7 && f < 0.8)
+ xres *= 4, yres = 4;
+ else
+ yres = 1;
+ *a = (int)(xres + 0.5);
+ *b = (int)yres;
+ }
+ else
+ {
+ yres /= xres;
+ f = yres - (int)yres;
+ if (f >= 0.2 && f < 0.3)
+ yres *= 4, xres = 4;
+ else if (f >= 0.3 && f < 0.4)
+ yres *= 3, xres = 3;
+ else if (f >= 0.4 && f < 0.6)
+ yres *= 2, xres = 2;
+ else if (f >= 0.6 && f < 0.7)
+ yres *= 3, xres = 3;
+ else if (f >= 0.7 && f < 0.8)
+ yres *= 4, xres = 4;
+ else
+ xres = 1;
+ *a = (int)xres;
+ *b = (int)(yres + 0.5);
+ }
+}
+
static int init_ets(gx_downscaler_t *ds, int num_planes, gx_downscale_core *downscale_core)
{
ETS_Params params = { 0 };
@@ -1831,13 +1887,15 @@ static int init_ets(gx_downscaler_t *ds, int num_planes, gx_downscale_core *down
for (i = 0; i < num_planes; i++)
rs_luts[i] = rs_lut;
+#ifdef WITH_CAL
+ params.context = ds->dev->memory->gs_lib_ctx->core->cal_ctx;
+#endif
params.width = ds->width;
params.n_planes = num_planes;
params.levels = 2;
params.luts = luts;
params.distscale = 0;
- params.aspect_x = 1;
- params.aspect_y = 1;
+ find_aspect_ratio(ds->dev->HWResolution, ¶ms.aspect_x, ¶ms.aspect_y);
params.strengths = strengths;
params.rand_scale = 0;
params.c1_scale = c1_scale;
diff --git a/base/lib.mak b/base/lib.mak
index 274a071..5c243f4 100644
--- a/base/lib.mak
+++ b/base/lib.mak
@@ -1363,19 +1363,30 @@ ets_h=$(GLSRC)ets.h
ets_tm_h=$(GLSRC)ets_tm.h
ets=$(GLOBJ)ets.$(OBJ)
-$(GLOBJ)ets.$(OBJ) : $(GLSRC)ets.c $(AK) \
+$(GLOBJ)ets_0.$(OBJ) : $(GLSRC)ets.c $(AK) \
$(ets_h) $(ets_tm_h) $(LIB_MAK) $(MAKEDIRS)
- $(GLCC) $(GLO_)ets.$(OBJ) $(C_) $(GLSRC)ets.c
+ $(GLCC) $(GLO_)ets_0.$(OBJ) $(C_) $(GLSRC)ets.c
+
+$(GLOBJ)ets.$(OBJ) : $(GLOBJ)ets_$(WITH_CAL).$(OBJ) $(AK) $(gp_h)
+ $(CP_) $(GLOBJ)ets_$(WITH_CAL).$(OBJ) $(GLOBJ)ets.$(OBJ)
# ----------- Downsampling routines ------------ #
gxdownscale_h=$(GLSRC)gxdownscale.h
downscale_=$(GLOBJ)gxdownscale.$(OBJ) $(claptrap) $(ets)
-$(GLOBJ)gxdownscale.$(OBJ) : $(GLSRC)gxdownscale.c $(AK) $(string__h)\
+$(GLOBJ)gxdownscale_0.$(OBJ) : $(GLSRC)gxdownscale.c $(AK) $(string__h)\
$(gxdownscale_h) $(gserrors_h) $(gdevprn_h) $(assert__h) $(ets_h)\
$(LIB_MAK) $(MAKEDIRS)
$(GLCC) $(GLO_)gxdownscale.$(OBJ) $(C_) $(GLSRC)gxdownscale.c
+$(GLOBJ)gxdownscale_1.$(OBJ) : $(GLSRC)gxdownscale.c $(AK) $(string__h)\
+ $(gxdownscale_h) $(gserrors_h) $(gdevprn_h) $(assert__h) $(ets_h)\
+ $(LIB_MAK) $(MAKEDIRS)
+ $(GLCC) $(D_)WITH_CAL$(_D) $(I_)$(CALSRCDIR)$(_I) $(GLO_)gxdownscale.$(OBJ) $(C_) $(GLSRC)gxdownscale.c
+
+$(GLOBJ)gxdownscale.$(OBJ) : $(GLOBJ)gxdownscale_$(WITH_CAL).$(OBJ) $(AK) $(gp_h)
+ $(CP_) $(GLOBJ)gxdownscale_$(WITH_CAL).$(OBJ) $(GLOBJ)gxdownscale.$(OBJ)
+
###### Create a pseudo-"feature" for the entire graphics library.
LIB0s=$(GLOBJ)gpmisc.$(OBJ) $(GLOBJ)stream.$(OBJ) $(GLOBJ)strmio.$(OBJ)
diff --git a/windows/GhostPDL.sln b/windows/GhostPDL.sln
index e75e70b..1a95e12 100644
--- a/windows/GhostPDL.sln
+++ b/windows/GhostPDL.sln
@@ -1,17 +1,22 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghostscript", "ghostscript.vcproj", "{1EDA2AC3-D74F-4F4D-B4D6-AC05CC594A2F}"
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.757
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghostscript", "ghostscript.vcxproj", "{1EDA2AC3-D74F-4F4D-B4D6-AC05CC594A2F}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghostpcl", "ghostpcl.vcproj", "{ED35CF95-DAA1-45B3-9206-599F4170F198}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghostpcl", "ghostpcl.vcxproj", "{ED35CF95-DAA1-45B3-9206-599F4170F198}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghostxps", "ghostxps.vcproj", "{DE21942C-CDA2-445B-B2EC-51FF54E0F0DD}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghostxps", "ghostxps.vcxproj", "{DE21942C-CDA2-445B-B2EC-51FF54E0F0DD}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghostpdl", "ghostpdl.vcproj", "{C4038125-61B9-4147-9EA8-39690BA3A599}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghostpdl", "ghostpdl.vcxproj", "{C4038125-61B9-4147-9EA8-39690BA3A599}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "All", "All.vcproj", "{98351FEF-0032-457C-B9D9-D6B68A829386}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "All", "All.vcxproj", "{98351FEF-0032-457C-B9D9-D6B68A829386}"
EndProject
Global
+ GlobalSection(Performance) = preSolution
+ HasPerformanceSessions = true
+ EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
@@ -135,4 +140,13 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {8F167B7C-A2B5-4F49-AF02-56169ECC22E3}
+ EndGlobalSection
+ GlobalSection(Performance) = preSolution
+ HasPerformanceSessions = true
+ EndGlobalSection
+ GlobalSection(Performance) = preSolution
+ HasPerformanceSessions = true
+ EndGlobalSection
EndGlobal
Summary of changes:
base/cal.mak | 6 +++++
base/ets.h | 1 +
base/gxdownscale.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++--
base/lib.mak | 17 +++++++++++---
windows/GhostPDL.sln | 28 ++++++++++++++++++------
5 files changed, 102 insertions(+), 12 deletions(-)