Hi,

I finally rather updated the draw and glue to latest upstream. Please let me 
know if you still get an issue e.g. with GCC 4.8

Committed revision 1860.

Greetings,
        René

On Jun 18, 2013, at 24:24 , Sven Eckelmann wrote:

> GCC 4.8 uses an aggressive loop optimizer which can cause unexpected runtime
> behavior when the code tries to access memory in an incorrect way.
> 
> Signed-off-by: Sven Eckelmann <[email protected]>
> ---
> codecs/dcraw.h | 46 +++++++++++++++++++++++++++++++---------------
> 1 file changed, 31 insertions(+), 15 deletions(-)
> 
> diff --git a/codecs/dcraw.h b/codecs/dcraw.h
> index 973f918..f476e24 100644
> --- a/codecs/dcraw.h
> +++ b/codecs/dcraw.h
> @@ -2145,6 +2145,8 @@ int CLASS radc_token (int tree)
>   return dindex->leaf;
> }
> 
> +#define ARRAY_SIZE(_array) (sizeof(_array) / sizeof((_array)[0]))
> +
> #define FORYX for (y=1; y < 3; y++) for (x=col+1; x >= col; x--)
> 
> #define PREDICTOR (c ? (buf[c][y-1][x] + buf[c][y][x+1]) / 2 \
> @@ -2157,8 +2159,12 @@ void CLASS kodak_radc_load_raw()
> 
>   init_decoder();
>   getbits(-1);
> -  for (i=0; i < sizeof(buf)/sizeof(short); i++)
> -    buf[0][0][i] = 2048;
> +  for (c=0; c < ARRAY_SIZE(buf); c++) {
> +    for (y=0; y < ARRAY_SIZE(buf[0]); y++) {
> +      for (x=0; y < ARRAY_SIZE(buf[0][0]); x++)
> +        buf[c][y][x] = 2048;
> +    }
> +  }
>   for (row=0; row < height; row+=4) {
>     FORC3 mul[c] = getbits(6);
>     FORC3 {
> @@ -3092,9 +3098,11 @@ void CLASS foveon_interpolate()
> 
>   black = (float (*)[3]) calloc (height, sizeof *black);
>   for (row=0; row < height; row++) {
> -    for (i=0; i < 6; i++)
> -      ddft[0][0][i] = ddft[1][0][i] +
> -     row / (height-1.0) * (ddft[2][0][i] - ddft[1][0][i]);
> +    for (c=0; c < ARRAY_SIZE(ddft[0]); c++) {
> +      for (i=0; i < ARRAY_SIZE(ddft[0][0]); i++)
> +        ddft[0][c][i] = ddft[1][c][i] +
> +          row / (height-1.0) * (ddft[2][c][i] - ddft[1][c][i]);
> +    }
>     FORC3 black[row][c] =
>       ( foveon_avg (image[row*width]+c, dscr[0], cfilt) +
>         foveon_avg (image[row*width]+c, dscr[1], cfilt) * 3
> @@ -3138,9 +3146,11 @@ void CLASS foveon_interpolate()
>     FORC3 black[row][c] += fsum[c]/2 + total[c]/(total[3]*100.0);
> 
>   for (row=0; row < height; row++) {
> -    for (i=0; i < 6; i++)
> -      ddft[0][0][i] = ddft[1][0][i] +
> -     row / (height-1.0) * (ddft[2][0][i] - ddft[1][0][i]);
> +    for (c=0; c < ARRAY_SIZE(ddft[0]); c++) {
> +      for (i=0; i < ARRAY_SIZE(ddft[0][0]); i++)
> +        ddft[0][c][i] = ddft[1][c][i] +
> +          row / (height-1.0) * (ddft[2][c][i] - ddft[1][c][i]);
> +    }
>     pix = image[row*width];
>     memcpy (prev, pix, sizeof prev);
>     frow = row / (height-1.0) * (dim[2]-1);
> @@ -4816,8 +4826,10 @@ void CLASS parse_mos (int offset)
>       strcpy (model, mod[i]);
>     }
>     if (!strcmp(data,"icc_camera_to_tone_matrix")) {
> -      for (i=0; i < 9; i++)
> -     romm_cam[0][i] = int_to_float(get4());
> +      for (c=0; c < ARRAY_SIZE(romm_cam); c++) {
> +     for (i=0; i < ARRAY_SIZE(romm_cam[0]); i++)
> +       romm_cam[c][i] = int_to_float(get4());
> +      }
>       romm_coeff (romm_cam);
>     }
>     if (!strcmp(data,"CaptProf_color_matrix")) {
> @@ -5725,8 +5737,10 @@ void CLASS parse_phase_one (int base)
>     switch (tag) {
>       case 0x100:  flip = "0653"[data & 3]-'0';  break;
>       case 0x106:
> -     for (i=0; i < 9; i++)
> -       romm_cam[0][i] = getreal(11);
> +     for (c=0; c < ARRAY_SIZE(romm_cam); c++) {
> +       for (i=0; i < ARRAY_SIZE(romm_cam[0]); i++)
> +         romm_cam[c][i] = getreal(11);
> +     }
>       romm_coeff (romm_cam);
>       break;
>       case 0x107:
> @@ -6458,15 +6472,17 @@ void CLASS adobe_coeff (const char *make, const char 
> *model)
>   };
>   double cam_xyz[4][3];
>   char name[130];
> -  int i, j;
> +  int i, j, c;
> 
>   sprintf (name, "%s %s", make, model);
>   for (i=0; i < sizeof table / sizeof *table; i++)
>     if (!strncmp (name, table[i].prefix, strlen(table[i].prefix))) {
>       if (table[i].black)   black   = (ushort) table[i].black;
>       if (table[i].maximum) maximum = (ushort) table[i].maximum;
> -      for (j=0; j < 12; j++)
> -     cam_xyz[0][j] = table[i].trans[j] / 10000.0;
> +      for (c=0; c < ARRAY_SIZE(cam_xyz); c++) {
> +     for (j=0; j < ARRAY_SIZE(cam_xyz[0]); j++)
> +       cam_xyz[0][j] = table[i].trans[c * ARRAY_SIZE(cam_xyz[0]) + j] / 
> 10000.0;
> +      }
>       cam_xyz_coeff (cam_xyz);
>       break;
>     }
> -- 
> 1.8.3.1
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [email protected] with a subject of: unsubscribe exact-image

-- 
 ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin
 DE Legal: Amtsgericht Berlin (Charlottenburg) HRB 105123B, Tax-ID#: DE251602478
 Managing Director: René Rebe
 http://exactcode.com | http://exactscan.com | http://ocrkit.com | 
http://t2-project.org | http://rene.rebe.de

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[email protected] with a subject of: unsubscribe exact-image

Reply via email to