Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef _CASM_H_
Toshihiro Shimizu 890ddd
#define _CASM_H_
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <stdarg.h></stdarg.h>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define MSG_I 1
Toshihiro Shimizu 890ddd
#define MSG_W 2
Toshihiro Shimizu 890ddd
#define MSG_E 3
Toshihiro Shimizu 890ddd
#define MSG_F 4
Toshihiro Shimizu 890ddd
#define MSG_IE 5
Toshihiro Shimizu 890ddd
#define MSG_IF 6
Toshihiro Shimizu 890ddd
#define MSG_P 7
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum CASM_RESAMPLE_TYPE {
Shinya Kitaoka 120a6e
  CASM_RESAMPLE_NULL,
Shinya Kitaoka 120a6e
  CASM_RESAMPLE_STANDARD,
Shinya Kitaoka 120a6e
  CASM_RESAMPLE_IMPROVED,
Shinya Kitaoka 120a6e
  CASM_RESAMPLE_HIGH
Toshihiro Shimizu 890ddd
} CASM_RESAMPLE_TYPE;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef struct {
Shinya Kitaoka 120a6e
  char *name;
Shinya Kitaoka 120a6e
  int (*routine)(void);
Toshihiro Shimizu 890ddd
} KEYWORD;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
typedef struct { double x, y, z; } VECTOR;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct CASM_WINDOW {
Shinya Kitaoka 120a6e
  int x1, y1, x2, y2;
Shinya Kitaoka 120a6e
  struct CASM_WINDOW *next;
Toshihiro Shimizu 890ddd
} CASM_WINDOW;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define SLICE_LX 1024
Toshihiro Shimizu 890ddd
#define SLICE_LY 1024
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define LOADABLE_PIXELS (1024 * 1024) /* WARNING  it must be greater or */
Shinya Kitaoka 120a6e
                                      /* equal to SLICE_LX*SLICE_LY!    */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define CASM_RENDER_DEFAULT 1.0
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define CASM_MEM_CHUNK_DEFAULT 1.0
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#define INTERSECT(win1, win2, win)                                             \
Shinya Kitaoka 120a6e
  (win)->x1 = MAX((win1)->x1, (win2)->x1);                                     \
Shinya Kitaoka 120a6e
  (win)->y1 = MAX((win1)->y1, (win2)->y1);                                     \
Shinya Kitaoka 120a6e
  (win)->x2 = MIN((win1)->x2, (win2)->x2);                                     \
Shinya Kitaoka 120a6e
  (win)->y2 = MIN((win1)->y2, (win2)->y2)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define UNION(win1, win2, win)                                                 \
Shinya Kitaoka 120a6e
  (win)->x1 = MIN((win1)->x1, (win2)->x1);                                     \
Shinya Kitaoka 120a6e
  (win)->y1 = MIN((win1)->y1, (win2)->y1);                                     \
Shinya Kitaoka 120a6e
  (win)->x2 = MAX((win1)->x2, (win2)->x2);                                     \
Shinya Kitaoka 120a6e
  (win)->y2 = MAX((win1)->y2, (win2)->y2)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define RESIZE_RECT(win, border)                                               \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    (win)->x1 -= border;                                                       \
Shinya Kitaoka 120a6e
    (win)->y1 -= border;                                                       \
Shinya Kitaoka 120a6e
    (win)->x2 += border;                                                       \
Shinya Kitaoka 120a6e
    (win)->y2 += border;                                                       \
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define DDR_FILENAME " DDR"
Toshihiro Shimizu 890ddd
#define DDR_FILENAME_LEN 4
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef WIN32
Toshihiro Shimizu 890ddd
#define CASM_LINK_MASK_STRING " -link "
Shinya Kitaoka 120a6e
#define CASM_LINK_QUAL_STRING                                                  \
Shinya Kitaoka 120a6e
  "-link             : forces casm to create a link to the previous image if " \
Shinya Kitaoka 120a6e
  "the\n"                                                                      \
Shinya Kitaoka 120a6e
  "                    current image is identical. By default ngcasm writes\n" \
Shinya Kitaoka 120a6e
  "                    another identical image on disk.\n"
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define CASM_LINK_MASK_STRING " "
Toshihiro Shimizu 890ddd
#define CASM_LINK_QUAL_STRING "\n"
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#define CASM_USAGE_MASK                                                        \
Shinya Kitaoka 120a6e
  " --pt --shmem%d%s  -trace -cf -constant_focus  -intmove "                   \
Shinya Kitaoka 120a6e
  " -fracmove --pipe%d --dimensions%d%d -shrink%d -s%d --rd%d "                \
Shinya Kitaoka 120a6e
  " -hq -iq -sq -no_overwrite -no -logfile%s -gamma%f -local_render -clap "    \
Shinya Kitaoka 120a6e
  " -step%d -range%d%d -r%d%d -mem%f -tile%f -64bit -32bit -lineart%d "        \
Shinya Kitaoka 120a6e
  "-edgealiasing%d -ddr%d" CASM_LINK_MASK_STRING                               \
Shinya Kitaoka 120a6e
  " --nowait -frame%d -first%d -bc%s -ac%s -bc_args%s -ac_args%s -mm "         \
Shinya Kitaoka 120a6e
  "-mmsingle%d [filename]"
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define CASM_USAGE_STRING                                                      \
Shinya Kitaoka 120a6e
  "-range fs fe      : \n"                                                     \
Shinya Kitaoka 120a6e
  "-r fs fe          : compose the frames ranging from 'fs' to 'fe'\n"         \
Shinya Kitaoka 120a6e
  "-frame n          : compose the frame 'n' only\n"                           \
Shinya Kitaoka 120a6e
  "-step  n          : compose each 'n' frames\n"                              \
Shinya Kitaoka 120a6e
  "-intmove          : do NOT apply subpixel positioning for full-color "      \
Shinya Kitaoka 120a6e
  "levels \n"                                                                  \
Shinya Kitaoka 120a6e
  "-fracmove         : apply subpixel positioning also for anim-type\n"        \
Shinya Kitaoka 120a6e
  "-64bit            : renders 64 bit color images\n"                          \
Shinya Kitaoka 120a6e
  "-mm               : save the levels of each frame separately\n"             \
Shinya Kitaoka 120a6e
  "-mmsingle [ #col ]: computes and save only level in the #col column "       \
Shinya Kitaoka 120a6e
  "number\n"                                                                   \
Shinya Kitaoka 120a6e
  "                    in the exposure sheet \n"                               \
Shinya Kitaoka 120a6e
  "-shrink value     :  \n"                                                    \
Shinya Kitaoka 120a6e
  "-s      value     : subsample one each 'value' pixels and one each\n"       \
Shinya Kitaoka 120a6e
  "-bc scriptfile    : execute scriptfile before frame composition\n"          \
Shinya Kitaoka 120a6e
  "-ac scriptfile    : execute scriptfile after  frame composition\n"          \
Shinya Kitaoka 120a6e
  "-bc_args args     : argument(s) for 'bc' script \n"                         \
Shinya Kitaoka 120a6e
  "-ac_args args     : argument(s) for 'ac' script \n"                         \
Shinya Kitaoka 120a6e
  "-no_overwrite     : \n"                                                     \
Shinya Kitaoka 120a6e
  "-no               : skip computing of already existing frames on disk\n"    \
Shinya Kitaoka 120a6e
  "                    (useful to render scenes on multiple workstations\n"    \
Shinya Kitaoka 120a6e
  "                    sharing the same database)\n"                           \
Shinya Kitaoka 120a6e
  "-tile xsize       : dimensions (in Kilopixels) of the largest squared "     \
Shinya Kitaoka 120a6e
  "portion \n"                                                                 \
Shinya Kitaoka 120a6e
  "                    of the frame to be composed in one step; xsize does "   \
Shinya Kitaoka 120a6e
  "not \n"                                                                     \
Shinya Kitaoka 120a6e
  "                    need to be an integer. \n"                              \
Shinya Kitaoka 120a6e
  "-mem value        : dimensions (in Kilopixels) of the squared portion of\n" \
Shinya Kitaoka 120a6e
  "                    background image to be kept in RAM memory.\n"           \
Shinya Kitaoka 120a6e
  "                    It must be greater or equal to xsize of option -tile\n" \
Shinya Kitaoka 120a6e
  "-constant_focus   : \n"                                                     \
Shinya Kitaoka 120a6e
  "-cf               : forces casm to work in constant focus mode, thus "      \
Shinya Kitaoka 120a6e
  "avoiding\n"                                                                 \
Shinya Kitaoka 120a6e
  "                    abrupt changes from slight blurry to focused images "   \
Shinya Kitaoka 120a6e
  "as the \n"                                                                  \
Shinya Kitaoka 120a6e
  "                    camera zooms toward the final field size. This "        \
Shinya Kitaoka 120a6e
  "qualifier\n"                                                                \
Shinya Kitaoka 120a6e
  "                    should be used ONLY when a zoom operation creates the " \
Shinya Kitaoka 120a6e
  "above\n"                                                                    \
Shinya Kitaoka 120a6e
  "                    described problem because its usage will cause a "      \
Shinya Kitaoka 120a6e
  "longer\n"                                                                   \
Shinya Kitaoka 120a6e
  "                    compositing time and will force the camera to remain "  \
Shinya Kitaoka 120a6e
  "\n"                                                                         \
Shinya Kitaoka 120a6e
  "                    constantly out-of-focus.\n"                             \
Shinya Kitaoka 120a6e
  "-sq               :\n"                                                      \
Shinya Kitaoka 120a6e
  "-iq               :\n"                                                      \
Shinya Kitaoka 120a6e
  "-hq               : sets the resample quality respectively to standard, "   \
Shinya Kitaoka 120a6e
  "improved\n"                                                                 \
Shinya Kitaoka 120a6e
  "                    or high quality for geometrical transformations\n"      \
Shinya Kitaoka 120a6e
  "                    default: Resample type set in toonzsetup module.\n"     \
Shinya Kitaoka 120a6e
  "-logfile filename : writes a log file with all the errors and warnings.\n"  \
Shinya Kitaoka 120a6e
  "-ddr startframe   : direct output frames on a Digital Disc Recorder "       \
Shinya Kitaoka 120a6e
  "starting from specified position.\n"                                        \
Shinya Kitaoka 120a6e
  "-local_render     : makes a local copy of image files locally, to speed "   \
Shinya Kitaoka 120a6e
  "up rendering\n"                                                             \
Shinya Kitaoka 120a6e
  "-gamma value      : performs a gamma correction of specified value on all " \
Shinya Kitaoka 120a6e
  "\n"                                                                         \
Shinya Kitaoka 120a6e
  "                    rendered images\n"                                      \
Shinya Kitaoka 120a6e
  "-lineart value    : produces an aliased output image, with colors from "    \
Shinya Kitaoka 120a6e
  "original palette; \n"                                                       \
Shinya Kitaoka 120a6e
  "                    it is ignored if not used in conjunction with -mm or "  \
Shinya Kitaoka 120a6e
  "-mmsingle and on \n"                                                        \
Shinya Kitaoka 120a6e
  "                    full color input images\n"                              \
Shinya Kitaoka 120a6e
  "-edgealiasing value : produces an  output image with contour edges "        \
Shinya Kitaoka 120a6e
  "aliased;\n"                                                                 \
Shinya Kitaoka 120a6e
  "                      so, matte channel pixel values are either "           \
Shinya Kitaoka 120a6e
  "transparent or opaque; \n"                                                  \
Shinya Kitaoka 120a6e
  "                    it is ignored if not used in conjunction with -mm or "  \
Shinya Kitaoka 120a6e
  "-mmsingle and on \n"                                                        \
Shinya Kitaoka 120a6e
  "                    full color input images\n" CASM_LINK_QUAL_STRING
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif