summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'base/gxdownscale.h')
-rw-r--r--base/gxdownscale.h245
1 files changed, 66 insertions, 179 deletions
diff --git a/base/gxdownscale.h b/base/gxdownscale.h
index d237a648..c9db668e 100644
--- a/base/gxdownscale.h
+++ b/base/gxdownscale.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2019 Artifex Software, Inc.
+/* Copyright (C) 2001-2020 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -69,6 +69,8 @@ typedef void (gx_downscale_core)(gx_downscaler_t *ds,
int plane,
int span);
+typedef struct gx_downscale_liner_s gx_downscale_liner;
+
struct gx_downscaler_s {
gx_device *dev; /* Device */
int width; /* Width (pixels) */
@@ -87,9 +89,7 @@ struct gx_downscaler_s {
int num_comps; /* Number of components as rendered */
int num_planes; /* Number of planes if planar, 0 otherwise */
- ClapTrap *claptrap; /* ClapTrap pointer (if trapping) */
- int claptrap_y; /* y pointer (if trapping) */
- gs_get_bits_params_t *claptrap_params; /* params (if trapping) */
+ gx_downscale_liner *liner; /* Source for line data */
int early_cm;
gx_downscale_cm_fn *apply_cm;
@@ -107,8 +107,26 @@ struct gx_downscaler_s {
byte *htrow_alloc;
byte *inbuf;
byte *inbuf_alloc;
+
+ int do_skew_detection;
+ int skew_detected;
+ double skew_angle;
};
+/* The following structure is used to hold the configuration
+ * parameters for the downscaler.
+ */
+typedef struct gx_downscaler_params_s
+{
+ int downscale_factor;
+ int min_feature_size;
+ int trap_w;
+ int trap_h;
+ int trap_order[GS_CLIENT_COLOR_MAX_COMPONENTS];
+ int ets;
+ int do_skew_detection;
+} gx_downscaler_params;
+
/* To use the downscaler:
*
* + define a gx_downscaler_t on the stack.
@@ -118,7 +136,7 @@ struct gx_downscaler_s {
* gx_downscaler_get_bits_rectangle (for planar mode)
* + finalise with gx_downscaler_fin
*/
-
+
/* For chunky mode, currently only:
* src_bpc == 8 && dst_bpc == 1 && num_comps == 1
* src_bpc == 8 && dst_bpc == 8 && num_comps == 1
@@ -131,179 +149,59 @@ struct gx_downscaler_s {
* src_bpp == 16 && dst_bpp == 16
* are supported.
*/
-int gx_downscaler_init(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width);
-
-int gx_downscaler_init_ets(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width,
- int ets);
-
-int gx_downscaler_init_trapped(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width,
- int trap_w,
- int trap_h,
- const int *comp_order);
-
-int gx_downscaler_init_trapped_ets(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width,
- int trap_w,
- int trap_h,
- const int *comp_order,
- int ets);
-
-int gx_downscaler_init_cm(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width,
- gx_downscale_cm_fn *apply_cm,
- void *apply_cm_arg,
- int post_cm_num_comps);
-
-int gx_downscaler_init_cm_ets(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width,
- gx_downscale_cm_fn *apply_cm,
- void *apply_cm_arg,
- int post_cm_num_comps,
- int ets);
-
-int gx_downscaler_init_trapped_cm(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width,
- int trap_w,
- int trap_h,
- const int *comp_order,
- gx_downscale_cm_fn *apply_cm,
- void *apply_cm_arg,
- int post_cm_num_comps);
-
-int gx_downscaler_init_trapped_cm_ets(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width,
- int trap_w,
- int trap_h,
- const int *comp_order,
- gx_downscale_cm_fn *apply_cm,
- void *apply_cm_arg,
- int post_cm_num_comps,
- int ets);
-
-int gx_downscaler_init_trapped_cm_halftone(gx_downscaler_t *ds,
- gx_device *dev,
- int src_bpc,
- int dst_bpc,
- int num_comps,
- int factor,
- int mfs,
- int (*adjust_width_proc)(int, int),
- int adjust_width,
- int trap_w,
- int trap_h,
- const int *comp_order,
- gx_downscale_cm_fn *apply_cm,
- void *apply_cm_arg,
- int post_cm_num_comps,
- gx_downscaler_ht_t *ht);
+int gx_downscaler_init(gx_downscaler_t *ds,
+ gx_device *dev,
+ int src_bpc,
+ int dst_bpc,
+ int num_comps,
+ const gx_downscaler_params *params,
+ int (*adjust_width_proc)(int, int),
+ int adjust_width);
+
+int gx_downscaler_init_cm(gx_downscaler_t *ds,
+ gx_device *dev,
+ int src_bpc,
+ int dst_bpc,
+ int num_comps,
+ const gx_downscaler_params *params,
+ int (*adjust_width_proc)(int, int),
+ int adjust_width,
+ gx_downscale_cm_fn *apply_cm,
+ void *apply_cm_arg,
+ int post_cm_num_comps);
+
+int gx_downscaler_init_cm_halftone(gx_downscaler_t *ds,
+ gx_device *dev,
+ int src_bpc,
+ int dst_bpc,
+ int num_comps,
+ const gx_downscaler_params *params,
+ int (*adjust_width_proc)(int, int),
+ int adjust_width,
+ gx_downscale_cm_fn *apply_cm,
+ void *apply_cm_arg,
+ int post_cm_num_comps,
+ gx_downscaler_ht_t *ht);
int gx_downscaler_init_planar(gx_downscaler_t *ds,
gx_device *dev,
- gs_get_bits_params_t *params,
- int num_comps,
- int factor,
- int mfs,
int src_bpc,
- int dst_bpc);
-
-int gx_downscaler_init_planar_trapped(gx_downscaler_t *ds,
- gx_device *dev,
- gs_get_bits_params_t *params,
- int num_comps,
- int factor,
- int mfs,
- int src_bpc,
- int dst_bpc,
- int trap_w,
- int trap_h,
- const int *comp_order);
+ int dst_bpc,
+ int num_comps,
+ const gx_downscaler_params *params,
+ const gs_get_bits_params_t *gb_params);
int gx_downscaler_init_planar_cm(gx_downscaler_t *ds,
gx_device *dev,
- gs_get_bits_params_t *params,
- int num_comps,
- int factor,
- int mfs,
int src_bpc,
int dst_bpc,
+ int num_comps,
+ const gx_downscaler_params *params,
+ const gs_get_bits_params_t *gb_params,
gx_downscale_cm_fn *apply_cm,
void *apply_cm_arg,
int post_cm_num_comps);
-int gx_downscaler_init_planar_trapped_cm(gx_downscaler_t *ds,
- gx_device *dev,
- gs_get_bits_params_t *params,
- int num_comps,
- int factor,
- int mfs,
- int src_bpc,
- int dst_bpc,
- int trap_w,
- int trap_h,
- const int *comp_order,
- gx_downscale_cm_fn *apply_cm,
- void *apply_cm_arg,
- int post_cm_num_comps);
-
int gx_downscaler_getbits(gx_downscaler_t *ds,
byte *out_data,
int row);
@@ -316,6 +214,8 @@ int gx_downscaler_get_bits_rectangle(gx_downscaler_t *ds,
* fin several times) */
void gx_downscaler_fin(gx_downscaler_t *ds);
+void gx_downscaler_decode_factor(int factor, int *up, int *down);
+
int
gx_downscaler_scale(int width, int factor);
@@ -331,21 +231,8 @@ int gx_downscaler_process_page(gx_device *dev,
gx_process_page_options_t *options,
int factor);
-/* The following structure is used to hold the configuration
- * parameters for the downscaler.
- */
-typedef struct gx_downscaler_params_s
-{
- int downscale_factor;
- int min_feature_size;
- int trap_w;
- int trap_h;
- int trap_order[GS_CLIENT_COLOR_MAX_COMPONENTS];
- int ets;
-} gx_downscaler_params;
-
#define GX_DOWNSCALER_PARAMS_DEFAULTS \
-{ 1, 0, 0, 0, { 3, 1, 0, 2 } }
+{ 1, 0, 0, 0, { 3, 1, 0, 2 }, 0, 0 }
enum {
GX_DOWNSCALER_PARAMS_MFS = 1,