src/pixarith.c
PIX *
pixInitAccumulate(l_int32   w,
                  l_int32   h,
                  l_uint32  offset)
{
PIX  *pixd;

    PROCNAME("pixInitAccumulate");

    if ((pixd = pixCreate(w, h, 32)) == NULL)
        return (PIX *)ERROR_PTR("pixd not made", procName, NULL);
    if (offset > 0x40000000)
        offset = 0x40000000;
    pixSetAllArbitrary(pixd, offset);
    return pixd;
}
/*!
 *  pixInitAccumulate()
 *
 *      Input:  w, h (of accumulate array)
 *              offset (initialize the 32 bpp to have this
 *                      value; not more than 0x40000000)
 *      Return: pixd (32 bpp), or null on error
 *
 *  Notes:
 *      (1) The offset must be >= 0.
 *      (2) The offset is used so that we can do arithmetic
 *          with negative number results on l_uint32 data; it
 *          prevents the l_uint32 data from going negative.
 *      (3) Because we use l_int32 intermediate data results,
 *          these should never exceed the max of l_int32 (0x7fffffff).
 *          We do not permit the offset to be above 0x40000000,
 *          which is half way between 0 and the max of l_int32.
 *      (4) The same offset should be used for initialization,
 *          multiplication by a constant, and final extraction!
 *      (5) If you're only adding positive values, offset can be 0.
 */
pixInitAccumulate()
Input:  w, h (of accumulate array)
offset (initialize the 32 bpp to have this
value; not more than 0x40000000)
Return: pixd (32 bpp), or null on error

(1) The offset must be >= 0.
(2) The offset is used so that we can do arithmetic
with negative number results on l_uint32 data; it
prevents the l_uint32 data from going negative.
(3) Because we use l_int32 intermediate data results,
these should never exceed the max of l_int32 (0x7fffffff).
We do not permit the offset to be above 0x40000000,
which is half way between 0 and the max of l_int32.
(4) The same offset should be used for initialization,
multiplication by a constant, and final extraction.
(5) If you're only adding positive values, offset can be 0.
pixInitAccumulate () Input : w h ( of accumulate array ) offset ( initialize the 32 bpp to have this value ; not more than 0x40000000 ) Return : pixd ( 32 bpp ) or null on error ( 1 ) The offset must be > = 0 . ( 2 ) The offset is used so that we can do arithmetic with negative number results on l_uint32 data ; it prevents the l_uint32 data from going negative . ( 3 ) Because we use l_int32 intermediate data results these should never exceed the max of l_int32 ( 0x7fffffff ) . We do not permit the offset to be above 0x40000000 which is half way between 0 and the max of l_int32 . ( 4 ) The same offset should be used for initialization multiplication by a constant and final extraction . ( 5 ) If you ' re only adding positive values offset can be 0 .
PIX *
pixInitAccumulate(l_int32   w,
                  l_int32   h,
                  l_uint32  offset)
{
PIX  *pixd;
    PROCNAME("pixInitAccumulate");
    if ((pixd = pixCreate(w, h, 32)) == NULL)
        return (PIX *)ERROR_PTR("pixd not made", procName, NULL);
    if (offset > 0x40000000)
        offset = 0x40000000;
    pixSetAllArbitrary(pixd, offset);
    return pixd;
}
PIX * pixInitAccumulate ( l_int32 w , l_int32 h , l_uint32 offset ) { PIX * pixd ; PROCNAME ( " " ) ; if ( ( pixd = pixCreate ( w , h , 32 ) ) == NULL ) return ( PIX * ) ERROR_PTR ( " " , procName , NULL ) ; if ( offset > 0x40000000 ) offset = 0x40000000 ; pixSetAllArbitrary ( pixd , offset ) ; return pixd ; }
pixInitAccumulate()
      Input:  w, h (of accumulate array)
              offset (initialize the 32 bpp to have this
                      value; not more than 0x40000000)
      Return: pixd (32 bpp), or null on error
pixInitAccumulate () Input : w h ( of accumulate array ) offset ( initialize the 32 bpp to have this value ; not more than 0x40000000 ) Return : pixd ( 32 bpp ) or null on error