[gs-code-review] Recovering from incorrect Encode length.

Igor V. Melichev igor.melichev at artifex.com
Tue Oct 31 02:32:34 PST 2006


Alex, Ray,

I'm forwarding this request to Ray who keeps
a hardcopy of CET test pages made with Tek.
Ray assumes the hardcopies as a baseline.
Therefore it needs a visual comparison with hardcopy.

Igor.

----- Original Message ----- 
From: "Alex Cherepanov" <alexcher at quadnet.net>
To: "gs-code-review" <gs-code-review at ghostscript.com>
Sent: Tuesday, October 31, 2006 7:32 AM
Subject: [gs-code-review] Recovering from incorrect Encode length.


> Many gradients in the CET test use Type 3 function with incorrect
> Encoding array - 2 elements long instead of 4. Adobe Interpreters
> appear to pad the missing elements with 0 (judging from the picture),
> although Distiller 5 is indeterministic.
>
> This problem affects
> 09-47h -> partial
> 09-47i -> fixed
> 09-47j -> partial
> 09-47k -> partial
> 09-47l -> partial
> 09-47m -> partial
> 12-14L -> fixed
> 12-14m -> partial, fixes all errors, but CPSI fails once
> 12-14n -> fixed
> 12-14o -> partial
> 12-14q -> fixed
>
> I cannot figure out why a single function for /DeviceGray color space is
> accepted, but a vector of 3 functions for DeviceRGB is not. See the
> case 12-14m for details.
>


--------------------------------------------------------------------------------


> Index: gs/src/zfunc3.c
> ===================================================================
> --- gs/src/zfunc3.c (revision 7132)
> +++ gs/src/zfunc3.c (working copy)
> @@ -96,10 +96,34 @@
>  goto fail;
>  }
>     }
> -    if ((code = fn_build_float_array(op, "Bounds", true, false, 
> &params.Bounds, mem)) != params.k - 1 ||
> - (code = fn_build_float_array(op, "Encode", true, true, &params.Encode, 
> mem)) != 2 * params.k
> - )
> +    if ((code = fn_build_float_array(op, "Bounds", true, false, 
> &params.Bounds, mem)) != params.k - 1 )
>  goto fail;
> +    { /* Adobe implementation doesn't check the Encode length. */
> +      /* Extra elements are ignored; missing elements are filled with 0. 
> */
> +      /* CET 12-14m.ps depends on this bug */
> +      uint sz, k2 = 2 * params.k;
> +      ref *encode;
> +      float *p = (float *)gs_alloc_byte_array(mem, k2, sizeof(float), 
> "Encode");
> +      params.Encode = p;
> +      if (p == 0) {
> +          code = gs_note_error(e_VMerror);
> +          goto fail;
> +      }
> +      if (dict_find_string(op, "Encode", &encode) <= 0) {
> +          code = gs_note_error(e_undefined);
> +          goto fail;
> +      }
> +      if (!r_is_array(encode)) {
> +          code = gs_note_error(e_typecheck);
> +          goto fail;
> +      }
> +      sz =  min(k2, r_size(encode));
> +      code = process_float_array(mem, encode, sz, p);
> +      while (sz < k2)
> +        p[sz++] = 0.;
> +      if (code < 0)
> +          goto fail;
> +    }
>     if (params.Range == 0)
>  params.n = params.Functions[0]->params.n;
>     code = gs_function_1ItSg_init(ppfn, &params, mem);
>


--------------------------------------------------------------------------------


> _______________________________________________
> gs-code-review mailing list
> gs-code-review at ghostscript.com
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
> 



More information about the gs-code-review mailing list