src/quadtree.c
l_int32
quadtreeMaxLevels(l_int32  w,
                  l_int32  h)
{
l_int32  i, minside;

    minside = L_MIN(w, h);
    for (i = 0; i < 20; i++) {  /* 2^10 = one million */
        if (minside < (1.5 * (1 << i)))
            return i - 1;
    }

    return -1;  /* fail if the image has over a trillion pixels! */
}
/*!
 *  quadtreeMaxLevels()
 *
 *      Input:  w, h (of image)
 *      Return: maxlevels (maximum number of levels allowed), or -1 on error
 *
 *  Notes:
 *      (1) The criterion for maxlevels is that the subdivision not
 *          go down below the single pixel level.  The 1.5 factor
 *          is intended to keep any rectangle from accidentally
 *          having zero dimension due to integer truncation.
 */
quadtreeMaxLevels()
Input:  w, h (of image)
Return: maxlevels (maximum number of levels allowed), or -1 on error

(1) The criterion for maxlevels is that the subdivision not
go down below the single pixel level.  The 1.5 factor
is intended to keep any rectangle from accidentally
having zero dimension due to integer truncation.
quadtreeMaxLevels () Input : w h ( of image ) Return : maxlevels ( maximum number of levels allowed ) or - 1 on error ( 1 ) The criterion for maxlevels is that the subdivision not go down below the single pixel level . The 1 . 5 factor is intended to keep any rectangle from accidentally having zero dimension due to integer truncation .
l_int32
quadtreeMaxLevels(l_int32  w,
                  l_int32  h)
{
l_int32  i, minside;
    minside = L_MIN(w, h);
    for (i = 0; i < 20; i++) {  
        if (minside < (1.5 * (1 << i)))
            return i - 1;
    }
    return -1;  
}
l_int32 quadtreeMaxLevels ( l_int32 w , l_int32 h ) { l_int32 i , minside ; minside = L_MIN ( w , h ) ; for ( i = 0 ; i < 20 ; i ++ ) { if ( minside < ( 1.5 * ( 1 << i ) ) ) return i - 1 ; } return -1 ; }
quadtreeMaxLevels()
      Input:  w, h (of image)
      Return: maxlevels (maximum number of levels allowed), or -1 on error
quadtreeMaxLevels () Input : w h ( of image ) Return : maxlevels ( maximum number of levels allowed ) or - 1 on error
/* 2^10 = one million */ /* fail if the image has over a trillion pixels! */