28 #define DEFAULT_PSF_SIGMA           0.35 
   29 #define DEFAULT_K                   (1.0/255) 
   30 #define DEFAULT_TOL                 (3e-4) 
   31 #define DEFAULT_MAXMETHODITER          50 
   32 #define DEFAULT_DIFFITER            5 
   80     puts(
"Tensor-driven diffusion interpolation demo, P. Getreuer 2010-2011\n");
 
   81     puts(
"Usage: tdinterp [options] <input file> <output file>\n\n" 
   84     puts(
"  -x <number>  the scale factor (must be integer)");
 
   85     puts(
"  -p <number>  sigma_h, the blur size of the point spread function");
 
   86     puts(
"  -K <number>  K, parameter in constructing the tensor (default 1/255)");
 
   87     puts(
"  -t <number>  tol, convergence tolerance (default 3e-4)");
 
   88     puts(
"  -N <number>  N, maximum number of method iterations (default 50)");
 
   89     puts(
"  -n <number>  n, number of diffusion steps per method iteration (default 5)\n");
 
   91     puts(
"  -q <number>  quality for saving JPEG images (0 to 100)\n");
 
   93     puts(
"Example: 4x scaling, sigma_h = 0.5\n" 
   94          "  tdinterp -x 4 -p 0.5 frog.bmp frog-4x.bmp");
 
   98 int main(
int argc, 
char *argv[])
 
  101     image v = {NULL, 0, 0}, u = {NULL, 0, 0};
 
  123     if(!(u.Data = (
float *)
Malloc(
sizeof(
float)*3*
 
  124         ((
long int)u.Width)*((
long int)u.Height))))
 
  149     static const char *DefaultOutputFile = (
const char *)
"out.bmp";
 
  174     for(i = 1; i < argc;)
 
  176         if(argv[i] && argv[i][0] == 
'-')
 
  178             if((OptionChar = argv[i][1]) == 0)
 
  185                 OptionString = &argv[i][2];
 
  187                 OptionString = argv[i];
 
  201                     ErrorMessage(
"Scale factor cannot be less than 1.0.\n");
 
  206                 Param->
PsfSigma = atof(OptionString);
 
  210                     ErrorMessage(
"Point spread blur size must be nonnegative.\n");
 
  220                 Param->
K = atof(OptionString);
 
  229                 Param->
Tol = atof(OptionString);
 
  231                 if(Param->
Tol <= 0.0)
 
  233                     ErrorMessage(
"Convergence tolerance must be positive.\n");
 
  242                     ErrorMessage(
"Number of method iterations must be nonnegative.\n");
 
  247                 Param->
DiffIter = atoi(OptionString);
 
  251                     ErrorMessage(
"Number of diffusion iterations must be positive.\n");
 
  261                     ErrorMessage(
"JPEG quality must be between 0 and 100.\n");
 
  270                 if(isprint(OptionChar))